summary refs log tree commit diff
path: root/lib/generators.nix
diff options
context:
space:
mode:
authorNaïm Favier2022-11-04 17:31:41 +0100
committerpennae2022-12-08 17:52:52 +0100
commit0fa7b1b004788881733dc117edd7699f77384166 (patch)
tree77276bc9fa85ee65e90905d2cc28b5149a035fed /lib/generators.nix
parent0ff3b35356b5a57f93b4a7c27ed9ca4c71d388ac (diff)
lib/generators.toPretty: don't evaluate derivations
With the goal of making `toPretty` suitable for rendering option
values, render derivations as `<derivation foo-1.0>` instead of
`<derivation /nix/store/…-foo-1.0.drv>`.

This is to avoid causing sudden evaluation errors for out-of-tree
projects that have options with `default = pkgs.someUnfreePackage;` and
no `defaultText`.
Diffstat (limited to 'lib/generators.nix')
-rw-r--r--lib/generators.nix2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/generators.nix b/lib/generators.nix
index b77cca75010f..9620b8b27b9b 100644
--- a/lib/generators.nix
+++ b/lib/generators.nix
@@ -330,7 +330,7 @@ rec {
          then v.__pretty v.val
       else if v == {} then "{ }"
       else if v ? type && v.type == "derivation" then
-        "<derivation ${v.drvPath or "???"}>"
+        "<derivation ${v.name or "???"}>"
       else "{" + introSpace
           + libStr.concatStringsSep introSpace (libAttr.mapAttrsToList
               (name: value: