From 48858ad5cabd03976330dff3d7aaa3d949ca09d6 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 19 Jul 2013 14:06:58 +0200 Subject: [PATCH] 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. --- scripts/nix-build.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/nix-build.in b/scripts/nix-build.in index a7f23df41..404133ed8 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;