From 307c0237d7bfce7e4d84c65ec16a7af266809f0e Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Wed, 11 Aug 2021 15:50:33 +0200 Subject: lib.generators: Handle no drvPath in toPretty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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"; } "" This matches what `nix repl` outputs: nix-repl> { type = "derivation"; } «derivation ???» --- lib/generators.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/generators.nix b/lib/generators.nix index c8144db50ac8..bcb0f371a9b5 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 - "" + "" else "{" + introSpace + libStr.concatStringsSep introSpace (libAttr.mapAttrsToList (name: value: -- cgit v1.2.3