Fix default nix-path

The default nix-path values for nixpkgs and root channels were
incorrect.
This commit is contained in:
Christian Höppner 2020-11-12 15:46:08 +00:00
parent 905f6678e8
commit c4c3c15c19

View file

@ -2104,10 +2104,19 @@ EvalSettings::EvalSettings()
Strings EvalSettings::getDefaultNixPath() Strings EvalSettings::getDefaultNixPath()
{ {
Strings res; Strings res;
auto add = [&](const Path & p) { if (pathExists(p)) { res.push_back(p); } }; auto add = [&](const Path & p, const std::string & s = std::string()) {
if (pathExists(p)) {
if (s.empty()) {
res.push_back(p);
} else {
res.push_back(s + "=" + p);
}
}
};
add(getHome() + "/.nix-defexpr/channels"); add(getHome() + "/.nix-defexpr/channels");
add("nixpkgs=" + settings.nixStateDir + "/nix/profiles/per-user/root/channels/nixpkgs"); add(settings.nixStateDir + "/profiles/per-user/root/channels/nixpkgs", "nixpkgs");
add(settings.nixStateDir + "/nix/profiles/per-user/root/channels"); add(settings.nixStateDir + "/profiles/per-user/root/channels");
return res; return res;
} }