Home Explore Blog Models CI



nixpkgs

doc/functions/debug.section.md
78eaaaced9c2e260a96214111eb4a272737ce97fd39b6d02000000030000025b
# Debugging Nix Expressions {#sec-debug}

Nix is a unityped, dynamic language, this means every value can potentially appear anywhere. Since it is also non-strict, evaluation order and what ultimately is evaluated might surprise you. Therefore it is important to be able to debug nix expressions.

In the `lib/debug.nix` file you will find a number of functions that help (pretty-)printing values while evaluation is running. You can even specify how deep these values should be printed recursively, and transform them on the fly. Please consult the docstrings in `lib/debug.nix` for usage information.

Chunks
ac0f82a1 (1st chunk of `doc/functions/debug.section.md`)
Title: Debugging Nix Expressions
Summary
Nix's unityped, dynamic, and non-strict nature can lead to surprising evaluation behavior, making debugging essential. The `lib/debug.nix` file provides functions for pretty-printing values during evaluation, offering options to control recursion depth and apply transformations. Users should consult the docstrings in that file for detailed usage.