diff options
author | Christian Höppner <chris@mkaito.net> | 2020-11-12 15:46:08 +0000 |
---|---|---|
committer | Christian Höppner <chris@mkaito.net> | 2020-11-12 15:46:08 +0000 |
commit | c4c3c15c19bc448a4797e5d9577539cc14890618 (patch) | |
tree | 9cc875b49c21e58327241adac6b546ddffc5dc87 /src/libexpr | |
parent | 905f6678e8e97960f03fedc95b23144319dc6d8c (diff) |
Fix default nix-path
The default nix-path values for nixpkgs and root channels were
incorrect.
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/eval.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 5e3fcf4ac..c6f4d1716 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -2104,10 +2104,19 @@ EvalSettings::EvalSettings() Strings EvalSettings::getDefaultNixPath() { 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("nixpkgs=" + settings.nixStateDir + "/nix/profiles/per-user/root/channels/nixpkgs"); - add(settings.nixStateDir + "/nix/profiles/per-user/root/channels"); + add(settings.nixStateDir + "/profiles/per-user/root/channels/nixpkgs", "nixpkgs"); + add(settings.nixStateDir + "/profiles/per-user/root/channels"); return res; } |