mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-27 22:03:54 +03:00
lib.generators: Handle no drvPath in toPretty
Previously, if a derivation without a `drvPath` was handled, an error would be thrown: nix-repl> lib.generators.toPretty {} { type = "derivation"; } error: attribute 'drvPath' missing, at /home/infinisil/src/nixpkgs/lib/generators.nix:251:24 With this commit it doesn't anymore: nix-repl> lib.generators.toPretty {} { type = "derivation"; } "<derivation ???>" This matches what `nix repl` outputs: nix-repl> { type = "derivation"; } «derivation ???»
This commit is contained in:
parent
6d96191fe5
commit
307c0237d7
@ -248,7 +248,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}>"
|
"<derivation ${v.drvPath or "???"}>"
|
||||||
else "{" + introSpace
|
else "{" + introSpace
|
||||||
+ libStr.concatStringsSep introSpace (libAttr.mapAttrsToList
|
+ libStr.concatStringsSep introSpace (libAttr.mapAttrsToList
|
||||||
(name: value:
|
(name: value:
|
||||||
|
Loading…
Reference in New Issue
Block a user