Correct way to update nix these days

Hello - the instructions for updating nix (just the package manager, on a non-nixos machine) are shown here:
however before I go ahead and do this I’d like to check that this is still valid - the machine I’m working on currently has nix 2.10 and I’m more used to using nix profile and registries than nix-env with channels. I also need to get a fairly recent commit of the nix master branch (80c9259756811c1165167db1bb66c1fef0accb65) - would the existing instructions just get the most recent commit of master?

Thanks for any help.

If you exclusively use profiles your channels are likely outdated, you might still be on an old stable nixpkgs or such. You’d need to check with the nix-channel commands to confirm what you’re installing. Grabbing a specific commit is a bit hard too.

Alternatively if you use the 2.0 commands anyway you can install nix with nix profile install nixpkgs/80c9259756811c1165167db1bb66c1fef0accb65#nix.

Note that this will break nix profile update, to make it work again in the future just use nix profile install nixpkgs#nix to switch back to a branch that can be updated from.

These instructions aren’t on that page because nix 2.0 is still unstable, unfortunately, despite these obvious usability advantages…

1 Like

Thank you, yes, that works great, actually.