Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android setup fails on darwin / M1 / Apple #1305

Open
clotodex opened this issue Jun 27, 2024 · 11 comments
Open

Android setup fails on darwin / M1 / Apple #1305

clotodex opened this issue Jun 27, 2024 · 11 comments
Labels
bug Something isn't working

Comments

@clotodex
Copy link
Contributor

Describe the bug
The nix install of the android sdk fails on the darwin architecture.

To reproduce
android.enable=true on a macbook with an M processor

Logs

   … from call site
     at /nix/store/mnfbbcdbbwh3iif9m9xp8jnsgys65f2g-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 «github:cachix/devenv-nixpkgs/4267e705586473d3e5c8d50299e71503f16a6fb6»/lib/strings.nix:268:5:
      267|     # String to return if condition is true
      268|     string: if cond then string else "";
         |     ^
      269|
   error:
   error: No Android SDK tarballs are available for system architecture: aarch64-darwin

Version
1.0.7 - no flakes, latest update

@clotodex clotodex added the bug Something isn't working label Jun 27, 2024
@clotodex
Copy link
Contributor Author

Is there a workaround? If you an point me somewhere I can try myself at implementing it

@domenkozar
Copy link
Member

cc @k3yss

@k3yss
Copy link
Collaborator

k3yss commented Jun 28, 2024

Hey, @clotodex it looks like a problem with the implementation of androidenv in nixpkgs. Here is a link to the discourse discussion about this issue.

@clotodex
Copy link
Contributor Author

Yeah I found that too @k3yss but I thought it was fixed in NixOS/nixpkgs#304716.
Could it be that a) it actually got fixed, but the devenv rolling does not have the fix yet or b) this does not actually fix it for some reason or c) I misunderstood the discussion in the discourd and their way to resolve it is to just blame apple and use something legacy or rosetta?

Apart from me just wanting to make it work I am also wondering how we can have devenv support it "out of the box" since otherwise you have to go deep into nix do even start solving the issue. (Hence if we identify a workaround here I am happy to build that workaround into devenv to at least support it in some way out of the box)

@clotodex
Copy link
Contributor Author

I think @k3yss it is actually not yet in devenv-rolling:
https://github.com/cachix/devenv-nixpkgs/blob/4267e705586473d3e5c8d50299e71503f16a6fb6/pkgs/development/mobile/androidenv/compose-android-packages.nix#L31

I dont understand fully how the update cycle there works but that is for another issue :D

@k3yss
Copy link
Collaborator

k3yss commented Jun 28, 2024

@clotodex I currently don't have an access to a darwin device but if you want we can debug it together on discord. What I would do to start is instead of using devenv's nixpkgs I will use nixpkgs-unstable, since we don't employ any patches for android stuff

#devenv.yaml
inputs:
  nixpkgs:
    url:  github:NixOS/nixpkgs/nixpkgs-unstable

@clotodex
Copy link
Contributor Author

Yes that would also be my plan
I also dont have direct access but a coworker can check it out next week :)

@k3yss
Copy link
Collaborator

k3yss commented Jul 29, 2024

@clotodex ping!

@clotodex
Copy link
Contributor Author

Thanks for the ping.
It is working with unstable :)
I needed to configure some darwin "systems" as well but now it is working

I can post the config in ~2 weeks if you are interested, that's when i have mac access again

@k3yss
Copy link
Collaborator

k3yss commented Jul 29, 2024

@clotodex Do you need to configure something special for running android on mac? If yes, it would be great to look at the config and maybe automate some of it.

@clotodex
Copy link
Contributor Author

clotodex commented Sep 4, 2024

Not for our minimal setup in the end (had some legacy darwin things around but removing them did not break it)
Disclaimer though: we dont have a full android setup though - just enough to make flutter work.
For reference:

  languages.dart.enable = true;
  languages.dart.package = pkgs-master.flutter;
  android = {
    systemImageTypes = [];
    abis = [];
    emulator = {
      enable = false;
    };
    sources.enable = false;
    systemImages.enable = false;
    ndk.enable = false;
    googleAPIs.enable = false;
    googleTVAddOns.enable = false;
    extras = [];
    android-studio.enable = false;
    enable = true;
    flutter.enable = true;
    flutter.package = pkgs-master.pkgs.flutter;
  };
  env.FLUTTER_ROOT = lib.mkForce pkgs-master.flutter;
  env.DART_ROOT    = lib.mkForce "${pkgs-master.flutter}/bin/cache/dart-sdk";

However I still need unstable nixpkgs - it does not run with the default devenv ones

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants