Nix
Initial releaseJune 15, 2003; 20 years ago (2003-06-15)
Stable release
2.19.2[1] / November 29, 2023; 2 months ago (2023-11-29)
Repository
Written inC++
PlatformLinux, Unix-like
TypePackage management
LicenseLGPL
Websitenixos.org

Nix is a cross-platform package manager. It is built with the eponymous "Nix" programming language and employs a model in which software packages are each installed into unique directories. These directory names correspond to cryptographic hashes of the contents of each package. A package's hash takes into account all of its dependencies. This solves the potential issue of installing many packages with differing versions of same shared library dependencies, and is claimed to eliminate so-called dependency hell,[2] As a result, this package management model advertises more reliable, reproducible, and portable packages.[3][4]

Packages are defined through files containing statements in the Nix language, described as:

The Nix language is designed for conveniently creating and composing derivations – precise descriptions of how contents of existing files are used to derive new files. It is a domain-specific, purely functional, lazily evaluated, dynamically typed programming language.[5]

Dependencies are tracked directly in this language through an intermediate format called "derivations". A Nix environment keeps track of references automatically, which allows unused packages to be garbage collected 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. This also enables multiple users to safely install software on the same system without administrator privileges.

Nix has full support for Linux and macOS and can safely be installed side by side with an existing package manager.

Nix is used for software packaging and distribution in CERN's LHCb experiment.[6]

NixOS

Main article: NixOS

NixOS[7] is a Linux distribution using Nix for managing software in the system, including the Linux kernel.[8]

Nixpkgs

Nixpkgs is the package repository built upon the Nix package manager. According to Repology, as of March 2023 it contains more than 80,000 packages[9] and has a higher number of up-to-date packages than any other package repository.[10] Architectures supported by Nixpkgs are x86_64-linux, aarch64-linux, x86_64-darwin and aarch64-darwin. Packages for these architectures are regularly built, using a continuous integration service called Hydra,[11] and the results of these builds are uploaded to a public binary cache.[12] When Nix installs a package, it checks this cache and downloads the binary package to avoid building it locally.

Nixpkgs is developed in a single git repository on GitHub.[13] Beside packages, it also contains the source code for NixOS.

See also

References

  1. ^ "Release 2.15.2 · NixOS/Nix". GitHub.
  2. ^ Prins, Pjotr; Suresh, Jeeva; Dolstra, Eelco (22 December 2008). "Nix fixes dependency hell on all Linux distributions". Linux.com. Retrieved 11 July 2023.
  3. ^ Dolstra, Eelco; de Jonge, Merijn; Visser, Eelco (November 2004). "Nix: A Safe and Policy-Free System for Software Deployment" (PDF). LISA '04: Proceedings of the 18th USENIX Conference on System Administration. pp. 79–92. Retrieved 11 July 2023.
  4. ^ Dolstra, Eelco (2006). The Purely Functional Software Deployment Model (PDF) (Ph.D.). Utrecht University. Retrieved 11 July 2023.
  5. ^ "Nix language basics — nix.dev documentation".
  6. ^ Burr, Chris; Clemencic, Marco; Couturier, Ben (2018). "Software packaging and distribution for LHCb using Nix" (PDF).
  7. ^ "Nix & NixOS | Reproducible builds and deployments". nixos.org.
  8. ^ Dolstra, Eelco; Löh, Andres; Pierron, Nicolas (September 2008). NixOS: A Purely Functional Linux Distribution (PDF). ICFP 2008: 13th ACM SIGPLAN International Conference on Functional Programming. pp. 367–378.
  9. ^ "Nixpkgs unstable repository information - Repology".
  10. ^ "Repository statistics - Repology".
  11. ^ "RFC 0046 - Platform Support Tiers". GitHub.
  12. ^ "NixOS official binary cache".
  13. ^ "Nixpkgs github repository". GitHub.