@@ -2,6 +2,12 @@ source common.sh
2
2
3
3
clearStore
4
4
5
+ if [[ -n ${CONTENT_ADDRESSED:- } ]]; then
6
+ nix-shell () {
7
+ command nix-shell --arg contentAddressed true " $@ "
8
+ }
9
+ fi
10
+
5
11
# Test nix-shell -A
6
12
export IMPURE_VAR=foo
7
13
export SELECTED_IMPURE_VAR=baz
@@ -41,15 +47,15 @@ output=$(NIX_PATH=nixpkgs=shell.nix nix-shell --pure -p foo bar --run 'echo "$(f
41
47
[ " $output " = " foo bar" ]
42
48
43
49
# Test nix-shell shebang mode
44
- sed -e " s|@ENV_PROG@|$( type -p env) |" shell.shebang.sh > $TEST_ROOT /shell.shebang.sh
50
+ sed -e " s|@ENV_PROG@|$( type -P env) |" shell.shebang.sh > $TEST_ROOT /shell.shebang.sh
45
51
chmod a+rx $TEST_ROOT /shell.shebang.sh
46
52
47
53
output=$( $TEST_ROOT /shell.shebang.sh abc def)
48
54
[ " $output " = " foo bar abc def" ]
49
55
50
56
# Test nix-shell shebang mode again with metacharacters in the filename.
51
57
# First word of filename is chosen to not match any file in the test root.
52
- sed -e " s|@ENV_PROG@|$( type -p env) |" shell.shebang.sh > $TEST_ROOT /spaced\ \\\'\" shell.shebang.sh
58
+ sed -e " s|@ENV_PROG@|$( type -P env) |" shell.shebang.sh > $TEST_ROOT /spaced\ \\\'\" shell.shebang.sh
53
59
chmod a+rx $TEST_ROOT /spaced\ \\\'\" shell.shebang.sh
54
60
55
61
output=$( $TEST_ROOT /spaced\ \\\'\" shell.shebang.sh abc def)
@@ -58,15 +64,15 @@ output=$($TEST_ROOT/spaced\ \\\'\"shell.shebang.sh abc def)
58
64
# Test nix-shell shebang mode for ruby
59
65
# This uses a fake interpreter that returns the arguments passed
60
66
# This, in turn, verifies the `rc` script is valid and the `load()` script (given using `-e`) is as expected.
61
- sed -e " s|@SHELL_PROG@|$( type -p nix-shell) |" shell.shebang.rb > $TEST_ROOT /shell.shebang.rb
67
+ sed -e " s|@SHELL_PROG@|$( type -P nix-shell) |" shell.shebang.rb > $TEST_ROOT /shell.shebang.rb
62
68
chmod a+rx $TEST_ROOT /shell.shebang.rb
63
69
64
70
output=$( $TEST_ROOT /shell.shebang.rb abc ruby)
65
71
[ " $output " = ' -e load(ARGV.shift) -- ' " $TEST_ROOT " ' /shell.shebang.rb abc ruby' ]
66
72
67
73
# Test nix-shell shebang mode for ruby again with metacharacters in the filename.
68
74
# Note: fake interpreter only space-separates args without adding escapes to its output.
69
- sed -e " s|@SHELL_PROG@|$( type -p nix-shell) |" shell.shebang.rb > $TEST_ROOT /spaced\ \\\'\" shell.shebang.rb
75
+ sed -e " s|@SHELL_PROG@|$( type -P nix-shell) |" shell.shebang.rb > $TEST_ROOT /spaced\ \\\'\" shell.shebang.rb
70
76
chmod a+rx $TEST_ROOT /spaced\ \\\'\" shell.shebang.rb
71
77
72
78
output=$( $TEST_ROOT /spaced\ \\\'\" shell.shebang.rb abc ruby)
0 commit comments