aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-07-26 20:09:44 +0200
committerEelco Dolstra <edolstra@gmail.com>2019-07-26 20:09:44 +0200
commit336afe4d5fe374569c2b13d2db90caac663573b3 (patch)
tree7d5ccfb753bc568a9581fae918664f30d2c6256c /src
parent13604318ad1a6ac97ef789481a550a9be65c1d48 (diff)
nix dev-shell: Set IN_NIX_SHELL in the derivation
This ensures that stdenv / setup hooks take $IN_NIX_SHELL into account. For example, stdenv only sets NIX_SSL_CERT_FILE=/no-cert-file.crt if we're not in a shell.
Diffstat (limited to 'src')
-rw-r--r--src/nix/shell.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/nix/shell.cc b/src/nix/shell.cc
index 93732f6a3..5f2724961 100644
--- a/src/nix/shell.cc
+++ b/src/nix/shell.cc
@@ -72,7 +72,7 @@ Path getDerivationEnvironment(ref<Store> store, Derivation drv)
if (builder != "bash")
throw Error("'nix shell' only works on derivations that use 'bash' as their builder");
- drv.args = {"-c", "set -e; if [[ -n $stdenv ]]; then source $stdenv/setup; fi; set > $out"};
+ drv.args = {"-c", "set -e; export IN_NIX_SHELL=impure; if [[ -n $stdenv ]]; then source $stdenv/setup; fi; set > $out"};
/* Remove derivation checks. */
drv.env.erase("allowedReferences");
@@ -143,7 +143,6 @@ struct Common : InstallableCommand, MixProfile
void makeRcScript(const BuildEnvironment & buildEnvironment, std::ostream & out)
{
- out << "export IN_NIX_SHELL=1\n";
out << "nix_saved_PATH=\"$PATH\"\n";
for (auto & i : buildEnvironment.env) {