Is there a quick (ideally single command) to get the name, url and sha256 properties for fetchTarball for latest unstable nixpkgs? I’ve come up with the following horrible hack:
Click the shortened commit ID near the top of the page
Copy the full commit ID near the top right of the page, for example “2da64a81275b68fdad38af669afeda43d401e94b”
Switch back to the IDE
Replace the checksum part of the url
Google the commit ID to find the name (This part is obviously not reliable, but I’ve no idea where else to get the “preNUMBER” part of the name. Also, I know the name just has to be unique, but using the release name seems like an obvious way to make sure it’s easily understood.)
Switch back to the IDE
Replace the name
Run nix-shell or other command to … instantiate the … derivation? Frobnicate the doohickey?
Wait for it to report the hash mismatch
Switch back to the IDE
Replace the checksum with the one from the got: line
Run the command I was trying to run in the first place
The result, for current unstable, is:
name = "nixos-22.11pre405560.2da64a81275";
url = "https://github.com/NixOS/nixpkgs/archive/2da64a81275b68fdad38af669afeda43d401e94b.tar.gz";
sha256 = "1k71lmzdaa48yqkmsnd22n177qmxxi4gj2qcmdbv0mc6l4f27wd0";
But that is a lot of steps. I guess adding the unstable channel would help, but I don’t really want to risk getting any software from unstable at the moment.
I don’t understand this comment. You’d get the same effect on packages by adding the channel (under some name) and using nix-channel to manage it. Of course, the commit (now and past ones) would not be encoded in your fetchurl, instead you’d have it in the state of /nix/var/nix/profiles/...
Still, I expect most people will nowadays prefer flakes, as mentioned above (or other tools).
I’d rather not rely on experimental features. Maybe it’s dumb, but I’m trying to create as stable a setup as possible, since I’m relying on Nix in a whole bunch of repos by now.
The problem with trying anything new in Nix is that the blockers I’ve run into are incredibly obtuse: GLIBC mismatches, poetry2nix breakages, infinite recursion, why pkgs.python3.withPackages(…) is not the same data structure as pkgs.python3, and more I can’t remember. Learning to deal with a whole new class of blockers using flakes/niv/mach-nix/home-manager/etc is just not attractive, because I don’t expect them to be more stable than the rest of Nix. When Nix works it’s fantastic, but it’s really hard to go beyond the trivial stuff.