Are there profiling tools for nix itself?

I have a nix file that takes very long to evaluate

time nix-instantiate file.nix -A attribute
/nix/store/zjbpjs1hfvpz8r63f90ghkhdcbnsgsyw-attribute.drv

real	0m40.332s
user	0m59.889s
sys	0m1.640s

Are there any tools to help me investigate the cause of this slowness?

2 Likes

The manpage documents some env vars that might be helpful, such as NIX_SHOW_STATS=1 to print evaluation statistics, or NIX_COUNT_CALLS=1 to print how often functions are called during expression evaluation.

5 Likes