aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGraham Christensen <graham@floxdev.com>2021-04-12 12:36:14 -0400
committerGraham Christensen <graham@grahamc.com>2021-04-12 12:37:15 -0400
commitd04969ffa53ce5f62efbfe02a85cfc12ec6097d6 (patch)
tree988cde7efc596fddfdfd8ad3c9bd37f9737ce967 /src
parent525015be7f908876e04e8d99c26b9ba8d13fb5d7 (diff)
EvalSettings::getDefaultNixPath: respect {restrict,pure}Eval
Otherwise Nix may look to invalid locations for channels.
Diffstat (limited to 'src')
-rw-r--r--src/libexpr/eval.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index 3afe2e47b..936bccc8c 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -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;
}