summary refs log tree commit diff
path: root/pkgs/lib/default.nix
diff options
context:
space:
mode:
authorMarc Weber <marco-oweber@gmx.de>2008-12-02 12:26:12 +0000
committerMarc Weber <marco-oweber@gmx.de>2008-12-02 12:26:12 +0000
commit1f69d4d1ebb5ecb0ba51c1956df7dac730ae6d87 (patch)
tree48f700cb26b440ebaa52bead5aefb728dd6ea2c7 /pkgs/lib/default.nix
parent01fc783e7f2527e7f712ea8fd2965f829bb61a53 (diff)
downloadnixlib-1f69d4d1ebb5ecb0ba51c1956df7dac730ae6d87.tar
nixlib-1f69d4d1ebb5ecb0ba51c1956df7dac730ae6d87.tar.gz
nixlib-1f69d4d1ebb5ecb0ba51c1956df7dac730ae6d87.tar.bz2
nixlib-1f69d4d1ebb5ecb0ba51c1956df7dac730ae6d87.tar.lz
nixlib-1f69d4d1ebb5ecb0ba51c1956df7dac730ae6d87.tar.xz
nixlib-1f69d4d1ebb5ecb0ba51c1956df7dac730ae6d87.tar.zst
nixlib-1f69d4d1ebb5ecb0ba51c1956df7dac730ae6d87.zip
enhancing whatis trace function
svn path=/nixpkgs/trunk/; revision=13541
Diffstat (limited to 'pkgs/lib/default.nix')
-rw-r--r--pkgs/lib/default.nix7
1 files changed, 4 insertions, 3 deletions
diff --git a/pkgs/lib/default.nix b/pkgs/lib/default.nix
index fe5b7fb1427f..e03d0be27d62 100644
--- a/pkgs/lib/default.nix
+++ b/pkgs/lib/default.nix
@@ -566,10 +566,11 @@ rec {
   # this can help debug your code as well - designed to not produce thousands of lines
   traceWhatis = x : __trace (whatis x) x;
   traceMarked = str: x: __trace (str + (whatis x)) x;
-  whatis = x : 
+  attrNamesToStr = a : concatStringsSep "; " (map (x : "${x}=") (__attrNames a));
+  whatis = x :
       if (__isAttrs x) then
-          if (x ? outPath) then "x is a derivation with name ${x.name}"
-          else "x is an attr set with attributes ${builtins.toString (__attrNames x)}"
+          if (x ? outPath) then "x is a derivation, name ${if x ? name then x.name else "<no name>"}, { ${attrNamesToStr x} }"
+          else "x is attr set { ${attrNamesToStr x} }"
       else if (__isFunction x) then "x is a function"
       else if (x == []) then "x is an empty list"
       else if (__isList x) then "x is a list, first item is : ${whatis (__head x)}"