Skip to content

Commit

Permalink
Add profile migration test
Browse files Browse the repository at this point in the history
  • Loading branch information
edolstra committed Jan 12, 2024
1 parent 8c7e2ed commit 72560f7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/functional/nix-profile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,12 @@ nix profile install $flake2Dir --priority 0
clearProfiles
nix profile install $(nix build $flake1Dir --no-link --print-out-paths)
expect 1 nix profile install --impure --expr "(builtins.getFlake ''$flake2Dir'').packages.$system.default"

# Test upgrading from profile version 2.
clearProfiles
mkdir -p $TEST_ROOT/import-profile
outPath=$(nix build --no-link --print-out-paths $flake1Dir/flake.nix^out)
printf '{ "version": 2, "elements": [ { "active": true, "attrPath": "legacyPackages.x86_64-linux.hello", "originalUrl": "flake:nixpkgs", "outputs": null, "priority": 5, "storePaths": [ "%s" ], "url": "github:NixOS/nixpkgs/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" } ] }' "$outPath" > $TEST_ROOT/import-profile/manifest.json
nix build --profile $TEST_HOME/.nix-profile $(nix store add-path $TEST_ROOT/import-profile)
nix profile list | grep -A4 'Name:.*hello' | grep "Store paths:.*$outPath"
nix profile remove hello 2>&1 | grep 'removed 1 packages, kept 0 packages'

0 comments on commit 72560f7

Please sign in to comment.