aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-04-03 13:07:05 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-04-03 13:07:05 +0200
commit9c78f7f196454228e378d19e4686526214e61bc7 (patch)
treefee29baa71bddadac13a75c0d14465a0b587e581 /tests
parentbb39f2bb8a835696986ac01416a73fe11cb0b0ba (diff)
getFlake: In pure mode, check that the argument is an immutable flakeref
Diffstat (limited to 'tests')
-rw-r--r--tests/flakes.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/flakes.sh b/tests/flakes.sh
index 43dbc95e8..050dbf127 100644
--- a/tests/flakes.sh
+++ b/tests/flakes.sh
@@ -194,6 +194,13 @@ nix build -o $TEST_ROOT/result git+file://$flake1Dir
nix build -o $flake1Dir/result git+file://$flake1Dir
nix path-info $flake1Dir/result
+# 'getFlake' on a mutable flakeref should fail in pure mode, but succeed in impure mode.
+(! nix build -o $TEST_ROOT/result --expr "(builtins.getFlake \"$flake1Dir\").defaultPackage.$system")
+nix build -o $TEST_ROOT/result --expr "(builtins.getFlake \"$flake1Dir\").defaultPackage.$system" --impure
+
+# 'getFlake' on an immutable flakeref should succeed even in pure mode.
+nix build -o $TEST_ROOT/result --expr "(builtins.getFlake \"git+file://$flake1Dir?rev=$hash2\").defaultPackage.$system"
+
# Building a flake with an unlocked dependency should fail in pure mode.
(! nix build -o $TEST_ROOT/result flake2#bar --no-registries)
(! nix eval --expr "builtins.getFlake \"$flake2Dir\"")