diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2024-03-06 00:12:50 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-06 00:12:50 +0000 |
commit | 21588b3902fa38579bf64f9fea414d12d4e3542b (patch) | |
tree | c1e96a766ff2c80ef735c895ce983e863feb1711 /pkgs/tools/nix | |
parent | 5f2e6243fba18cd8d548c85dbb13c8cabe364e2a (diff) | |
parent | 5706443baf9ce6a4cdb09f0c8463429c0549a9df (diff) |
Merge master into haskell-updates
Diffstat (limited to 'pkgs/tools/nix')
-rw-r--r-- | pkgs/tools/nix/nixos-option/nixos-option.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/pkgs/tools/nix/nixos-option/nixos-option.cc b/pkgs/tools/nix/nixos-option/nixos-option.cc index e2a73866d0ed3..d8c3d46c4fa19 100644 --- a/pkgs/tools/nix/nixos-option/nixos-option.cc +++ b/pkgs/tools/nix/nixos-option/nixos-option.cc @@ -368,20 +368,20 @@ std::string describeError(const Error & e) { return "«error: " + e.msg() + "»" void describeDerivation(Context & ctx, Out & out, Value v) { // Copy-pasted from nix/src/nix/repl.cc :( + out << "«derivation "; Bindings::iterator i = v.attrs->find(ctx.state.sDrvPath); - PathSet pathset; - try { - Path drvPath = i != v.attrs->end() ? ctx.state.coerceToPath(i->pos, *i->value, pathset, "while evaluating the drvPath of a derivation") : "???"; - out << "«derivation " << drvPath << "»"; - } catch (Error & e) { - out << describeError(e); - } + nix::NixStringContext strContext; + if (i != v.attrs->end()) + out << ctx.state.store->printStorePath(ctx.state.coerceToStorePath(i->pos, *i->value, strContext, "while evaluating the drvPath of a derivation")); + else + out << "???"; + out << "»"; } Value parseAndEval(EvalState & state, const std::string & expression, const std::string & path) { Value v{}; - state.eval(state.parseExprFromString(expression, absPath(path)), v); + state.eval(state.parseExprFromString(expression, nix::SourcePath(nix::CanonPath::fromCwd(path))), v); return v; } |