Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nix-du

An ncdu-like terminal UI for exploring Nix store derivation sizes.

nix-du demo

Features

  • 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, h to 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.

Requirements

  • 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+)

Usage

Run it directly from GitHub without cloning:

nix run github:arsfeld/nix-du

Or, from a checkout of this repo:

nix run

Or build the binary and run it:

nix build        # produces ./result/bin/nix-du
./result/bin/nix-du

With Cargo:

cargo run --release

Browse a specific store path's references instead of the derivation index:

cargo run --release -- /nix/store/…-firefox.drv

For a development shell with rustc, cargo, clippy, and rustfmt:

nix develop

Reading the list

Each 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

Keys

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

Notes

  • 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.

License

MIT

About

ncdu-like TUI for exploring Nix store derivation sizes

Resources

Stars

14 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages