aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nix/develop.cc6
-rw-r--r--src/nix/get-env.sh14
2 files changed, 15 insertions, 5 deletions
diff --git a/src/nix/develop.cc b/src/nix/develop.cc
index e00f0d575..9b2945ba3 100644
--- a/src/nix/develop.cc
+++ b/src/nix/develop.cc
@@ -72,7 +72,7 @@ struct BuildEnvironment
void toBash(std::ostream & out, const std::set<std::string> & ignoreVars) const
{
for (auto & [name, value] : vars) {
- if (!ignoreVars.count(name) && !hasPrefix(name, "BASH_")) {
+ if (!ignoreVars.count(name)) {
if (auto str = std::get_if<String>(&value)) {
out << fmt("%s=%s\n", name, shellEscape(str->value));
if (str->exported)
@@ -191,17 +191,13 @@ struct Common : InstallableCommand, MixProfile
{
std::set<std::string> ignoreVars{
"BASHOPTS",
- "EUID",
"HOME", // FIXME: don't ignore in pure mode?
- "HOSTNAME",
"NIX_BUILD_TOP",
"NIX_ENFORCE_PURITY",
"NIX_LOG_FD",
"NIX_REMOTE",
"PPID",
- "PWD",
"SHELLOPTS",
- "SHLVL",
"SSL_CERT_FILE", // FIXME: only want to ignore /no-cert-file.crt
"TEMP",
"TEMPDIR",
diff --git a/src/nix/get-env.sh b/src/nix/get-env.sh
index 834b84e35..20937b956 100644
--- a/src/nix/get-env.sh
+++ b/src/nix/get-env.sh
@@ -42,6 +42,20 @@ __dumpEnv() {
local type="${BASH_REMATCH[1]}"
local __var_name="${BASH_REMATCH[2]}"
+ if [[ $__var_name =~ ^BASH_ || \
+ $__var_name = _ || \
+ $__var_name = DIRSTACK || \
+ $__var_name = EUID || \
+ $__var_name = FUNCNAME || \
+ $__var_name = HISTCMD || \
+ $__var_name = HOSTNAME || \
+ $__var_name = PIPESTATUS || \
+ $__var_name = PWD || \
+ $__var_name = RANDOM || \
+ $__var_name = SHLVL || \
+ $__var_name = SECONDS \
+ ]]; then continue; fi
+
if [[ -z $__first ]]; then printf ',\n'; else __first=; fi
printf " "