.\" -*- mode: troff; coding: utf-8 -*- .TH "nix3-why-depends" "1" "" .RS .PP \fBWarning\fR .br This program is .UR @docroot@/development/experimental-features.md#xp-feature-nix-command \fBexperimental\fR .UE and its interface is subject to change. .RE .SH Name .LP \f(CRnix why-depends\fR - show why a package has another package in its closure .SH Synopsis .LP \f(CRnix why-depends\fR [\fIoption\fR\[u2026]] \fIpackage\fR \fIdependency\fR .SH Examples .IP "\(bu" 3 Show one path through the dependency graph leading from Hello to Glibc: .LP .EX # nix why-depends nixpkgs#hello nixpkgs#glibc /nix/store/v5sv61sszx301i0x6xysaqzla09nksnd-hello-2.10 └───bin/hello: …...................../nix/store/9l06v7fc38c1x3r2iydl15ksgz0ysb82-glibc-2.32/lib/ld-linux-x86-64.… → /nix/store/9l06v7fc38c1x3r2iydl15ksgz0ysb82-glibc-2.32 .EE .IP "\(bu" 3 Show all files and paths in the dependency graph leading from Thunderbird to libX11: .LP .EX # nix why-depends --all nixpkgs#thunderbird nixpkgs#xorg.libX11 /nix/store/qfc8729nzpdln1h0hvi1ziclsl3m84sr-thunderbird-78.5.1 ├───lib/thunderbird/libxul.so: …6wrw-libxcb-1.14/lib:/nix/store/adzfjjh8w25vdr0xdx9x16ah4f5rqrw5-libX11-1.7.0/lib:/nix/store/ssf… │ → /nix/store/adzfjjh8w25vdr0xdx9x16ah4f5rqrw5-libX11-1.7.0 ├───lib/thunderbird/libxul.so: …pxyc-libXt-1.2.0/lib:/nix/store/1qj29ipxl2fyi2b13l39hdircq17gnk0-libXdamage-1.1.5/lib:/nix/store… │ → /nix/store/1qj29ipxl2fyi2b13l39hdircq17gnk0-libXdamage-1.1.5 │ ├───lib/libXdamage.so.1.1.0: …-libXfixes-5.0.3/lib:/nix/store/adzfjjh8w25vdr0xdx9x16ah4f5rqrw5-libX11-1.7.0/lib:/nix/store/9l0… │ │ → /nix/store/adzfjjh8w25vdr0xdx9x16ah4f5rqrw5-libX11-1.7.0 … .EE .IP "\(bu" 3 Show why Glibc depends on itself: .LP .EX # nix why-depends nixpkgs#glibc nixpkgs#glibc /nix/store/9df65igwjmf2wbw0gbrrgair6piqjgmi-glibc-2.31 └───lib/ld-2.31.so: …che Do not use /nix/store/9df65igwjmf2wbw0gbrrgair6piqjgmi-glibc-2.31/etc/ld.so.cache. --… → /nix/store/9df65igwjmf2wbw0gbrrgair6piqjgmi-glibc-2.31 .EE .IP "\(bu" 3 Show why Geeqie has a build-time dependency on \f(CRsystemd\fR: .LP .EX # nix why-depends --derivation nixpkgs#geeqie nixpkgs#systemd /nix/store/drrpq2fqlrbj98bmazrnww7hm1in3wgj-geeqie-1.4.drv └───/: …atch.drv\(dq,[\(dqout\(dq]),(\(dq/nix/store/qzh8dyq3lfbk3i1acbp7x9wh3il2imiv-gtk+3-3.24.21.drv\(dq,[\(dqdev\(dq]),(\(dq/… → /nix/store/qzh8dyq3lfbk3i1acbp7x9wh3il2imiv-gtk+3-3.24.21.drv └───/: …16.0.drv\(dq,[\(dqdev\(dq]),(\(dq/nix/store/8kp79fyslf3z4m3dpvlh6w46iaadz5c2-cups-2.3.3.drv\(dq,[\(dqdev\(dq]),(\(dq/nix… → /nix/store/8kp79fyslf3z4m3dpvlh6w46iaadz5c2-cups-2.3.3.drv └───/: ….3.1.drv\(dq,[\(dqout\(dq]),(\(dq/nix/store/yd3ihapyi5wbz1kjacq9dbkaq5v5hqjg-systemd-246.4.drv\(dq,[\(dqdev\(dq]),(\(dq/… → /nix/store/yd3ihapyi5wbz1kjacq9dbkaq5v5hqjg-systemd-246.4.drv .EE .SH Description .LP Nix automatically determines potential runtime dependencies between store paths by scanning for the \fIhash parts\fR of store paths. For instance, if there exists a store path \f(CR/nix/store/9df65igwjmf2wbw0gbrrgair6piqjgmi-glibc-2.31\fR, and a file inside another store path contains the string \f(CR9df65igw…\fR, then the latter store path \fIrefers\fR to the former, and thus might need it at runtime. Nix always maintains the existence of the transitive closure of a store path under the references relationship; it is therefore not possible to install a store path without having all of its references present. .PP Sometimes Nix packages end up with unexpected runtime dependencies; for instance, a reference to a compiler might accidentally end up in a binary, causing the former to be in the latter\(cqs closure. This kind of \fIclosure size bloat\fR is undesirable. .PP \f(CRnix why-depends\fR allows you to diagnose the cause of such issues. It shows why the store path \fIpackage\fR depends on the store path \fIdependency\fR, by showing a shortest sequence in the references graph from the former to the latter. Also, for each node along this path, it shows a file fragment containing a reference to the next store path in the sequence. .PP To show why derivation \fIpackage\fR has a build-time rather than runtime dependency on derivation \fIdependency\fR, use \f(CR--derivation\fR. .SH Options .IP "\(bu" 3 .UR #opt-all \f(CR--all\fR .UE / \f(CR-a\fR .IP Show all edges in the dependency graph leading from \fIpackage\fR to \fIdependency\fR, rather than just a shortest path. .IP "\(bu" 3 .UR #opt-precise \f(CR--precise\fR .UE .IP For each edge in the dependency graph, show the files in the parent that cause the dependency. .SS Common evaluation options .IP "\(bu" 3 .UR #opt-arg \f(CR--arg\fR .UE \fIname\fR \fIexpr\fR .IP Pass the value \fIexpr\fR as the argument \fIname\fR to Nix functions. .IP "\(bu" 3 .UR #opt-arg-from-file \f(CR--arg-from-file\fR .UE \fIname\fR \fIpath\fR .IP Pass the contents of file \fIpath\fR as the argument \fIname\fR to Nix functions. .IP "\(bu" 3 .UR #opt-arg-from-stdin \f(CR--arg-from-stdin\fR .UE \fIname\fR .IP Pass the contents of stdin as the argument \fIname\fR to Nix functions. .IP "\(bu" 3 .UR #opt-argstr \f(CR--argstr\fR .UE \fIname\fR \fIstring\fR .IP Pass the string \fIstring\fR as the argument \fIname\fR to Nix functions. .IP "\(bu" 3 .UR #opt-debugger \f(CR--debugger\fR .UE .IP Start an interactive environment if evaluation fails. .IP "\(bu" 3 .UR #opt-eval-store \f(CR--eval-store\fR .UE \fIstore-url\fR .IP The \c .UR @docroot@/store/types/index.md#store-url-format URL of the Nix store .UE to use for evaluation, i.e. to store derivations (\f(CR.drv\fR files) and inputs referenced by them. .IP "\(bu" 3 .UR #opt-impure \f(CR--impure\fR .UE .IP Allow access to mutable paths and repositories. .IP "\(bu" 3 .UR #opt-include \f(CR--include\fR .UE / \f(CR-I\fR \fIpath\fR .IP Add \fIpath\fR to search path entries used to resolve \c .UR @docroot@/language/constructs/lookup-path.md lookup paths .UE .IP This option may be given multiple times. .IP Paths added through \f(CR-I\fR take precedence over the \c .UR @docroot@/command-ref/conf-file.md#conf-nix-path \f(CRnix-path\fR configuration setting .UE and the \c .UR @docroot@/command-ref/env-common.md#env-NIX_PATH \f(CRNIX_PATH\fR environment variable .UE \c \&. .IP "\(bu" 3 .UR #opt-override-flake \f(CR--override-flake\fR .UE \fIoriginal-ref\fR \fIresolved-ref\fR .IP Override the flake registries, redirecting \fIoriginal-ref\fR to \fIresolved-ref\fR. .SS Common flake-related options .IP "\(bu" 3 .UR #opt-commit-lock-file \f(CR--commit-lock-file\fR .UE .IP Commit changes to the flake\(cqs lock file. .IP "\(bu" 3 .UR #opt-inputs-from \f(CR--inputs-from\fR .UE \fIflake-url\fR .IP Use the inputs of the specified flake as registry entries. .IP "\(bu" 3 .UR #opt-no-registries \f(CR--no-registries\fR .UE .IP Don\(cqt allow lookups in the flake registries. .RS .IP \fBDEPRECATED\fR .IP Use \c .UR #opt-no-use-registries \f(CR--no-use-registries\fR .UE instead. .RE .IP "\(bu" 3 .UR #opt-no-update-lock-file \f(CR--no-update-lock-file\fR .UE .IP Do not allow any updates to the flake\(cqs lock file. .IP "\(bu" 3 .UR #opt-no-write-lock-file \f(CR--no-write-lock-file\fR .UE .IP Do not write the flake\(cqs newly generated lock file. .IP "\(bu" 3 .UR #opt-output-lock-file \f(CR--output-lock-file\fR .UE \fIflake-lock-path\fR .IP Write the given lock file instead of \f(CRflake.lock\fR within the top-level flake. .IP "\(bu" 3 .UR #opt-override-input \f(CR--override-input\fR .UE \fIinput-path\fR \fIflake-url\fR .IP Override a specific flake input (e.g. \f(CRdwarffs/nixpkgs\fR). This implies \f(CR--no-write-lock-file\fR. .IP "\(bu" 3 .UR #opt-recreate-lock-file \f(CR--recreate-lock-file\fR .UE .IP Recreate the flake\(cqs lock file from scratch. .RS .IP \fBDEPRECATED\fR .IP Use \c .UR @docroot@/command-ref/new-cli/nix3-flake-update.md \f(CRnix flake update\fR .UE instead. .RE .IP "\(bu" 3 .UR #opt-reference-lock-file \f(CR--reference-lock-file\fR .UE \fIflake-lock-path\fR .IP Read the given lock file instead of \f(CRflake.lock\fR within the top-level flake. .IP "\(bu" 3 .UR #opt-update-input \f(CR--update-input\fR .UE \fIinput-path\fR .IP Update a specific flake input (ignoring its previous entry in the lock file). .RS .IP \fBDEPRECATED\fR .IP Use \c .UR @docroot@/command-ref/new-cli/nix3-flake-update.md \f(CRnix flake update\fR .UE instead. .RE .SS Logging-related options .IP "\(bu" 3 .UR #opt-debug \f(CR--debug\fR .UE .IP Set the logging verbosity level to \(oqdebug\(cq. .IP "\(bu" 3 .UR #opt-log-format \f(CR--log-format\fR .UE \fIformat\fR .IP Set the format of log output; one of \f(CRraw\fR, \f(CRinternal-json\fR, \f(CRbar\fR or \f(CRbar-with-logs\fR. .IP "\(bu" 3 .UR #opt-print-build-logs \f(CR--print-build-logs\fR .UE / \f(CR-L\fR .IP Print full build logs on standard error. .IP "\(bu" 3 .UR #opt-quiet \f(CR--quiet\fR .UE .IP Decrease the logging verbosity level. .IP "\(bu" 3 .UR #opt-verbose \f(CR--verbose\fR .UE / \f(CR-v\fR .IP Increase the logging verbosity level. .SS Miscellaneous global options .IP "\(bu" 3 .UR #opt-help \f(CR--help\fR .UE .IP Show usage information. .IP "\(bu" 3 .UR #opt-offline \f(CR--offline\fR .UE .IP Disable substituters and consider all previously downloaded files up-to-date. .IP "\(bu" 3 .UR #opt-option \f(CR--option\fR .UE \fIname\fR \fIvalue\fR .IP Set the Nix configuration setting \fIname\fR to \fIvalue\fR (overriding \f(CRnix.conf\fR). .IP "\(bu" 3 .UR #opt-refresh \f(CR--refresh\fR .UE .IP Consider all previously downloaded files out-of-date. .IP "\(bu" 3 .UR #opt-repair \f(CR--repair\fR .UE .IP During evaluation, rewrite missing or corrupted files in the Nix store. During building, rebuild missing or corrupted store paths. .IP "\(bu" 3 .UR #opt-version \f(CR--version\fR .UE .IP Show version information. .SS Options that change the interpretation of \fBinstallables\fR .IP "\(bu" 3 .UR #opt-derivation \f(CR--derivation\fR .UE .IP Operate on the \c .UR @docroot@/glossary.md#gloss-store-derivation store derivation .UE rather than its outputs. .IP "\(bu" 3 .UR #opt-expr \f(CR--expr\fR .UE \fIexpr\fR .IP Interpret \c .UR @docroot@/command-ref/new-cli/nix.md#installables \fIinstallables\fR .UE as attribute paths relative to the Nix expression \fIexpr\fR. .IP "\(bu" 3 .UR #opt-file \f(CR--file\fR .UE / \f(CR-f\fR \fIfile\fR .IP Interpret \c .UR @docroot@/command-ref/new-cli/nix.md#installables \fIinstallables\fR .UE as attribute paths relative to the Nix expression stored in \fIfile\fR. If \fIfile\fR is the character -, then a Nix expression will be read from standard input. Implies \f(CR--impure\fR. .RS .LP \fBNote\fR .PP See \c .UR @docroot@/command-ref/conf-file.md#command-line-flags \f(CRman nix.conf\fR .UE for overriding configuration settings with command line flags. .RE