Commit 0fa7b1b0 authored by Naïm Favier's avatar Naïm Favier Committed by pennae
Browse files

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`.
parent 0ff3b353
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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:
+1 −1
Original line number Diff line number Diff line
@@ -754,7 +754,7 @@ runTests {
      emptylist = "[ ]";
      attrs = "{ foo = null; \"foo bar\" = \"baz\"; }";
      emptyattrs = "{ }";
      drv = "<derivation ${deriv.drvPath}>";
      drv = "<derivation ${deriv.name}>";
    };
  };