LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

nix3-why-depends

traces dependency relationships

TLDR

Show dependency path
$ nix why-depends nixpkgs#[package] nixpkgs#[dependency]
copy
Show all paths
$ nix why-depends --all nixpkgs#[package] nixpkgs#[dependency]
copy
Show the files containing each reference
$ nix why-depends --precise [.#package] nixpkgs#[dependency]
copy
Trace a build-time dependency
$ nix why-depends --derivation nixpkgs#[package] nixpkgs#[dependency]
copy

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
copy
sudo dnf install nix
copy
sudo pacman -S nix
copy
sudo apk add nix
copy
sudo zypper install nix
copy
nix profile install nixpkgs#nix
copy

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

RESOURCES

Copied to clipboard
Kai