Androidenv-android-sdk-license can't be built on an aarch64-darwin machine

I have a bunch of co-workers who are doing android development on M1 and M2 macs. Recently we added the Android SDK to our Nix environment.

As of today, one developer is not able to get a working Nix environment. The others are unable to reproduce the problem. The exact text of the error we are seeing is this:

error: a 'x86_64-darwin' with features {} is required to build '/nix/store/0ppzyz4i1k7fcjx7l0zb2410yc086gn3-androidenv-android-sdk-license.drv', but I am a 'aarch64-darwin' with features {apple-virt, benchmark, big-parallel, nixos-test}

So, the closest thing that I’ve found in the github issues is compose-android-packages does not support aarch64-darwin (or any arm systems?) · Issue #303968 · NixOS/nixpkgs, which seems odd given that we have had Android developers on Mac for a long time (though, maybe, Rosetta is muddying up the waters?). To me, it looks like somehow Nix isn’t detecting the platform correctly. or there used to be something present that was representing the aarch64-darwin system as an x86_64-darwin system.

There’s no trace available.

We’ve tried uninstalling and reinstalling Nix on her machine. We’ve also tried re-cloning the entire project repository. We keep getting stuck at this point, and we don’t want to go to the level of a complete system rebuild.

Here’s the output from nix-info:

these 2 paths will be fetched (0.01 MiB download, 0.11 MiB unpacked):
copying path '/nix/store/slh7g2ahqxc969cizlbva4w4yad53fyy-DarwinTools-1' from ''...
copying path '/nix/store/kxniwccp3ymygfbzx33gwbyp9823saw0-nix-info' from ''...
 - system: `"aarch64-darwin"`
 - host os: `Darwin 23.4.0, macOS 14.4.1`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.21.2`
 - nixpkgs: `/nix/store/3vysbx7v008h7473gwfmv6lzqfzsn3q7-source`

So, what can I do to help get her unblocked, given that this has completely halted her ability to work?

No specific knowledge here myself, but is there a difference between extra-platforms in /etc/nix/nix.conf on the working systems and the affected one?

I think this may have been fixed by

1 Like

Do you happen to know how long it was broken?

Not that we’ve been able to identify. :frowning: We’ve even, in some cases, copied the /etc/nix/nix.conf over.

It looks like the target-checking code predates Apple silicon, judging by Replace androidenv by new implementation · NixOS/nixpkgs@74750dc · GitHub, which is from December 2018.

Yeah, unfortunately I don’t think this is the same problem.

I’ve actually advised her to install our legacy toolchains to do her work. We will return to this in a week when the person who built our flakes has returned.

In the end.
Blame Apple.

Somehow, someway, her Rosetta installation got messed up. Nix was, quite accurately, saying “hey, I can’t run x86_64-darwin executables.”

We spent many hours trying to fix this.

Again, blame Apple.