query
On this page

toPretty

lib.generators.toPretty

Docs pulled from | This Revision | about 12 hours ago


Pretty print a value, akin to builtins.trace.

Should probably be a builtin as well.

The pretty-printed string should be suitable for rendering default values in the NixOS manual. In particular, it should be as close to a valid Nix expression as possible.

Inputs

Structured function argument
allowPrettyValues
If this option is true, attrsets like { __pretty = fn; val = …; } will use fn to convert val to a pretty printed representation. (This means fn is type Val -> String.)
multiline
If this option is true, the output is indented with newlines for attribute sets and lists
indent
Initial indentation level
Value
The value to be pretty printed