Where can I get a statically built nix?

If you already read my last post, you might want to read it again, I overhauled it with a fully working solution now!

I don’t know for how long cache.nixos.org retains artifacts, but AFAIK, especially the revisions that are publicly released are kept for a long time. If you take a look at releases.nixos.org, you can see the retained releases go all the way back to 2013. The page I linked is for one such branch, you can see that it says “nixos:release-23.05”, so everything in here will be retained for years to come. You might also be interested in this post that gives a breakdown of how many hundreds of terrabytes the cache contains.

If you want to be extra sure, you can go to the latest nixos release (currently nixos-23.05.997.ddf4688dc7a), download the store-paths.xz file, and search for the path there:

$ wget https://releases.nixos.org/nixos/23.05/nixos-23.05.997.ddf4688dc7a/store-paths.xz
$ xzcat store-paths.xz | grep nix-static
/nix/store/fri13aiy40j6smf1d1dsndwbc3178xvc-nix-static-x86_64-unknown-linux-musl-2.13.3
/nix/store/ilvh2g7gskjvvbm16gwwblf279h7lby4-nix-static-x86_64-unknown-linux-musl-2.13.3-dev

You can now use the hash of the path not ending in -dev when downloading the narinfo:

$ curl https://cache.nixos.org/fri13aiy40j6smf1d1dsndwbc3178xvc.narinfo
StorePath: /nix/store/fri13aiy40j6smf1d1dsndwbc3178xvc-nix-static-x86_64-unknown-linux-musl-2.13.3
URL: nar/00iic1w1zq5amx1iz75k4k8qihh4jz40635xnnqsghkiwadpypnr.nar.xz
[...]

In the TL;DR above, I already inserted that URL to be on the safe side :slight_smile: