LinuxCommandLibrary

nix-store

manages the Nix store

TLDR

Query package dependencies

$ nix-store -q --references [/nix/store/...path]
copy
Query reverse dependencies
$ nix-store -q --referrers [/nix/store/...path]
copy
Show dependency tree
$ nix-store -q --tree [/nix/store/...path]
copy
Garbage collect
$ nix-store --gc
copy
Optimize store
$ nix-store --optimise
copy
Verify store integrity
$ nix-store --verify --check-contents
copy

SYNOPSIS

nix-store operation [options] [paths...]

DESCRIPTION

nix-store manages the Nix store (/nix/store). It handles garbage collection, optimization, queries, and store maintenance operations.
The Nix store contains all packages and their dependencies as immutable paths.

PARAMETERS

-q, --query

Query mode.
--gc
Garbage collect.
--optimise
Deduplicate store.
--verify
Verify store integrity.
--references
Show dependencies.
--referrers
Show reverse dependencies.
--tree
Show dependency tree.
--delete
Delete paths.

STORE LAYOUT

$ /nix/store/
├── hash-name/           # Package paths
├── hash-name.drv        # Derivations
└── .links/              # Hard link pool
copy

CAVEATS

Don't manually modify /nix/store. Garbage collection only removes unreferenced paths. Optimization uses hard links.

HISTORY

nix-store is a core Nix tool, providing low-level access to the Nix store since the project's inception.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community