Semi-usable flamegraph generation for troubleshooting just why your Nix code is so damn slow. This mostly just shows a useful visualization of the call stack, so that you can get an impression of which function is being called recursively five thousand times. :P
Help page:
nix run github:crabdancing/nix-flamegraph -- --help
Process a flake (e.g.):
nix run github:crabdancing/nix-flamegraph -- -t /etc/nixos
You just point it at a target, and it hopefully prints out the path to an SVG. Internals are very jank. Results may vary.
Note that it prints status info via STDERR, and the actual path via STDOUT. Therefore, it should be easy to extract the path for machine usage if desired. Alternatively, look at the -o flag for telling the script to dump your SVG to a given path. Note that it will error if path already exists with exit code 5.
Internal script is mostly based on posts from here cobbled together.
Yoinked stack-collapse.py from here, and made slight alterations (to pin Python version against flake deps).
This is basically just a bunch of templates & scripts cobbled together. The parts I contributed are too trivial to really be worthy of anything other than public domain. So, um, do whatever you want.