diff --git a/src/nix/profile.cc b/src/nix/profile.cc index 476ddcd609b..5d719fdce9f 100644 --- a/src/nix/profile.cc +++ b/src/nix/profile.cc @@ -163,6 +163,7 @@ struct ProfileManifest for (auto & drvInfo : drvInfos) { ProfileElement element; element.storePaths = {drvInfo.queryOutPath()}; + element.priority = drvInfo.queryMetaInt("priority", defaultPriority); elements.emplace_back(std::move(element)); } } diff --git a/tests/nix-profile.sh b/tests/nix-profile.sh index 7c478a0cdd1..45eeea3d77b 100644 --- a/tests/nix-profile.sh +++ b/tests/nix-profile.sh @@ -46,10 +46,12 @@ printf false > $flake1Dir/ca.nix cp ./config.nix $flake1Dir/ # Test upgrading from nix-env. -nix-env -f ./user-envs.nix -i foo-1.0 +nix-env -f ./user-envs.nix -i foo-1.0 foo-0.1 nix profile list | grep -A2 'Index:.*0' | grep 'Store paths:.*foo-1.0' +nix profile list | grep -A2 'Index:.*1' | grep 'Store paths:.*foo-0.1' nix profile install $flake1Dir -L -nix profile list | grep -A4 'Index:.*1' | grep 'Locked flake URL:.*narHash' +nix profile list | grep -A4 'Index:.*2' | grep 'Locked flake URL:.*narHash' +grep '"priority":10' $TEST_HOME/.nix-profile/manifest.json [[ $($TEST_HOME/.nix-profile/bin/hello) = "Hello World" ]] [ -e $TEST_HOME/.nix-profile/share/man ] (! [ -e $TEST_HOME/.nix-profile/include ]) @@ -60,7 +62,7 @@ nix profile diff-closures | grep 'env-manifest.nix: ε → ∅' # Test XDG Base Directories support export NIX_CONFIG="use-xdg-base-directories = true" -nix profile remove 1 +nix profile remove 1 2 nix profile install $flake1Dir [[ $($TEST_HOME/.local/state/nix/profile/bin/hello) = "Hello World" ]] unset NIX_CONFIG