Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nix-env to nix profile: maintain priorities #8956

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/nix/profile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
Expand Down
8 changes: 5 additions & 3 deletions tests/nix-profile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ])
Expand All @@ -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
Expand Down
Loading