Easy way to use home-manager with a newer Nix than in nixpkgs

Is there an easy way to change the version of Nix home-manager (as a flake) uses?

I’m trying to use home-manager with the nix determinate installer. The former depends on nix and uses a version of nix from nixpkgs, currently Nix 2.18.2. The latter currently installs Nix 2.20.5. I’m worried that the system will break if Nix 2.20 does something that Nix 2.18 can’t understand.

1 Like

You can set

nix.package = pkgs.nixVersions.nix_2_20;

in your home-manager config.

2 Likes

This seems to mostly work, thanks!

I used 2_19 (I haven’t updated since the determinate Installer moved to 2.20 recently), and it weirdly uses 2.19.3 instead of 2.19.4, but I expect those are compatible with each other, and things seem to work.