mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 12:53:59 +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
|
||||
else if v == {} then "{ }"
|
||||
else if v ? type && v.type == "derivation" then
|
||||
"<derivation ${v.drvPath}>"
|
||||
"<derivation ${v.drvPath or "???"}>"
|
||||
else "{" + introSpace
|
||||
+ libStr.concatStringsSep introSpace (libAttr.mapAttrsToList
|
||||
(name: value:
|
||||
|
Loading…
Reference in New Issue
Block a user