nix develop: do not assume that saved vars are set

This fixes https://github.com/NixOS/nix/issues/6809
This commit is contained in:
Jeremy Fleischman 2022-07-14 23:11:02 -07:00
parent de287964d5
commit 04386f7d69
No known key found for this signature in database
GPG key ID: 19319CD8416A642B

View file

@ -288,8 +288,10 @@ struct Common : InstallableCommand, MixProfile
out << "unset shellHook\n"; 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); out << fmt("nix_saved_%s=\"$%s\"\n", var, var);
}
buildEnvironment.toBash(out, ignoreVars); buildEnvironment.toBash(out, ignoreVars);