EvalSettings::getDefaultNixPath: respect {restrict,pure}Eval

Otherwise Nix may look to invalid locations for channels.
This commit is contained in:
Graham Christensen 2021-04-12 12:36:14 -04:00 committed by Graham Christensen
parent 525015be7f
commit d04969ffa5

View file

@ -2091,9 +2091,12 @@ Strings EvalSettings::getDefaultNixPath()
}
};
add(getHome() + "/.nix-defexpr/channels");
add(settings.nixStateDir + "/profiles/per-user/root/channels/nixpkgs", "nixpkgs");
add(settings.nixStateDir + "/profiles/per-user/root/channels");
if (!evalSettings.restrictEval && !evalSettings.pureEval) {
add(getHome() + "/.nix-defexpr/channels");
add(settings.nixStateDir + "/profiles/per-user/root/channels/nixpkgs", "nixpkgs");
add(settings.nixStateDir + "/profiles/per-user/root/channels");
}
return res;
}