aboutsummaryrefslogtreecommitdiff
path: root/tests/nix-shell.sh
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2019-10-27 09:34:33 +0100
committerRobert Hensing <robert@roberthensing.nl>2019-10-27 13:16:02 +0100
commit9d612c393abc3a73590650d24bcfe2ee57792872 (patch)
tree96f512ba950c0b00da9e96c6dd832aeac7d43499 /tests/nix-shell.sh
parent2f96a89646c6e55e2f1bbb80805dcbbe60fa94ae (diff)
Add inNixShell = true to nix-shell auto-call
This is an alternative to the IN_NIX_SHELL environment variable, allowing the expression to adapt itself to nix-shell without triggering those adaptations when used as a dependency of another shell. Closes #3147
Diffstat (limited to 'tests/nix-shell.sh')
-rw-r--r--tests/nix-shell.sh8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/nix-shell.sh b/tests/nix-shell.sh
index ee502dddb..235e2a5ff 100644
--- a/tests/nix-shell.sh
+++ b/tests/nix-shell.sh
@@ -7,9 +7,9 @@ export IMPURE_VAR=foo
export SELECTED_IMPURE_VAR=baz
export NIX_BUILD_SHELL=$SHELL
output=$(nix-shell --pure shell.nix -A shellDrv --run \
- 'echo "$IMPURE_VAR - $VAR_FROM_STDENV_SETUP - $VAR_FROM_NIX"')
+ 'echo "$IMPURE_VAR - $VAR_FROM_STDENV_SETUP - $VAR_FROM_NIX - $TEST_inNixShell"')
-[ "$output" = " - foo - bar" ]
+[ "$output" = " - foo - bar - true" ]
# Test --keep
output=$(nix-shell --pure --keep SELECTED_IMPURE_VAR shell.nix -A shellDrv --run \
@@ -19,10 +19,10 @@ output=$(nix-shell --pure --keep SELECTED_IMPURE_VAR shell.nix -A shellDrv --run
# Test nix-shell on a .drv
[[ $(nix-shell --pure $(nix-instantiate shell.nix -A shellDrv) --run \
- 'echo "$IMPURE_VAR - $VAR_FROM_STDENV_SETUP - $VAR_FROM_NIX"') = " - foo - bar" ]]
+ 'echo "$IMPURE_VAR - $VAR_FROM_STDENV_SETUP - $VAR_FROM_NIX - $TEST_inNixShell"') = " - foo - bar - false" ]]
[[ $(nix-shell --pure $(nix-instantiate shell.nix -A shellDrv) --run \
- 'echo "$IMPURE_VAR - $VAR_FROM_STDENV_SETUP - $VAR_FROM_NIX"') = " - foo - bar" ]]
+ 'echo "$IMPURE_VAR - $VAR_FROM_STDENV_SETUP - $VAR_FROM_NIX - $TEST_inNixShell"') = " - foo - bar - false" ]]
# Test nix-shell on a .drv symlink