diff --git a/src/libexpr/eval-settings.cc b/src/libexpr/eval-settings.cc index 2846eccbc..a39f036a1 100644 --- a/src/libexpr/eval-settings.cc +++ b/src/libexpr/eval-settings.cc @@ -57,7 +57,7 @@ Strings EvalSettings::getDefaultNixPath() { Strings res; auto add = [&](const Path & p, const std::string & s = std::string()) { - if (pathAccessible(p)) { + if (std::filesystem::exists(p)) { if (s.empty()) { res.push_back(p); } else { diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index ee72436e4..463f361d3 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -3084,8 +3084,11 @@ std::optional EvalState::resolveLookupPathPath(const LookupPath::Pa auto i = lookupPathResolved.find(value); if (i != lookupPathResolved.end()) return i->second; - auto finish = [&](std::string res) { - debug("resolved search path element '%s' to '%s'", value, res); + auto finish = [&](std::optional res) { + if (res) + debug("resolved search path element '%s' to '%s'", value, *res); + else + debug("failed to resolve search path element '%s'", value); lookupPathResolved.emplace(value, res); return res; }; @@ -3137,9 +3140,7 @@ std::optional EvalState::resolveLookupPathPath(const LookupPath::Pa } } - debug("failed to resolve search path element '%s'", value); - return std::nullopt; - + return finish(std::nullopt); }