Hash mismatch in android sdk

I have a shell.nix that I’ve been using for android dev (really appreciate the effort that went into Nixpkgs Reference Manual BTW), and it worked until I upgraded my 24.11 install the other day(via nix-channel --update). Now it says (among other things):

error: hash mismatch in fixed-output derivation ‘/nix/store/gkwfv2811c8qkr744pjxy7al9vhsnm78-arm64-v8a-29_r13.zip.drv’:
specified: sha1-XvSIjOR6JKnpbkVBj5/SbxyODxM=
got: sha1-+Wse5nfxvS3c/wuTSF6cZdsuYWA=

so I have questions:

  1. doing nixchannel --update && nixos-rebuild switch without changing my nixos/configuration.nix shouldn’t break anything, correct? Because that’s all I did.
  2. Why is it trying to build anything anyway? I’m on an x86 box, the binaries should all be genericish… what’s to build?
  3. a large part of the annoyance with the breakage is that it tries to re-download something like 34GB whenever I tweak the shell.nix. Is there a way to tell nixos to keep those archives cached locally somewhere? I’ve got plenty of disk.

FWIW, the error I’m seeing looks like:

error: hash mismatch in fixed-output derivation '/nix/store/gkwfv2811c8qkr744pjxy7al9vhsnm78-arm64-v8a-29_r13.zip.drv':
         specified: sha1-XvSIjOR6JKnpbkVBj5/SbxyODxM=
            got:    sha1-+Wse5nfxvS3c/wuTSF6cZdsuYWA=
error: 1 dependencies of derivation '/nix/store/v3hjm36rhlvhgc018mq94w01nd8zvddy-android-sdk-system-image-29-google_apis-arm64-v8a-system-image-29-google_apis-x86-system-image-29-google_apis-x86_64-29-google_apis-arm64-v8a-29-google_apis-x86-29-google_apis-x86_64.drv' failed to build
error: 1 dependencies of derivation '/nix/store/hb0z9v0p3kb9v5g5hp7sba1lr6vkcm0f-androidsdk.drv' failed to build

Though I’m realizing this is in 24.11, and 25.05 comes out today… what’re the odds this will get fixed? or is it something on my side?

I’ve forwarded this to @numinit who is on the Android team in nixpkgs.

1 Like

Did you check with 25.05?

It’s fetching a generic android system image for emulation presumably.

nix-direnv (when you use the NixOS module) will create a gcroot and prevent your shell from getting gc’d, assuming that’s the cause. Though if the image gets updated or some other deps change, they will get downloaded again if you don’t have your shell pinned explicitly to a specific nixpkgs revision.

Sorry, just getting back to my notifications after doing another round of androidenv updates. Give 25.05 or unstable a shot, we have improved automation for automatically fixing these problems as of then.

25.05 does seem to have fixed it, thanks!

1 Like