According to its documentation, the command
nix upgrade-nix should upgrade Nix to the latest stable version. Executing this command in Nix 2.3.14 upgrades it to 2.4. According to NixOS - Getting Nix / NixOS the ‘current’ version is 2.6. ‘Current’ suggests stable, at least to me, so I’m a little disappointed that I didn’t get Nix 2.6.
nix upgrade-nix in Nix 2.4 doesn’t advance beyond 2.4.)
Is there a way to upgrade this Nix installation to 2.6 without uninstalling Nix from this machine and installing it from scratch?
If you’re not on NixOS,
nix-env -iA nixpkgs.nix_2_6 should do the trick. On NixOS, you probably want to change nix.package to the same.
Thanks, that works.
Though it does suffer from the same absence of Nix 2.6 in
nixpkgs 21.11 as I described here.
I’m also trying to revive nix on one of my machines since I would like to use flakes and I have the same issue.
If I run
nix-env -iA nixpkgs.nix_2_6
I get an error related to priority of some zsh packages:
error: packages '/nix/store/yhlvl68wib72an3izyqksmazrmhqpv5k-home-manager-path/share/zsh/site-functions/_nix' and '/nix/store/2h11cp3c9x1skq3vk3zx8m58h60aaw8h-nix-2.4/share/zsh/site-functions/_nix' have the same priority 5; use 'nix-env --set-flag priority NUMBER INSTALL
ED_PKGNAME' to change the priority of one of the conflicting packages (0 being the highest priority)
builder for '/nix/store/s0y6zwqnjrl9ppsjmfq97y3iybqswnap-user-environment.drv' failed with exit code 1
error: build of '/nix/store/s0y6zwqnjrl9ppsjmfq97y3iybqswnap-user-environment.drv' failed
Couldn’t figure out what the actual package name to use in the suggested command and how to check current priority to decide what to set the new one to.
Looks like you’re using an ancient version of home manager that isn’t pinned to use the same version of nixpkgs as the rest of your system? Could you share your relevant config, where you’re trying to upgrade and how home manager is configured?
that is possible.
I’m just not confident with what I’m doing and on this particular machine I’ve messed around a long time ago so I’ve lost track of things.
But I think this can be a good lead for me to start investigating. Will let you know if I manage to retake control on things