nix-tree: Interactively browse a Nix store paths dependencies

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Warnings:

A terminal curses application to browse a Nix store paths dependencies


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.1.0, 0.1.2.0, 0.1.3.0, 0.1.3.1, 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, 0.3.3, 0.4.0, 0.4.1, 0.4.1, 0.5.0
Change log CHANGELOG.md
Dependencies aeson, async, base (>=4.11 && <5), brick (>=2.1 && <2.4), bytestring, clock, containers, directory, dot, 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 https://github.com/utdemir/nix-tree
Uploaded by utdemir at 2024-04-07T10:14:43Z

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for nix-tree-0.4.1

[back to package description]

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 -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 --help
Usage: nix-tree [INSTALLABLE] [--store STORE] [--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.
  --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 text

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

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

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

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

For valid --store options, see nix help-stores. For example,

# Build in a temporary chroot store and examine the output
nix 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 run nix-shell and use cabal as usual. Please run ./format.sh before sending a PR.