nix3-why-depends
traces dependency relationships
TLDR
Show dependency path
$ nix why-depends nixpkgs#[package] nixpkgs#[dependency]
Show all paths$ nix why-depends --all nixpkgs#[package] nixpkgs#[dependency]
Show the files containing each reference$ nix why-depends --precise [.#package] nixpkgs#[dependency]
Trace a build-time dependency$ nix why-depends --derivation nixpkgs#[package] nixpkgs#[dependency]
SYNOPSIS
nix why-depends [options] package dependency
DESCRIPTION
nix3-why-depends is the manual page for nix why-depends, which shows why a package has another package in its closure. It prints a chain of store paths from package to dependency, each with a file fragment containing the reference.The tool debugs package closures and helps find and remove unnecessary runtime dependencies.
PARAMETERS
PACKAGE
Package (installable or store path) to analyze.DEPENDENCY
Dependency to trace.-a, --all
Show all paths instead of just a shortest one.--precise
Show the files in each parent that cause the dependency.--derivation
Work on store derivations to explain build-time dependencies.--help
Display help information.
INSTALL
sudo apt install nix-bin
sudo dnf install nix
sudo pacman -S nix
sudo apk add nix
sudo zypper install nix
nix profile install nixpkgs#nix
CAVEATS
There is no nix3 executable: the new-CLI man pages are named nix3-subcommand. Use man nix3-why-depends or nix why-depends --help.Requires the nix-command experimental feature (and flakes for flake references). Both paths are built or substituted first.
HISTORY
nix why-depends was added with the new nix command in Nix 2.0 (2018).
SEE ALSO
nix(1), nix-why-depends(1), nix-store(1)
