about summary refs log tree commit diff
path: root/scripts/nix-build.in
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/nix-build.in')
-rwxr-xr-xscripts/nix-build.in9
1 files changed, 5 insertions, 4 deletions
diff --git a/scripts/nix-build.in b/scripts/nix-build.in
index 8ac95e90e59e..07752f144f1d 100755
--- a/scripts/nix-build.in
+++ b/scripts/nix-build.in
@@ -152,6 +152,8 @@ for (my $n = 0; $n < scalar @ARGV; $n++) {
 
 @exprs = ("./default.nix") if scalar @exprs == 0;
 
+$ENV{'IN_NIX_SHELL'} = 1 if $runEnv;
+
 
 foreach my $expr (@exprs) {
 
@@ -177,13 +179,13 @@ foreach my $expr (@exprs) {
 
         # 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 @buildArgs @inputDrvs @{$drv->{inputSrcs}} > /dev/null") == 0
+        system("$Nix::Config::binDir/nix-store", "-r", "--no-output", "--no-gc-warning", @buildArgs, @inputDrvs, @{$drv->{inputSrcs}}) == 0
             or die "$0: failed to build all dependencies\n";
 
         # Set the environment.
         if ($pure) {
             foreach my $name (keys %ENV) {
-                next if $name eq "HOME" || $name eq "USER" || $name eq "LOGNAME" || $name eq "DISPLAY" || $name eq "PATH";
+                next if $name eq "HOME" || $name eq "USER" || $name eq "LOGNAME" || $name eq "DISPLAY" || $name eq "PATH" || $name eq "TERM" || $name eq "IN_NIX_SHELL";
                 delete $ENV{$name};
             }
             # NixOS hack: prevent /etc/bashrc from sourcing /etc/profile.
@@ -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
@@ -211,6 +211,7 @@ foreach my $expr (@exprs) {
             'set +e; ' .
             '[ -n "$PS1" ] && PS1="\n\[\033[1;32m\][nix-shell:\w]$\[\033[0m\] "; ' .
             'unset NIX_ENFORCE_PURITY; ' .
+            'unset NIX_INDENT_MAKE; ' .
             'shopt -u nullglob; ' .
             $envCommand);
         $ENV{BASH_ENV} = $rcfile;