2016-04-14 16:24:06 +03:00
|
|
|
source common.sh
|
|
|
|
|
|
|
|
clearStore
|
|
|
|
|
2017-11-20 18:50:49 +02:00
|
|
|
nix-instantiate --restrict-eval --eval -E '1 + 2'
|
2018-01-16 19:50:38 +02:00
|
|
|
(! nix-instantiate --restrict-eval ./restricted.nix)
|
|
|
|
(! nix-instantiate --eval --restrict-eval <(echo '1 + 2'))
|
2017-11-20 18:50:49 +02:00
|
|
|
nix-instantiate --restrict-eval ./simple.nix -I src=.
|
|
|
|
nix-instantiate --restrict-eval ./simple.nix -I src1=simple.nix -I src2=config.nix -I src3=./simple.builder.sh
|
2016-04-14 16:24:06 +03:00
|
|
|
|
2017-11-20 18:50:49 +02:00
|
|
|
(! nix-instantiate --restrict-eval --eval -E 'builtins.readFile ./simple.nix')
|
|
|
|
nix-instantiate --restrict-eval --eval -E 'builtins.readFile ./simple.nix' -I src=..
|
2016-04-14 16:24:06 +03:00
|
|
|
|
2018-03-14 20:01:22 +02:00
|
|
|
(! nix-instantiate --restrict-eval --eval -E 'builtins.readDir ../src/nix-channel')
|
|
|
|
nix-instantiate --restrict-eval --eval -E 'builtins.readDir ../src/nix-channel' -I src=../src
|
2016-04-14 16:24:06 +03:00
|
|
|
|
2017-11-20 18:50:49 +02:00
|
|
|
(! 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=.
|
2016-04-14 16:24:06 +03:00
|
|
|
|
2017-10-30 13:39:59 +02:00
|
|
|
p=$(nix eval --raw "(builtins.fetchurl file://$(pwd)/restricted.sh)" --restrict-eval --allowed-uris "file://$(pwd)")
|
|
|
|
cmp $p restricted.sh
|
|
|
|
|
|
|
|
(! nix eval --raw "(builtins.fetchurl file://$(pwd)/restricted.sh)" --restrict-eval)
|
|
|
|
|
|
|
|
(! nix eval --raw "(builtins.fetchurl file://$(pwd)/restricted.sh)" --restrict-eval --allowed-uris "file://$(pwd)/restricted.sh/")
|
|
|
|
|
|
|
|
nix eval --raw "(builtins.fetchurl file://$(pwd)/restricted.sh)" --restrict-eval --allowed-uris "file://$(pwd)/restricted.sh"
|
|
|
|
|
|
|
|
(! nix eval --raw "(builtins.fetchurl https://github.com/NixOS/patchelf/archive/master.tar.gz)" --restrict-eval)
|
|
|
|
(! nix eval --raw "(builtins.fetchTarball https://github.com/NixOS/patchelf/archive/master.tar.gz)" --restrict-eval)
|
|
|
|
(! nix eval --raw "(fetchGit git://github.com/NixOS/patchelf.git)" --restrict-eval)
|
2018-01-16 19:50:38 +02:00
|
|
|
|
|
|
|
ln -sfn $(pwd)/restricted.nix $TEST_ROOT/restricted.nix
|
|
|
|
[[ $(nix-instantiate --eval $TEST_ROOT/restricted.nix) == 3 ]]
|
|
|
|
(! nix-instantiate --eval --restrict-eval $TEST_ROOT/restricted.nix)
|
|
|
|
(! nix-instantiate --eval --restrict-eval $TEST_ROOT/restricted.nix -I $TEST_ROOT)
|
|
|
|
(! nix-instantiate --eval --restrict-eval $TEST_ROOT/restricted.nix -I .)
|
|
|
|
nix-instantiate --eval --restrict-eval $TEST_ROOT/restricted.nix -I $TEST_ROOT -I .
|
2018-02-06 16:38:45 +02:00
|
|
|
|
|
|
|
[[ $(nix eval --raw --restrict-eval -I . '(builtins.readFile "${import ./simple.nix}/hello")') == 'Hello World!' ]]
|