diff options
author | Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com> | 2023-10-31 16:19:05 +0100 |
---|---|---|
committer | Lunaphied <lunaphied@lunaphied.me> | 2024-03-25 17:36:24 -0600 |
commit | 86881226b0e51c204f07385b7b57743c23e34d44 (patch) | |
tree | 737e75ee7cc6ec8932b850ff6f20adfc4e285628 /tests/functional/flakes | |
parent | aa7653608d4d0028bb98af491aec76b2fea7f882 (diff) |
Merge pull request #8817 from iFreilicht/flake-update-lock-overhaul
Overhaul `nix flake update` and `nix flake lock` UX
(cherry picked from commit 12a0ae73dbb37becefa5a442eb4532ff0de9ce65)
Change-Id: Iff3b4f4235ebb1948ec612036b39ab29e4ca22b2
Diffstat (limited to 'tests/functional/flakes')
-rw-r--r-- | tests/functional/flakes/circular.sh | 3 | ||||
-rw-r--r-- | tests/functional/flakes/flakes.sh | 16 | ||||
-rw-r--r-- | tests/functional/flakes/follow-paths.sh | 4 |
3 files changed, 12 insertions, 11 deletions
diff --git a/tests/functional/flakes/circular.sh b/tests/functional/flakes/circular.sh index 09cd02edf..d3bb8e8a3 100644 --- a/tests/functional/flakes/circular.sh +++ b/tests/functional/flakes/circular.sh @@ -42,7 +42,8 @@ git -C $flakeB commit -a -m 'Foo' sed -i $flakeB/flake.nix -e 's/456/789/' git -C $flakeB commit -a -m 'Foo' -[[ $(nix eval --update-input b $flakeA#foo) = 1912 ]] +nix flake update b --flake $flakeA +[[ $(nix eval $flakeA#foo) = 1912 ]] # Test list-inputs with circular dependencies nix flake metadata $flakeA diff --git a/tests/functional/flakes/flakes.sh b/tests/functional/flakes/flakes.sh index 7781eb51b..dfa088960 100644 --- a/tests/functional/flakes/flakes.sh +++ b/tests/functional/flakes/flakes.sh @@ -302,8 +302,8 @@ nix build -o $TEST_ROOT/result flake4#xyzzy nix flake lock $flake3Dir [[ -z $(git -C $flake3Dir diff master || echo failed) ]] -nix flake update $flake3Dir --override-flake flake2 nixpkgs -[[ ! -z $(git -C $flake3Dir diff master || echo failed) ]] +nix flake update --flake "$flake3Dir" --override-flake flake2 nixpkgs +[[ ! -z $(git -C "$flake3Dir" diff master || echo failed) ]] # Make branch "removeXyzzy" where flake3 doesn't have xyzzy anymore git -C $flake3Dir checkout -b removeXyzzy @@ -439,9 +439,9 @@ cat > $flake3Dir/flake.nix <<EOF } EOF -nix flake update $flake3Dir -[[ $(jq -c .nodes.flake2.inputs.flake1 $flake3Dir/flake.lock) =~ '["foo"]' ]] -[[ $(jq .nodes.foo.locked.url $flake3Dir/flake.lock) =~ flake7 ]] +nix flake update --flake "$flake3Dir" +[[ $(jq -c .nodes.flake2.inputs.flake1 "$flake3Dir/flake.lock") =~ '["foo"]' ]] +[[ $(jq .nodes.foo.locked.url "$flake3Dir/flake.lock") =~ flake7 ]] # Test git+file with bare repo. rm -rf $flakeGitBare @@ -478,12 +478,12 @@ nix flake lock $flake3Dir --override-input flake2/flake1 flake1 nix flake lock $flake3Dir --override-input flake2/flake1 flake1/master/$hash1 [[ $(jq -r .nodes.flake1_2.locked.rev $flake3Dir/flake.lock) =~ $hash1 ]] -# Test --update-input. nix flake lock $flake3Dir [[ $(jq -r .nodes.flake1_2.locked.rev $flake3Dir/flake.lock) = $hash1 ]] -nix flake lock $flake3Dir --update-input flake2/flake1 -[[ $(jq -r .nodes.flake1_2.locked.rev $flake3Dir/flake.lock) =~ $hash2 ]] +# Test updating an individual input of a flake lockfile. +nix flake update flake2/flake1 --flake "$flake3Dir" +[[ $(jq -r .nodes.flake1_2.locked.rev "$flake3Dir/flake.lock") =~ $hash2 ]] # Test 'nix flake metadata --json'. nix flake metadata $flake3Dir --json | jq . diff --git a/tests/functional/flakes/follow-paths.sh b/tests/functional/flakes/follow-paths.sh index dc97027ac..efc5f95d8 100644 --- a/tests/functional/flakes/follow-paths.sh +++ b/tests/functional/flakes/follow-paths.sh @@ -77,7 +77,7 @@ git -C $flakeFollowsA add flake.nix flakeB/flake.nix \ nix flake metadata $flakeFollowsA -nix flake update $flakeFollowsA +nix flake update --flake $flakeFollowsA nix flake lock $flakeFollowsA @@ -228,5 +228,5 @@ git -C "$flakeFollowsOverloadA" add flake.nix flakeB/flake.nix \ flakeB/flakeC/flake.nix flakeB/flakeC/flakeD/flake.nix nix flake metadata "$flakeFollowsOverloadA" -nix flake update "$flakeFollowsOverloadA" +nix flake update --flake "$flakeFollowsOverloadA" nix flake lock "$flakeFollowsOverloadA" |