aboutsummaryrefslogtreecommitdiff
path: root/tests/restricted.sh
diff options
context:
space:
mode:
authorNaïm Favier <n@monade.li>2023-01-25 15:10:35 +0100
committerNaïm Favier <n@monade.li>2023-01-27 13:28:57 +0100
commit1cba5984a68a489c4a56691032e4c87991c678f4 (patch)
tree290590cf14d53a9d1382cd8741b4332543e15af5 /tests/restricted.sh
parentf233fd496db07212125696613ac085506e2be805 (diff)
getDefaultNixPath: actually respect `{restrict,pure}-eval`
Previously, getDefaultNixPath was called too early: at initialisation time, before CLI and config have been processed, when `restrictEval` and `pureEval` both have their default value `false`. Call it when initialising the EvalState instead, and use `setDefault`.
Diffstat (limited to 'tests/restricted.sh')
-rw-r--r--tests/restricted.sh3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/restricted.sh b/tests/restricted.sh
index 9bd16cf51..3b6ee2af1 100644
--- a/tests/restricted.sh
+++ b/tests/restricted.sh
@@ -17,6 +17,9 @@ nix-instantiate --restrict-eval --eval -E 'builtins.readDir ../src/nix-channel'
(! nix-instantiate --restrict-eval --eval -E 'let __nixPath = [ { prefix = "foo"; path = ./.; } ]; in <foo>')
nix-instantiate --restrict-eval --eval -E 'let __nixPath = [ { prefix = "foo"; path = ./.; } ]; in <foo>' -I src=.
+# no default NIX_PATH
+(unset NIX_PATH; ! nix-instantiate --restrict-eval --find-file .)
+
p=$(nix eval --raw --expr "builtins.fetchurl file://$(pwd)/restricted.sh" --impure --restrict-eval --allowed-uris "file://$(pwd)")
cmp $p restricted.sh