Merge pull request #6810 from jfly/jfly/do-not-assume-savedvars-exist

nix develop: do not assume that saved vars are set
This commit is contained in:
Eelco Dolstra 2022-07-15 13:59:25 +02:00 committed by GitHub
commit 59764eb842
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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);