Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Interactively browse dependency graphs of Nix derivations.

License

NotificationsYou must be signed in to change notification settings

utdemir/nix-tree

Repository files navigation

Build StatusPackaging status

Interactively browse dependency graphs of Nix derivations.

asciicast

Installation

nix-tree is onnixpkgs since20.09, so just use your preferred method for adding packages to your system, eg:

nix-env -iA nix-tree

Or, for flake enabled systems:

nix profile install 'nixpkgs#nix-tree'

To run the current development version:

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

Usage

$nix-tree --helpUsage: nix-tree [INSTALLABLE] [--store STORE] [--file FILE] [--version] [--derivation] [--impure] [--dot]  Interactively browse dependency graphs of Nix derivations.Available options:  INSTALLABLE              A store path or a flake reference.                           Paths default to "~/.nix-profile" and "/var/run/current-system"  --store STORE            The URL of the Nix store, e.g. "daemon" or "https://cache.nixos.org"                           See "nix help-stores" for supported store types and settings.  --file FILE              Interpret installables as attribute paths relative to the Nix expression stored in file.  --version                Show the nix-tree version  --derivation             Operate on the store derivation rather than its outputs  --impure                 Allow access to mutable paths and repositories  --dot                    Print the dependency graph in dot format  -h,--help                Show this help textKeybindings:  hjkl/Arrow Keys : Navigate  w               : Open why-depends modal  /               : Open search modal  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 itsunique transitivedependencies. In other words, the cost of having that store path on topof all other paths. Seeissue #14 for a better explanation.

Tips

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

# Output of a local derivationnix-build. --no-out-link| xargs -o nix-tree# Build time dependencies (passing a `.drv` path)nix-instantiate.| xargs -o nix-tree --derivation# Dependencies from shell.nixnix-build shell.nix -A inputDerivation| xargs -o nix-tree# All outputs of a derivation in nixpkgsnix-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 directorynix-tree --derivation'.#'# Same thing works for any flake referencenix-tree --derivation'nixpkgs#asciiquarium'

Runnix-tree on your current nixos system:

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

Runnix-tree on a flake reference of a nixosConfiguration:

nix build --print-out-paths --no-link'.#nixosConfigurations.foo.config.system.build.toplevel'nix-tree'.#nixosConfigurations.foo.config.system.build.toplevel'

Query the binary cache before download, with the--store option:

# Query the runtime dependency of `stellarium` (2 GiB closure) without downloadnixeval --raw'nixpkgs#stellarium.outPath'| xargs -o nix-tree --store https://cache.nixos.org

For valid--store options, seenix help-stores. For example,

# Build in a temporary chroot store and examine the outputnix build --store /tmp/chroot-store'nixpkgs#hello' --print-out-paths| xargs -o nix-tree --store /tmp/chroot-store

Contributing

All contributions, issues and feature requests are welcome.

To hack on it, simply runnix-shell and usecabal as usual. Please run./format.sh before sending a PR.

Related tools

  • 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 ofnix-store --query --tree
  • nix-visualize: Uses the Nix package manager to visualize the dependencies of a given package

About

Interactively browse dependency graphs of Nix derivations.

Topics

Resources

License

Stars

Watchers

Forks

Contributors13


[8]ページ先頭

©2009-2025 Movatter.jp