1
1
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-11-20 16:40:20 +03:00
6 Upgrading Nix
Michael Hoang edited this page 2024-11-17 11:58:56 +10:00

Upgrading Nix

By default, nix-darwin will use the stable version of Nix from Nixpkgs, however if you'd like to use the latest master you can specify the nix.package option:

{
  nix.package = pkgs.nixVersions.git;
}

Environment inconsistencies

However nix-darwin doesn't touch the existing user profile where nix was installed originally so it's possible for that to take precedence in certain cases. Other tools might change PATH or a different version of nix might be installed in your user profile. If the version of nix doesn't change as expected make sure PATH in your shell matches the value of environment.systemPath and check if nix isn't installed in other places that conflict.

$ darwin-option environment.systemPath
Value:
"$HOME/.nix-profile/bin:/run/current-system/sw/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin"

$ nix doctor
Running checks against store uri: daemon
[FAIL] Multiple versions of nix found in PATH:
  /nix/store/d0hz9vb2qjzcfm1ij8y2g02yd1r4yajv-nix-2.3.7/bin
  /nix/store/dz434dmq9jbji1xvzvx63yx1ssfhbwd1-nix-2.4pre20201031_2f3d023/bin

[PASS] All profiles are gcroots.
[PASS] Client protocol matches store protocol.

In this case you might need to remove the current nix package or make sure whatever changes PATH is disabled.

$ nix-env -e nix