about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-07-19T12·06+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-07-19T12·06+0200
commit48858ad5cabd03976330dff3d7aaa3d949ca09d6 (patch)
tree928b42693228345e32a5a17ed35c89b73c6d90fe
parent2bc5de86357fddcc52e2ce0c1b432a9509dea27e (diff)
nix-shell: Set some environment variables also set by build.cc
Setting $NIX_STORE causes the purity checks in gcc/ld-wrapper to kick
in, so that's why we unset $NIX_ENFORCE_PURITY.
-rwxr-xr-xscripts/nix-build.in4
1 files changed, 3 insertions, 1 deletions
diff --git a/scripts/nix-build.in b/scripts/nix-build.in
index a7f23df41a1d..404133ed8e83 100755
--- a/scripts/nix-build.in
+++ b/scripts/nix-build.in
@@ -184,7 +184,8 @@ foreach my $expr (@exprs) {
             # NixOS hack: prevent /etc/bashrc from sourcing /etc/profile.
             $ENV{'__ETC_PROFILE_SOURCED'} = 1;
         }
-        $ENV{'NIX_BUILD_TOP'} = $ENV{'TMPDIR'} || "/tmp";
+        $ENV{'NIX_BUILD_TOP'} = $ENV{'TMPDIR'} = $ENV{'TEMPDIR'} = $ENV{'TMP'} = $ENV{'TEMP'} = $ENV{'TMPDIR'} // "/tmp";
+        $ENV{'NIX_STORE'} = $Nix::Config::storeDir;
         $ENV{$_} = $drv->{env}->{$_} foreach keys %{$drv->{env}};
 
         # Run a shell using the derivation's environment.  For
@@ -200,6 +201,7 @@ foreach my $expr (@exprs) {
             ($pure ? '' : 'PATH=$PATH:$p; ') .
             'set +e; ' .
             'PS1="\n\[\033[1;32m\][nix-shell:\w]$\[\033[0m\] "; ' .
+            'unset NIX_ENFORCE_PURITY; ' .
             $envCommand);
         exec($ENV{NIX_BUILD_SHELL} // "bash", "--rcfile", $rcfile);
         die;