aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-05-02 21:28:52 +0200
committerEelco Dolstra <edolstra@gmail.com>2019-05-02 21:28:52 +0200
commit7ba0f98e644c31ce0c16db10aa87f896937e0ddf (patch)
tree3b3a42161c1cca04c997634826c0cab912cc8c53 /src
parent8ec77614f63e14d1869734b0d21a646667bbf88b (diff)
nix dev-shell: Less purity
Diffstat (limited to 'src')
-rw-r--r--src/nix/shell.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nix/shell.cc b/src/nix/shell.cc
index 95028f10e..0813d122c 100644
--- a/src/nix/shell.cc
+++ b/src/nix/shell.cc
@@ -124,6 +124,7 @@ struct Common : InstallableCommand
std::set<string> ignoreVars{
"BASHOPTS",
"EUID",
+ "HOME", // FIXME: don't ignore in pure mode?
"NIX_BUILD_TOP",
"NIX_ENFORCE_PURITY",
"PPID",
@@ -134,11 +135,15 @@ struct Common : InstallableCommand
"TEMPDIR",
"TMP",
"TMPDIR",
+ "TZ",
"UID",
};
void makeRcScript(const BuildEnvironment & buildEnvironment, std::ostream & out)
{
+ out << "export IN_NIX_SHELL=1\n";
+ out << "nix_saved_PATH=\"$PATH\"\n";
+
for (auto & i : buildEnvironment.env) {
// FIXME: shellEscape
// FIXME: figure out what to export
@@ -147,6 +152,8 @@ struct Common : InstallableCommand
out << fmt("export %s=%s\n", i.first, i.second);
}
+ out << "PATH=\"$PATH:$nix_saved_PATH\"\n";
+
for (auto & i : buildEnvironment.functions) {
out << fmt("%s () {\n%s\n}\n", i.first, i.second);
}