when developing in nix i usually use builtins.trace
for debugging:
in code
a = { foo = "bar"; ... more complex nested attrset ...};
builtins.trace a a;
in nix-repl
using :p a
on a complex data structure is really hard to read also.
the problem
however, the output is just a single line without any formating and for complex data structure this is barely usable for debugging.
the question
is there a pretty print function in nix which does some indentation and adding of newline? or even better colored output?
ideal output
i'd like to see something like this:
default = {
active = {
check_ssl = [
{
tags = [ "mycustomtag" ];
host = "kotalla.de";
ipv6 = false;
name = "ssl11";
}
{
tags = [ "mycustomtag" ];
host = "kotalla.de";
ipv6 = false;
name = "ssl2";
}
];
check_http = [
{
host = "kotalla.de";
port = 80;
url = "/foo";
contains = "Labor";
name = "http";
}
];
check_ssh = [
{
host = "mail.lastlog.de";
port = 20202;
name = "ssh";
}
];
};