nix shell: don't set environment variables unnecessarily

This commit is contained in:
Max Headroom 2024-07-23 14:55:23 +02:00
parent 9d2f91d1ea
commit 4a9c72b389

View file

@ -131,7 +131,9 @@ struct CmdShell : InstallablesCommand, MixEnvironment
setEnv("PATH", unixPathString.c_str());
for (auto const& pathV : extraPathVarMapping) {
setenv(pathV.first.c_str(), concatStringsSep(":", extraPathVars[pathV.first]).c_str(), 1);
if (!extraPathVars[pathV.first].empty()) {
setenv(pathV.first.c_str(), concatStringsSep(":", extraPathVars[pathV.first]).c_str(), 1);
}
}
setenv("IN_NIX3_SHELL", "1", 1);