nix-tree: Interactively browse a Nix store paths dependencies

[ bsd3, language.nix, program ] [ Propose Tags ]

A terminal curses application to browse a Nix store paths dependencies

[Skip to Readme]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Versions [RSS],,,,, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.2.0, 0.2.1, 0.3.0, 0.3.1, 0.3.2
Change log
Dependencies aeson, async, base (>=4.11 && <5), brick (>=1 && <2), bytestring, clock, containers, directory, filepath, hrfsize, microlens, optparse-applicative, relude, terminal-progress-bar, text, typed-process, unordered-containers, vty [details]
License BSD-3-Clause
Copyright Utku Demir
Author Utku Demir
Maintainer Utku Demir
Category Language.Nix
Home page
Uploaded by utdemir at 2023-11-28T01:41:51Z
Distributions NixOS:0.3.1
Executables nix-tree
Downloads 1802 total (5 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2023-11-28 [all 2 reports]

Readme for nix-tree-0.3.2

[back to package description]


Build Status Packaging status

Interactively browse dependency graphs of Nix derivations.



nix-tree is on nixpkgs since 20.09, so just use your preferred method for adding packages to your system, eg:

nix-env -i nix-tree

To run the current development version:

nix run github:utdemir/nix-tree -- --help


$ nix-tree --help
Usage: nix-tree [--version] [--derivation] [INSTALLABLE]
  Interactively browse dependency graphs of Nix derivations.

Available options:
  --version                Show the nix-tree version.
  --derivation             Operate on the store derivation rather than its
  INSTALLABLE              A store path or a flake reference. Paths default to
                           "~/.nix-profile" and "/var/run/current-system".
  -h,--help                Show this help text

  hjkl/Arrow Keys : Navigate
  w               : Open why-depends mode
  /               : Open search mode
  s               : Change sort order
  y               : Yank selected path to clipboard
  ?               : Show help
  q/Esc           : Quit / close modal


  • NAR Size: Size of the store path itself.
  • Closure size: Total size of the store path and all its transitive dependencies.
  • Added size: Size of the store path, and all its unique transitive dependencies. In other words, the cost of having that store path on top of all other paths. See issue #14 for a better explanation.


nix-build prints built paths to stdout, which can be piped conveniently with | xargs -o nix-tree. Examples:

# Output of a local derivation
nix-build . --no-out-link | xargs -o nix-tree

# Build time dependencies (passing a `.drv` path)
nix-instantiate -r | xargs -o nix-tree --derivation

# Dependencies from shell.nix
nix-build shell.nix -A inputDerivation | xargs -o nix-tree

# All outputs of a derivation in nixpkgs:
nix-build '<nixpkgs>' -A openssl.all --no-out-link | xargs -o nix-tree

nix-tree also supports flake references:

# Build time dependencies of a flake on the current directory
nix-tree --derivation '.#'

# Same thing works for any flake reference
nix-tree --derivation 'nixpkgs#asciiquarium'

Run nix-tree on your current nixos system:

nix-tree /nix/var/nix/profiles/system


All contributions, issues and feature requests are welcome.

To hack on it, simply run nix-shell and use cabal as usual. Please run ./ before sending a PR.

  • nix-du: Visualise which gc-roots to delete to free some space in your nix store
  • nix-melt: A ranger-like flake.lock viewer
  • nix-query-tree-viewer: GTK viewer for the output of nix-store --query --tree
  • nix-visualize: Uses the Nix package manager to visualize the dependencies of a given package