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`.
This commit is contained in:
@@ -330,7 +330,7 @@ rec {
|
|||||||
then v.__pretty v.val
|
then v.__pretty v.val
|
||||||
else if v == {} then "{ }"
|
else if v == {} then "{ }"
|
||||||
else if v ? type && v.type == "derivation" then
|
else if v ? type && v.type == "derivation" then
|
||||||
"<derivation ${v.drvPath or "???"}>"
|
"<derivation ${v.name or "???"}>"
|
||||||
else "{" + introSpace
|
else "{" + introSpace
|
||||||
+ libStr.concatStringsSep introSpace (libAttr.mapAttrsToList
|
+ libStr.concatStringsSep introSpace (libAttr.mapAttrsToList
|
||||||
(name: value:
|
(name: value:
|
||||||
|
|||||||
@@ -754,7 +754,7 @@ runTests {
|
|||||||
emptylist = "[ ]";
|
emptylist = "[ ]";
|
||||||
attrs = "{ foo = null; \"foo bar\" = \"baz\"; }";
|
attrs = "{ foo = null; \"foo bar\" = \"baz\"; }";
|
||||||
emptyattrs = "{ }";
|
emptyattrs = "{ }";
|
||||||
drv = "<derivation ${deriv.drvPath}>";
|
drv = "<derivation ${deriv.name}>";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user