diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2018-08-03 16:58:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-03 16:58:18 +0200 |
commit | 122e1a61f8deb55a38a00534c502fd8c6700d539 (patch) | |
tree | c6a83d4db01d2c692f44904892cfd3c2b80fcbce /tests/nix-shell.sh | |
parent | 49a53c1d3f77ff33e14a95d004a6ce0720293997 (diff) | |
parent | 438e02529dfb4b26603e2a06992df977cd80ecd9 (diff) |
Merge pull request #2323 from samueldr/feature/selective-impurity
Allows selectively adding environment variables to pure shells.
Diffstat (limited to 'tests/nix-shell.sh')
-rw-r--r-- | tests/nix-shell.sh | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/nix-shell.sh b/tests/nix-shell.sh index d25c456ce..6024ea399 100644 --- a/tests/nix-shell.sh +++ b/tests/nix-shell.sh @@ -4,12 +4,19 @@ clearStore # Test nix-shell -A 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"') [ "$output" = " - foo - bar" ] +# Test --keep +output=$(nix-shell --pure --keep SELECTED_IMPURE_VAR shell.nix -A shellDrv --run \ + 'echo "$IMPURE_VAR - $VAR_FROM_STDENV_SETUP - $VAR_FROM_NIX - $SELECTED_IMPURE_VAR"') + +[ "$output" = " - foo - bar - baz" ] + # 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" ]] |