diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-11-12 17:45:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-12 17:45:19 +0100 |
commit | 258e5338d68c5d98090748bbbd49bd33a37c7954 (patch) | |
tree | 9cc875b49c21e58327241adac6b546ddffc5dc87 | |
parent | 905f6678e8e97960f03fedc95b23144319dc6d8c (diff) | |
parent | c4c3c15c19bc448a4797e5d9577539cc14890618 (diff) |
Merge pull request #4251 from serokell/mkaito/ops1098-nix-default-nix-path
Fix default nix-path
-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; } |