diff options
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/fixtures.sh | 11 | ||||
| -rw-r--r-- | tests/scenarios.nix | 11 |
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/fixtures.sh b/tests/fixtures.sh index 8222b13..1f6c478 100755 --- a/tests/fixtures.sh +++ b/tests/fixtures.sh @@ -233,6 +233,17 @@ cat > /fixtures/c2/flake.nix <<'NIX' { outputs = _: { who = "c2"; }; } NIX +# usedata, data: a flake with an input that isn't a flake, and a directory +# to draw it from. +mkdir /fixtures/usedata /fixtures/data +cat > /fixtures/usedata/flake.nix <<'NIX' +{ + inputs.data = { url = "path:/nonexistent"; flake = false; }; + outputs = { data, ... }: { msg = "data:${builtins.readFile (data + "/value")}"; }; +} +NIX +printf hello > /fixtures/data/value + # 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 5dd44db..eeeb665 100644 --- a/tests/scenarios.nix +++ b/tests/scenarios.nix @@ -883,6 +883,17 @@ assert !(krops.isLocalTarget (targets.remote "/")); ''; }; }) + (s "nonflake-input" { + phases = twice { + sources = { + x.file = { path = "/fixtures/usedata"; inputs.data.follows = "data"; }; + data.file = "/fixtures/data"; + }; + check = '' + expect_eq msg "$(nix_eval "$T"/.populate/flakes/x#msg)" data:hello + ''; + }; + }) ] ++ lib.optional (targetKind == "local") # The target has the path the input is locked to. (s "uselocal" { |
