An ncdu-like terminal UI for exploring Nix store derivation sizes.
- Fast analysis: reads the Nix store SQLite database (
/nix/var/nix/db/db.sqlite) directly, then computes closure sizes in memory - ncdu-style navigation: arrow keys or
hjkl, enter to drill into references,hto go back - Derivation index: top-level groups by package name prefix (e.g.
python3,linux,source) - Sortable: by closure size (
s) or name (n) - Visual bars: optional relative size graph (
g)
Sizes are NAR closure sizes — the serialized size of a path plus everything it references.
- A local Nix store with a readable
/nix/var/nix/db/db.sqlite(the default on NixOS and multi-user installs) - A Rust toolchain (1.74+)
Run it directly from GitHub without cloning:
nix run github:arsfeld/nix-duOr, from a checkout of this repo:
nix runOr build the binary and run it:
nix build # produces ./result/bin/nix-du
./result/bin/nix-duWith Cargo:
cargo run --releaseBrowse a specific store path's references instead of the derivation index:
cargo run --release -- /nix/store/…-firefox.drvFor a development shell with rustc, cargo, clippy, and rustfmt:
nix developEach row shows the closure size, a relative size bar, the percentage of the current view's total, a reference count, and the entry name. The leading marker indicates the entry type:
| Marker | Meaning |
|---|---|
/ |
A name group (drill in to see its derivations) |
D |
A derivation (drill in to see its references) |
|
A plain store path |
| Key | Action |
|---|---|
↑ ↓ / j k |
Move selection |
PgUp PgDn |
Move selection by 10 |
Home End |
Jump to first / last entry |
Enter / l / → |
Open group, derivation, or references |
h / ← / Backspace |
Go to parent |
s |
Sort by size (toggle asc/desc) |
n |
Sort by name (toggle asc/desc) |
g |
Toggle size bar |
c |
Toggle reference counts |
? |
Help |
q / Esc / Ctrl-C |
Quit |
- The initial scan reads the store database directly and is fast — a few seconds even on large stores.
- The database is opened read-only; nix-du never writes to it.
- Group totals sum derivation closure sizes and may double-count shared dependencies.
- Only paths present in the local store are included.
MIT