NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.95k stars 13.97k forks source link

compose-android-packages does not support aarch64-darwin (or any arm systems?) #303968

Open asyncmeow opened 6 months ago

asyncmeow commented 6 months ago

Describe the bug

I'm a beginner to Nix in general, and trying to use it to better manage development environments for projects I'm working on, as I keep running into issues like needing different versions of tools for different projects. In this case, I'm trying to use this project to make a Nix environment for Flutter development. However, trying to start a shell, I get this error message:

       error: No Android SDK tarballs are available for system architecture: aarch64-darwin

However, it seems the SDK downloads (if I'm looking at the right ones?) are not architecture-specific. (If it matters - I'm looking at the command line tools listed here at the bottom of the page).

Steps To Reproduce

Steps to reproduce the behavior:

  1. Clone the above-linked Flutter "hello world" project on an Apple Silicon mac
  2. Attempt to start a nix shell
  3. Get the error pasted above

Expected behavior

I expected a shell to start with Flutter available.

Screenshots

Not really a screenshot, but the full stack trace I'm getting:

❯ nix-shell --show-trace
error:
       … while calling the 'derivationStrict' builtin

         at /derivation-internal.nix:9:12:

            8|
            9|   strict = derivationStrict drvAttrs;
             |            ^
           10|

       … while evaluating derivation 'nix-shell'
         whose name attribute is located at /nix/store/gzf4zwcakda1nykn6h0avh45xhjhvsz4-source/pkgs/stdenv/generic/make-derivation.nix:353:7

       … while evaluating attribute 'ANDROID_HOME' of derivation 'nix-shell'

         at /nix/store/9jmkgfy09h0xh1xxmiypvmc3a9mcmkjf-source/flake.nix:31:13:

           30|
           31|             ANDROID_HOME = "${android.androidsdk}/libexec/android-sdk";
             |             ^
           32|             JAVA_HOME = pkgs.jdk11;

       … while evaluating derivation 'androidsdk'
         whose name attribute is located at /nix/store/gzf4zwcakda1nykn6h0avh45xhjhvsz4-source/pkgs/stdenv/generic/make-derivation.nix:353:7

       … while evaluating attribute 'installPhase' of derivation 'androidsdk'

         at /nix/store/gzf4zwcakda1nykn6h0avh45xhjhvsz4-source/pkgs/development/mobile/androidenv/deploy-androidpackages.nix:84:3:

           83|
           84|   installPhase = lib.concatStrings (lib.imap0 (i: package: ''
             |   ^
           85|     cd $buildDir/extractedzip-${toString i}

       … while calling anonymous lambda

         at /nix/store/gzf4zwcakda1nykn6h0avh45xhjhvsz4-source/lib/lists.nix:155:29:

          154|   */
          155|   imap0 = f: list: genList (n: f n (elemAt list n)) (length list);
             |                             ^
          156|

       … from call site

         at /nix/store/gzf4zwcakda1nykn6h0avh45xhjhvsz4-source/lib/lists.nix:155:32:

          154|   */
          155|   imap0 = f: list: genList (n: f n (elemAt list n)) (length list);
             |                                ^
          156|

       … while calling anonymous lambda

         at /nix/store/gzf4zwcakda1nykn6h0avh45xhjhvsz4-source/pkgs/development/mobile/androidenv/deploy-androidpackages.nix:84:51:

           83|
           84|   installPhase = lib.concatStrings (lib.imap0 (i: package: ''
             |                                                   ^
           85|     cd $buildDir/extractedzip-${toString i}

       … from call site

         at /nix/store/gzf4zwcakda1nykn6h0avh45xhjhvsz4-source/pkgs/development/mobile/androidenv/cmdline-tools.nix:10:7:

            9|   patchInstructions = ''
           10|     ${lib.optionalString (os == "linux") ''
             |       ^
           11|       # Auto patch all binaries

       … while calling 'optionalString'

         at /nix/store/gzf4zwcakda1nykn6h0avh45xhjhvsz4-source/lib/strings.nix:257:5:

          256|     # String to return if condition is true
          257|     string: if cond then string else "";
             |     ^
          258|

       error: No Android SDK tarballs are available for system architecture: aarch64-darwin

Notify maintainers

Using git blame here to find this, not familiar enough with nix to figure out how to check meta.maintainers, sorry if I'm pinging the wrong people here! (Specifically, a git blame on this file/line range. If someone could mention a quick way to check this correctly, I'd greatly appreciate it!) @svanderburg @matthewbauer

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

❯ nix-shell -p nix-info --run "nix-info -m"
 - system: `"aarch64-darwin"`
 - host os: `Darwin 22.5.0, macOS 13.4.1`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.19.2`
 - channels(root): `"nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`

Add a :+1: reaction to issues you find important.

felschr commented 6 months ago

A bit unrelated, but whoever takes a look at this, would it be possible to have android-studio supported on other platforms? Right now it only supports x86_64-linux.

nixos-discourse commented 6 months ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/androidenv-android-sdk-license-cant-be-built-on-an-aarch64-darwin-machine/43714/1