diff options
author | Robert Hensing <roberth@users.noreply.github.com> | 2023-08-11 20:32:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-11 20:32:03 +0200 |
commit | 584ff408a4e2b6eb0d74989778c640a92089b6d4 (patch) | |
tree | 12b3b1691759a901bf248433e93e9f6e0e851301 /src/libexpr | |
parent | 010dc7958e23dd8acc72a154e40a6ce5761dccdf (diff) | |
parent | 9b908fa70a07219a110ddd63ec3593c2c2269918 (diff) |
Merge pull request #8735 from obsidiansystems/defexpr
Factor out `nix-defexpr` path computation
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/eval-settings.cc | 9 | ||||
-rw-r--r-- | src/libexpr/eval-settings.hh | 5 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/libexpr/eval-settings.cc b/src/libexpr/eval-settings.cc index 422aaf8d5..93b4a5289 100644 --- a/src/libexpr/eval-settings.cc +++ b/src/libexpr/eval-settings.cc @@ -63,7 +63,7 @@ Strings EvalSettings::getDefaultNixPath() }; if (!evalSettings.restrictEval && !evalSettings.pureEval) { - add(settings.useXDGBaseDirectories ? getStateDir() + "/nix/defexpr/channels" : getHome() + "/.nix-defexpr/channels"); + add(getNixDefExpr() + "/channels"); add(rootChannelsDir() + "/nixpkgs", "nixpkgs"); add(rootChannelsDir()); } @@ -92,4 +92,11 @@ EvalSettings evalSettings; static GlobalConfig::Register rEvalSettings(&evalSettings); +Path getNixDefExpr() +{ + return settings.useXDGBaseDirectories + ? getStateDir() + "/nix/defexpr" + : getHome() + "/.nix-defexpr"; +} + } diff --git a/src/libexpr/eval-settings.hh b/src/libexpr/eval-settings.hh index 043af6cab..e6666061a 100644 --- a/src/libexpr/eval-settings.hh +++ b/src/libexpr/eval-settings.hh @@ -95,4 +95,9 @@ struct EvalSettings : Config extern EvalSettings evalSettings; +/** + * Conventionally part of the default nix path in impure mode. + */ +Path getNixDefExpr(); + } |