nix-why-depends
shows why a package depends on another
TLDR
SYNOPSIS
nix why-depends [options] package dependency
DESCRIPTION
nix why-depends explains why store path package has dependency in its closure. Nix detects runtime references by scanning outputs for the hash parts of store paths, so an unexpected reference (for example a compiler path left in a binary) bloats the closure.The command prints a shortest chain of references from package to dependency, and for each step a file fragment containing the reference to the next store path. With --derivation it traces build-time dependencies between .drv files instead.
PARAMETERS
PACKAGE
Installable or store path whose closure is inspected.DEPENDENCY
Installable or store path to find in that closure.-a, --all
Show all edges in the dependency graph leading from package to dependency, rather than just a shortest path.--precise
For each edge, show the files in the parent that cause the dependency.--derivation
Operate on the store derivations (build-time dependencies) rather than their outputs.--help
Display help information.
INSTALL
CAVEATS
Part of the experimental new Nix CLI: requires the nix-command experimental feature (and flakes for flake references). Both paths must be built or substituted, which may trigger downloads or builds. If there is no dependency, it only reports that package does not depend on dependency.
HISTORY
nix why-depends was added with the new nix command in Nix 2.0 (2018).
SEE ALSO
nix(1), nix-store(1), nix-build(1), nix3-why-depends(1)
