aboutsummaryrefslogtreecommitdiff
path: root/src/nix/develop.cc
diff options
context:
space:
mode:
authorJeremy Fleischman <jeremyfleischman@gmail.com>2022-07-14 23:11:02 -0700
committerJeremy Fleischman <jeremyfleischman@gmail.com>2022-07-14 23:25:39 -0700
commit04386f7d69d9c370eb4367ca41d89ac5990ac02e (patch)
treea2da216348e86f17a2a8ea463a71b2d0aa382330 /src/nix/develop.cc
parentde287964d5bf92cd811fce395061385c2079fba6 (diff)
nix develop: do not assume that saved vars are set
This fixes https://github.com/NixOS/nix/issues/6809
Diffstat (limited to 'src/nix/develop.cc')
-rw-r--r--src/nix/develop.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/nix/develop.cc b/src/nix/develop.cc
index 6d9ad9942..ba7ba7c25 100644
--- a/src/nix/develop.cc
+++ b/src/nix/develop.cc
@@ -288,8 +288,10 @@ struct Common : InstallableCommand, MixProfile
out << "unset shellHook\n";
- for (auto & var : savedVars)
+ for (auto & var : savedVars) {
+ out << fmt("%s=${%s:-}\n", var, var);
out << fmt("nix_saved_%s=\"$%s\"\n", var, var);
+ }
buildEnvironment.toBash(out, ignoreVars);