Interactively browse dependency graphs of Nix derivations.
Go to file
2022-10-24 16:59:12 +13:00
.github/workflows Shorter PR body 2022-10-24 16:59:12 +13:00
src Fix formatting 2022-10-24 11:52:24 +13:00
test Delete duplicate file 2021-09-04 22:23:12 +12:00
.gitignore Stop using flakes 2021-05-05 23:51:34 +12:00
asciicast.sh Update asciicast 2021-02-28 00:12:41 +13:00
CHANGELOG.md Release v0.2.0 2022-01-02 13:30:55 +13:00
default.nix Move to a flake-based setup 2022-10-24 11:52:14 +13:00
flake.lock Move to a flake-based setup 2022-10-24 11:52:14 +13:00
flake.nix Add ability to check formatting 2022-10-24 12:25:49 +13:00
format.sh Add ability to check formatting 2022-10-24 12:25:49 +13:00
LICENSE Add LICENSE 2020-12-22 10:52:02 +13:00
nix-tree.cabal Release v0.2.0 2022-01-02 13:30:55 +13:00
README.md Re-introduce flake support 2021-06-17 10:55:39 +12:00
shell.nix Move to a flake-based setup 2022-10-24 11:52:14 +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:

nix-shell -p '(import (builtins.fetchTarball "https://github.com/utdemir/nix-tree/archive/main.tar.gz") {}).nix-tree' --run nix-tree

Or, if you use a Nix version with flake support:

nix run github:utdemir/nix-tree

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 and use cabal as usual. Please run ./format.sh before sending a PR.