Nix (package manager)

Nix is a cross-platform package manager for Unix and Unix-like systems, with its own functional programming language used to configure those systems.

Uses your system voice; voice and rate in settings.

Snapshot

≈ 2 min read

Names in other languages

No names in other languages are held for this entry yet.

Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.

Nix is a cross-platform package manager for Unix and Unix-like systems, with its own functional programming language used to configure those systems. Nix was developed in 2003 by Eelco Dolstra.

Implementation

Package recipes for Nix are written in the purpose-built "Nix language", a declarative, purely functional, lazily evaluated, dynamically typed programming language. Distinguishing features of the Nix language are strings with "context", string interpolation, first-class file system paths, and "indented strings", which in combination allow concisely expressing dependencies between file system data when specifying the contents of new files.

Dependencies between files, as declared in the Nix language, are automatically tracked and persisted in the "Nix store". New files in the Nix store are created through "derivations". A derivation is a persistent data structure that specifies an executable, arguments and environment variables for its invocation (see execve ), and other files to be read from the Nix store.

The executable is then run in a sandbox that prohibits access to anything but the explicitly specified input files and only allows writing to the designated output path. Nix preserves dependency information in output files by scanning for the distinctive hashes used for package directory names.

Automatic reference tracking ensures integrity of packages, even when they are transferred across machines. It also enables garbage collection of unused packages when no other package depends on them. At the cost of greater storage requirements, all upgrades in Nix are guaranteed to be both atomic and capable of efficient rollback.

Unique directory names allow installing many packages with differing versions of shared libraries, and is claimed to eliminate so-called dependency hell. This also lets multiple users safely install software on the same system without administrator privileges. As a result, the Nix package management and deployment model advertises more reliable, reproducible, and portable packages.

Nix has full support for Linux, macOS, and WSL, and can safely be installed side-by-side with another package manager.

See also

GNU Guix: another declarative package manager, and early clone of Nix, using GNU Guile for configuration and customization Maak: a build automation utility similar to make, and early precursor to Nix Runbook automation

Discussion among developers on the Debian mailing list (2008)

Text derived from https://en.wikipedia.org/w/index.php?oldid=1375162858 under CC BY-SA 4.0; modifications have been made.

Sources cited in this revision

26 named source(s) extracted from the cited revision. A source with no author is shown by its publication; nothing is invented.