2020-07-02 11:55:56 +03:00
|
|
|
# nix-tree
|
2020-06-25 01:47:16 +03:00
|
|
|
|
2020-07-02 12:12:51 +03:00
|
|
|
![Build Status](https://github.com/utdemir/nix-tree/workflows/nix-build/badge.svg)
|
2020-09-15 01:34:51 +03:00
|
|
|
[![Packaging status](https://repology.org/badge/vertical-allrepos/haskell:nix-tree.svg)](https://repology.org/project/haskell:nix-tree/versions)
|
2020-07-02 12:12:51 +03:00
|
|
|
|
2021-04-06 10:53:41 +03:00
|
|
|
Interactively browse dependency graphs of Nix derivations.
|
2020-06-29 13:53:45 +03:00
|
|
|
|
2021-03-01 11:10:50 +03:00
|
|
|
[![asciicast](https://asciinema.org/a/cnilbmPXW51g97hdNJZcM5F6h.svg)](https://asciinema.org/a/cnilbmPXW51g97hdNJZcM5F6h)
|
2020-06-29 13:53:45 +03:00
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
2021-04-05 08:04:53 +03:00
|
|
|
`nix-tree` is on `nixpkgs` since `20.09`, so just use your preferred method for adding packages to your system, eg:
|
2020-07-29 04:01:19 +03:00
|
|
|
|
|
|
|
```
|
2020-11-01 23:32:31 +03:00
|
|
|
nix-env -i nix-tree
|
2020-07-29 04:01:19 +03:00
|
|
|
```
|
|
|
|
|
2022-11-26 02:03:36 +03:00
|
|
|
To run the current development version (you might need to pass `--experimental-options flakes`):
|
2021-06-17 01:55:07 +03:00
|
|
|
|
|
|
|
```
|
|
|
|
nix run github:utdemir/nix-tree
|
|
|
|
```
|
|
|
|
|
2020-06-29 13:53:45 +03:00
|
|
|
## Usage
|
|
|
|
|
2020-06-25 01:47:16 +03:00
|
|
|
```
|
2020-07-02 11:55:56 +03:00
|
|
|
$ nix-tree --help
|
2022-11-19 05:42:28 +03:00
|
|
|
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
|
|
|
|
outputs.
|
|
|
|
INSTALLABLE A store path or a flake reference. Paths default to
|
|
|
|
"~/.nix-profile" and "/var/run/current-system".
|
|
|
|
-h,--help Show this help text
|
|
|
|
|
2020-07-01 09:34:37 +03:00
|
|
|
Keybindings:
|
|
|
|
hjkl/Arrow Keys : Navigate
|
|
|
|
w : Open why-depends mode
|
2020-08-22 13:37:06 +03:00
|
|
|
/ : Open search mode
|
2021-02-27 06:55:57 +03:00
|
|
|
s : Change sort order
|
2021-03-28 03:09:22 +03:00
|
|
|
y : Yank selected path to clipboard
|
2020-07-01 09:34:37 +03:00
|
|
|
? : Show help
|
2022-11-19 05:42:28 +03:00
|
|
|
q/Esc : Quit / close modal
|
2020-06-25 01:47:16 +03:00
|
|
|
```
|
2020-07-02 00:24:45 +03:00
|
|
|
|
2021-02-27 06:55:57 +03:00
|
|
|
### 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.
|
|
|
|
|
|
|
|
[issue #14]: https://github.com/utdemir/nix-tree/issues/14
|
2020-07-02 10:55:36 +03:00
|
|
|
|
2020-12-22 00:58:27 +03:00
|
|
|
### Tips
|
|
|
|
|
|
|
|
`nix-build` prints built paths to stdout, which can be piped conveniently
|
|
|
|
with `| xargs -o nix-tree`. Examples:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
# 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
|
|
|
|
```
|
|
|
|
|
2021-04-05 08:04:53 +03:00
|
|
|
## Contributing
|
2020-11-01 23:32:31 +03:00
|
|
|
|
|
|
|
All contributions, issues and feature requests are welcome.
|
|
|
|
|
2021-05-05 14:51:34 +03:00
|
|
|
To hack on it, simply run `nix-shell` and use `cabal` as usual. Please run `./format.sh` before sending a PR.
|
2020-11-01 23:32:31 +03:00
|
|
|
|
2021-04-05 08:04:53 +03:00
|
|
|
## Related tools
|
2020-07-02 10:55:36 +03:00
|
|
|
|
|
|
|
* [nix-du](https://github.com/symphorien/nix-du)
|
2020-07-02 11:55:56 +03:00
|
|
|
* [nix-query-tree-viewer](https://github.com/cdepillabout/nix-query-tree-viewer)
|
|
|
|
* [nix-visualize](https://github.com/craigmbooth/nix-visualize)
|