Interactively browse dependency graphs of Nix derivations.
Go to file
2021-05-02 00:42:17 +12:00
.github/workflows ci: Add macos and update Nix version 2021-03-29 19:46:42 +13:00
src Reduce the time tick frequency to reduce idle CPU time 2021-05-02 00:42:17 +12:00
test Don't hardcode '/nix/store', instead query at startup 2021-03-10 22:30:56 +13:00
.envrc Replace lorri 2021-03-27 13:06:17 +13:00
.ghci Initial commit 2020-06-25 10:41:28 +12:00
.gitignore Initial commit 2020-06-25 10:41:28 +12:00
asciicast.sh Update asciicast 2021-02-28 00:12:41 +13:00
CHANGELOG.md Reduce the time tick frequency to reduce idle CPU time 2021-05-02 00:42:17 +12:00
default.nix Add a shell.nix and default.nix using flake-compat 2020-11-27 11:11:19 +13:00
flake.lock Update sources 2021-03-17 11:17:24 +13:00
flake.nix Add haskell-language-server to dev dependencies 2021-03-30 19:40:39 +13:00
format.sh Fix format.sh script 2021-02-23 16:01:56 +13:00
LICENSE Add LICENSE 2020-12-22 10:52:02 +13:00
nix-tree.cabal Release 0.1.7 2021-03-28 13:13:37 +13:00
README.md Update README.md 2021-04-06 19:53:41 +12:00
shell.nix Add a shell.nix and default.nix using flake-compat 2020-11-27 11:11:19 +13:00

nix-tree

Build Status Packaging status

Interactively browse dependency graphs of Nix derivations.

asciicast

Installation

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:

  • With flakes:
nix run github:utdemir/nix-tree
  • Without flakes:
nix-shell -I nix-tree=https://github.com/utdemir/nix-tree/archive/refs/heads/main.zip -p '(import <nix-tree>).default'  

Usage

$ nix-tree --help
Usage: nix-tree [paths...] [-h|--help] [--version]
  Paths default to $HOME/.nix-profile and /var/run/current-system.
Keybindings:
  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

Glossary

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

Tips

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 --no-out-link | xargs -o nix-tree

# 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

Contributing

All contributions, issues and feature requests are welcome.

To hack on it, simply run nix-shell (or nix develop) and use cabal as usual. Please run ./format.sh before sending a PR.