Jump to content

Nix Profiling: Difference between revisions

From justus.pw Wiki
Create page
 
Line 4: Line 4:
# after your hostname
# after your hostname
nix eval --option eval-profiler flamegraph .#darwinConfigurations.$(hostname).system
nix eval --option eval-profiler flamegraph .#darwinConfigurations.$(hostname).system
</pre>You should end up with a file called <code>nix.profile</code>:<pre>
$ file nix.profile
nix.profile: Unicode text, UTF-8 text, with very long lines (1339
</pre>
</pre>
=== Make flamegraph ===
[[File:Nix eval flamegraph.png|thumb|This zoomed out screenshot of <code>nix.svg</code> shows what kind of image you should expect to come out of the <code>flamegraph</code> tool for a <code>nix eval</code> run on <code>nix-darwin</code>.]]
Use the flamegraph package to render this <code>nix.profile</code> file to a SVG image:<pre>
$ flamegraph < nix.profile > nix.svg
</pre>On my system, this creates a 3.5 MiB SVG file.

Revision as of 06:34, 3 March 2026

Nix-darwin

First, run the following to get a flamegraph:

# This assumes that you've named your nix-darwin configuration
# after your hostname
nix eval --option eval-profiler flamegraph .#darwinConfigurations.$(hostname).system

You should end up with a file called nix.profile:

$ file nix.profile nix.profile: Unicode text, UTF-8 text, with very long lines (1339

Make flamegraph

This zoomed out screenshot of nix.svg shows what kind of image you should expect to come out of the flamegraph tool for a nix eval run on nix-darwin.

Use the flamegraph package to render this nix.profile file to a SVG image:

$ flamegraph < nix.profile > nix.svg

On my system, this creates a 3.5 MiB SVG file.