diff options
author | Naïm Favier <n@monade.li> | 2022-11-04 17:31:41 +0100 |
---|---|---|
committer | pennae <82953136+pennae@users.noreply.github.com> | 2022-12-08 17:52:52 +0100 |
commit | 0fa7b1b004788881733dc117edd7699f77384166 (patch) | |
tree | 77276bc9fa85ee65e90905d2cc28b5149a035fed /lib | |
parent | 0ff3b35356b5a57f93b4a7c27ed9ca4c71d388ac (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')
-rw-r--r-- | lib/generators.nix | 2 | ||||
-rw-r--r-- | lib/tests/misc.nix | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/generators.nix b/lib/generators.nix index b77cca75010f9..9620b8b27b9b9 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: diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix index b73da4f1010d4..9267e1f57694c 100644 --- a/lib/tests/misc.nix +++ b/lib/tests/misc.nix @@ -754,7 +754,7 @@ runTests { emptylist = "[ ]"; attrs = "{ foo = null; \"foo bar\" = \"baz\"; }"; emptyattrs = "{ }"; - drv = "<derivation ${deriv.drvPath}>"; + drv = "<derivation ${deriv.name}>"; }; }; |