diff options
author | Silvan Mosberger <contact@infinisil.com> | 2021-08-11 15:50:33 +0200 |
---|---|---|
committer | Silvan Mosberger <contact@infinisil.com> | 2021-08-11 15:52:30 +0200 |
commit | 307c0237d7bfce7e4d84c65ec16a7af266809f0e (patch) | |
tree | 701c7abe5a1790a7b99fe4eabbfee31ed771d88b /lib/generators.nix | |
parent | 6d96191fe5a2c03abb5023c5c62dfdee8d1066dc (diff) | |
download | nixpkgs-307c0237d7bfce7e4d84c65ec16a7af266809f0e.tar nixpkgs-307c0237d7bfce7e4d84c65ec16a7af266809f0e.tar.gz nixpkgs-307c0237d7bfce7e4d84c65ec16a7af266809f0e.tar.bz2 nixpkgs-307c0237d7bfce7e4d84c65ec16a7af266809f0e.tar.lz nixpkgs-307c0237d7bfce7e4d84c65ec16a7af266809f0e.tar.xz nixpkgs-307c0237d7bfce7e4d84c65ec16a7af266809f0e.tar.zst nixpkgs-307c0237d7bfce7e4d84c65ec16a7af266809f0e.zip |
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 ???»
Diffstat (limited to 'lib/generators.nix')
-rw-r--r-- | lib/generators.nix | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/generators.nix b/lib/generators.nix index c8144db50ac..bcb0f371a9b 100644 --- a/lib/generators.nix +++ b/lib/generators.nix @@ -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: |