diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2019-10-27 17:10:19 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2019-10-27 17:10:19 +0100 |
commit | 0e459d79a6b4f51088c2e3e5cb77e21a113322c9 (patch) | |
tree | cac57adde7a215db055ed52e32f085e4a1ae462a /tests | |
parent | e012384fe99bd7d229fffa78f890d3ede915709b (diff) | |
parent | 9d612c393abc3a73590650d24bcfe2ee57792872 (diff) |
Merge branch 'issue-3147-inNixShell-arg' of https://github.com/hercules-ci/nix
Diffstat (limited to 'tests')
-rw-r--r-- | tests/nix-shell.sh | 8 | ||||
-rw-r--r-- | tests/shell.nix | 3 |
2 files changed, 6 insertions, 5 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 diff --git a/tests/shell.nix b/tests/shell.nix index eb39f9039..6cb4f082b 100644 --- a/tests/shell.nix +++ b/tests/shell.nix @@ -1,4 +1,4 @@ -{ }: +{ inNixShell ? false }: with import ./config.nix; @@ -22,6 +22,7 @@ let pkgs = rec { name = "shellDrv"; builder = "/does/not/exist"; VAR_FROM_NIX = "bar"; + TEST_inNixShell = if inNixShell then "true" else "false"; inherit stdenv; }; |