diff options
author | Maximilian Bosch <maximilian@mbosch.me> | 2024-05-04 08:52:29 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@lix> | 2024-05-04 08:52:29 +0000 |
commit | 799d0132f0797f59cda8c66cde968aba8c3486c3 (patch) | |
tree | 804ea4829bb1798a644e3199d27a65dea6b80769 /tests | |
parent | 79d0ae667066b758fd4202cd18294a0f40ddc8f0 (diff) | |
parent | 0e38720502c10ddba4afb8c49532b69be83e23a7 (diff) |
Merge "Revert "Revert "Merge pull request #6621 from Kha/nested-follows""" into main
Diffstat (limited to 'tests')
-rw-r--r-- | tests/functional/flakes/follow-paths.sh | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/functional/flakes/follow-paths.sh b/tests/functional/flakes/follow-paths.sh index 183893bde..cd3f75693 100644 --- a/tests/functional/flakes/follow-paths.sh +++ b/tests/functional/flakes/follow-paths.sh @@ -230,3 +230,63 @@ git -C "$flakeFollowsOverloadA" add flake.nix flakeB/flake.nix \ nix flake metadata "$flakeFollowsOverloadA" nix flake update --flake "$flakeFollowsOverloadA" nix flake lock "$flakeFollowsOverloadA" + +# Test nested flake overrides: A overrides B/C/D + +cat <<EOF > $flakeFollowsD/flake.nix +{ outputs = _: {}; } +EOF +cat <<EOF > $flakeFollowsC/flake.nix +{ + inputs.D.url = "path:nosuchflake"; + outputs = _: {}; +} +EOF +cat <<EOF > $flakeFollowsB/flake.nix +{ + inputs.C.url = "path:$flakeFollowsC"; + outputs = _: {}; +} +EOF +cat <<EOF > $flakeFollowsA/flake.nix +{ + inputs.B.url = "path:$flakeFollowsB"; + inputs.D.url = "path:$flakeFollowsD"; + inputs.B.inputs.C.inputs.D.follows = "D"; + outputs = _: {}; +} +EOF + +nix flake lock $flakeFollowsA + +[[ $(jq -c .nodes.C.inputs.D $flakeFollowsA/flake.lock) = '["D"]' ]] + +# Test overlapping flake follows: B has D follow C/D, while A has B/C follow C + +cat <<EOF > $flakeFollowsC/flake.nix +{ + inputs.D.url = "path:$flakeFollowsD"; + outputs = _: {}; +} +EOF +cat <<EOF > $flakeFollowsB/flake.nix +{ + inputs.C.url = "path:nosuchflake"; + inputs.D.url = "path:nosuchflake"; + inputs.D.follows = "C/D"; + outputs = _: {}; +} +EOF +cat <<EOF > $flakeFollowsA/flake.nix +{ + inputs.B.url = "path:$flakeFollowsB"; + inputs.C.url = "path:$flakeFollowsC"; + inputs.B.inputs.C.follows = "C"; + outputs = _: {}; +} +EOF + +# bug was not triggered without recreating the lockfile +nix flake update --flake $flakeFollowsA + +[[ $(jq -c .nodes.B.inputs.D $flakeFollowsA/flake.lock) = '["B","C","D"]' ]] |