nix-store
Nix-store is a command line tool that is part of the Nix package manager system. It is responsible for managing the hashed storage of all packages installed by Nix. It primarily deals with the low-level details of package management and has a range of functionalities.
One of its main functions is to store built packages in a hashed directory structure, making it efficient to reference and reuse dependencies. It allows for garbage collection, which removes unused packages from the storage to save disk space. This helps maintain a clean and efficient package environment.
Nix-store also tracks package dependencies and provides a way to query and extract package metadata, including attributes like package location, size, and dependencies. It enables users to explore and inspect their package store easily.
Additionally, the utility facilitates package installation and uninstallation. It provides options to install packages from the store and delete them when necessary. It also allows users to create isolated build environments, where packages can be temporarily installed and removed without affecting the main package store.
The tool supports various command-line options for manipulating the package store, managing the garbage collector, and viewing package information. These options enable users to perform tasks like forcing garbage collection, finding references to packages, and deleting specific package paths.
Nix-store is an essential tool for Nix users and system administrators as it offers powerful features for maintaining and interacting with package storage. It is designed to provide a robust and flexible framework for managing packages in the Nix ecosystem.
List of commands for nix-store:
-
nix-classic:tldr:8e33c nix-classic: Show all dependencies of a store path (package), in a tree format.$ nix-store --query --tree ${-nix-store----}try on your machineexplain this command
-
nix-store:tldr:098e3 nix-store: Delete a specific store path (must be unused).$ nix-store --delete ${-nix-store----}try on your machineexplain this command
-
nix-store:tldr:0d198 nix-store: Hard-link identical files together to reduce space usage.$ nix-store --optimisetry on your machineexplain this command
-
nix-store:tldr:3aedb nix-store: Collect garbage, such as removing unused paths.$ nix-store --gctry on your machineexplain this command
-
nix-store:tldr:a9220 nix-store: Show all dependents of a particular store path.$ nix-store --query --referrers ${-nix-store----}try on your machineexplain this command