about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-12-20T12·11+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-12-20T12·11+0100
commit0c1198cf08576f16633b2344dc6513cefb567cfc (patch)
tree1cf7ce2bf7d510ca1cde6005e9aa01e631ad471b /scripts
parent65a64522403f353880a501b02aca10fb96ea1c26 (diff)
nix-shell: Set $IN_NIX_SHELL before evaluation
This has some hacky applications.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/nix-build.in4
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/nix-build.in b/scripts/nix-build.in
index b3f12b7062ed..60e8afec8ee2 100755
--- a/scripts/nix-build.in
+++ b/scripts/nix-build.in
@@ -175,6 +175,8 @@ foreach my $expr (@exprs) {
         $drvPath = readlink $drvPath or die "cannot read symlink `$drvPath'" if -l $drvPath;
         my $drv = derivationFromPath($drvPath);
 
+        $ENV{'IN_NIX_SHELL'} = 1;
+
         # Build or fetch all dependencies of the derivation.
         my @inputDrvs = grep { my $x = $_; (grep { $x =~ $_ } @envExclude) == 0 } @{$drv->{inputDrvs}};
         system("$Nix::Config::binDir/nix-store", "-r", "--no-output", @buildArgs, @inputDrvs, @{$drv->{inputSrcs}}) == 0
@@ -193,8 +195,6 @@ foreach my $expr (@exprs) {
         $ENV{'NIX_STORE'} = $Nix::Config::storeDir;
         $ENV{$_} = $drv->{env}->{$_} foreach keys %{$drv->{env}};
 
-        $ENV{'IN_NIX_SHELL'} = 1;
-
         # Run a shell using the derivation's environment.  For
         # convenience, source $stdenv/setup to setup additional
         # environment variables and shell functions.  Also don't lose