about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorRyan Lahfa <masterancpp@gmail.com>2024-03-05 23:18:01 +0100
committerGitHub <noreply@github.com>2024-03-05 23:18:01 +0100
commit880992dcc006a5e00dd0591446fdf723e6a51a64 (patch)
treee2b2cbabd058711d786ee7636db4d27b3bad6e20 /pkgs
parent4c76c08f4183c2b685b0d68de6953a476d043b24 (diff)
parentd164b705b56ecd9c0659f0dccc9d5396e5b981f0 (diff)
Merge pull request #293546 from NixOS/backport-293542-to-release-23.11
[Backport release-23.11] nixos-option: update to nix 2.18
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/tools/nix/nixos-option/nixos-option.cc16
-rw-r--r--pkgs/top-level/all-packages.nix2
2 files changed, 9 insertions, 9 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;
 }
 
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 89a0c3157f84a..91f2d69b5ab4f 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -40800,7 +40800,7 @@ with pkgs;
   nix-melt = callPackage ../tools/nix/nix-melt { };
 
   nixos-option = callPackage ../tools/nix/nixos-option {
-    nix = nixVersions.nix_2_15;
+    nix = nixVersions.nix_2_18;
   };
 
   nix-pin = callPackage ../tools/package-management/nix-pin { };