From 0eb200e569affe89c8850ea993ae0f603f40f742 Mon Sep 17 00:00:00 2001 From: Fabian Schmitthenner Date: Mon, 7 Dec 2015 15:47:31 +0000 Subject: [PATCH] propagate NIX_BUILD_SHELL also in pure builds document NIX_BUILD_SHELL in the nix-shell command documentation --- doc/manual/command-ref/nix-shell.xml | 16 ++++++++++++++++ scripts/nix-build.in | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/doc/manual/command-ref/nix-shell.xml b/doc/manual/command-ref/nix-shell.xml index a13d9d7c1..6f00e28ca 100644 --- a/doc/manual/command-ref/nix-shell.xml +++ b/doc/manual/command-ref/nix-shell.xml @@ -176,6 +176,22 @@ also . +Environment variables + + + + NIX_BUILD_SHELL + + Shell used to start the interactive environment. + Defaults to the bash found in PATH. + + + + + + + + Examples To build the dependencies of the package Pan, and start an diff --git a/scripts/nix-build.in b/scripts/nix-build.in index ea099532b..b4bb2fc3f 100755 --- a/scripts/nix-build.in +++ b/scripts/nix-build.in @@ -270,7 +270,7 @@ foreach my $expr (@exprs) { my $tmp = $ENV{"TMPDIR"} // $ENV{"XDG_RUNTIME_DIR"} // "/tmp"; if ($pure) { foreach my $name (keys %ENV) { - next if grep { $_ eq $name } ("HOME", "USER", "LOGNAME", "DISPLAY", "PATH", "TERM", "IN_NIX_SHELL", "TZ", "PAGER"); + next if grep { $_ eq $name } ("HOME", "USER", "LOGNAME", "DISPLAY", "PATH", "TERM", "IN_NIX_SHELL", "TZ", "PAGER", "NIX_BUILD_SHELL"); delete $ENV{$name}; } # NixOS hack: prevent /etc/bashrc from sourcing /etc/profile.