diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-01-23T12·31+0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-01-23T12·34+0100 |
commit | 79dee4283de798da8728dd8504cdc4ab5c9b9fe0 (patch) | |
tree | 4b8b597f973adc546187987b886a776225e0609e /scripts/nix-build.in | |
parent | 7fdee6e13695a1e85b0b3f476a33a9e934af3f0b (diff) |
nix-shell: Preserve the TZ variable of the user
Diffstat (limited to 'scripts/nix-build.in')
-rwxr-xr-x | scripts/nix-build.in | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/nix-build.in b/scripts/nix-build.in index 46a8e37315fc..060b08089707 100755 --- a/scripts/nix-build.in +++ b/scripts/nix-build.in @@ -185,7 +185,7 @@ foreach my $expr (@exprs) { # Set the environment. if ($pure) { foreach my $name (keys %ENV) { - next if grep { $_ eq $name } ("HOME", "USER", "LOGNAME", "DISPLAY", "PATH", "TERM", "IN_NIX_SHELL"); + next if grep { $_ eq $name } ("HOME", "USER", "LOGNAME", "DISPLAY", "PATH", "TERM", "IN_NIX_SHELL", "TZ"); delete $ENV{$name}; } # NixOS hack: prevent /etc/bashrc from sourcing /etc/profile. @@ -207,12 +207,13 @@ foreach my $expr (@exprs) { ($pure ? '' : 'p=$PATH; ' ) . 'dontAddDisableDepTrack=1; ' . '[ -e $stdenv/setup ] && source $stdenv/setup; ' . - ($pure ? '' : 'PATH=$PATH:$p; ') . + ($pure ? '' : 'PATH=$PATH:$p; unset p; ') . '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; ' . + 'unset TZ; ' . (defined $ENV{'TZ'} ? "export TZ='${ENV{'TZ'}}'; " : '') . $envCommand); $ENV{BASH_ENV} = $rcfile; exec($ENV{NIX_BUILD_SHELL} // "bash", "--rcfile", $rcfile); |