diff options
| -rwxr-xr-x | tests/fixtures.sh | 6 | ||||
| -rw-r--r-- | tests/scenarios.nix | 22 |
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/fixtures.sh b/tests/fixtures.sh index 1b39b45..833df77 100755 --- a/tests/fixtures.sh +++ b/tests/fixtures.sh @@ -252,6 +252,12 @@ SH chmod +x /fixtures/pipe2 echo piped > /fixtures/pipe2-data +# alt2: like alt, with other outputs, to change a source to. +mkdir /fixtures/alt2 +cat > /fixtures/alt2/flake.nix <<'NIX' +{ outputs = _: { greeting = "alt2"; who = "alt2"; }; } +NIX + # noflake: a directory without flake.nix. mkdir /fixtures/noflake echo noflake > /fixtures/noflake/README diff --git a/tests/scenarios.nix b/tests/scenarios.nix index eb6bbec..e56cb13 100644 --- a/tests/scenarios.nix +++ b/tests/scenarios.nix @@ -358,6 +358,8 @@ assert !(krops.isLocalTarget (targets.remote "/")); } test -e "$T"/x/two || fail "two missing" '' + optionalString flags.inputs '' + grep -q '"git+file:' "$T"/.populate/flakes/x/flake.nix || + fail "the Git work tree isn't referred to as git+file:" gc expect_eq msg "$(nix_eval "$T"/.populate/flakes/x#msg)" git:alt ''; @@ -559,6 +561,26 @@ assert !(krops.isLocalTarget (targets.remote "/")); ''; }; }) + # A generated flake gets locked again when a source it draws from + # changes. + (s "relock" (let + x.file = { path = "/fixtures/filesrc"; inputs.dep.follows = "a"; }; + in { + phases = [ + { + sources = { inherit x; a.file = "/fixtures/alt"; }; + check = '' + expect_eq msg "$(nix_eval_online "$T"/.populate/flakes/x#msg)" top:alt,sub + ''; + } + { + sources = { inherit x; a.file = "/fixtures/alt2"; }; + check = '' + expect_eq msg "$(nix_eval_online "$T"/.populate/flakes/x#msg)" top:alt2,sub + ''; + } + ]; + })) # A generated flake gets removed once its source draws no inputs anymore. (s "removal" { phases = [ |
