aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-04-14 11:02:58 +0200
committerGitHub <noreply@github.com>2021-04-14 11:02:58 +0200
commit709a60a045688cc5921574155958af9bc2349d02 (patch)
tree0afbb825bd1d0007ded4cdeba05d16a167e7c3a3
parentb47b5f4061d63c79dc2f6804ecc6ac05af4f7a13 (diff)
parentd04969ffa53ce5f62efbfe02a85cfc12ec6097d6 (diff)
Merge pull request #4707 from grahamc/defaul-path-restricted-eval
EvalSettings::getDefaultNixPath: respect {restrict,pure}Eval
-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;
}