Nix (package manager)/en: Difference between revisions

FuzzyBot (talk | contribs)
Updating to match new version of source page
FuzzyBot (talk | contribs)
Updating to match new version of source page
Line 1: Line 1:
<languages/>
<languages/>
{{Navbox Nix}}
{{Navbox Nix}}
{{Disambiguation|message=This article is about the Nix package manager. Not to be confused with the [[Nix ecosystem]], the [[Nix (language)|Nix language]] or the [[Nix (command)|Nix command]].}}
{{Disambiguation|message=This article is about the Nix package manager. Not to be confused with the [[Nix ecosystem|Nix ecosystem]], the [[Nix (language)|Nix language]] or the [[Nix (command)|Nix command]].}}
Nix is a package manager and build system that parses reproducible build instructions specified in the [[Nix Expression Language]], a pure functional language with lazy evaluation. Nix expressions are pure functions<ref>Values cannot change during computation. Functions always produce the same output if their input does not change. </ref>taking dependencies as arguments and producing a ''[[Derivations|derivation]]'' specifying a reproducible build environment for the package. Nix stores the results of the build in unique addresses specified by a hash of the complete dependency tree, creating an immutable package store (aka the [[#Nix store|nix store]]) that allows for atomic upgrades, rollbacks and concurrent installation of different versions of a package, essentially eliminating [https://en.wikipedia.org/wiki/Dependency_hell dependency hell].  
 
Nix is a package manager and build system that parses reproducible build instructions specified in the [[Nix (language)|Nix Expression Language]], a pure functional language with lazy evaluation. Nix expressions are pure functions<ref>Values cannot change during computation. Functions always produce the same output if their input does not change.</ref> taking dependencies as arguments and producing a ''[[Derivations|derivation]]'' specifying a reproducible build environment for the package. Nix stores the results of the build in unique addresses specified by a hash of the complete dependency tree, creating an immutable package store (aka the [[#Nix store|nix store]]) that allows for atomic upgrades, rollbacks and concurrent installation of different versions of a package, essentially eliminating [[Wikipedia:Dependency hell|dependency hell]].


== Usage ==
== Usage ==


=== Installation ===
=== Installation ===
On [[NixOS]], Nix is automatically installed.
On [[NixOS|NixOS]], Nix is automatically installed.


On other Linux distributions or on macOS, you can install Nix following the [https://nixos.org/manual/nix/stable/installation/installation installation section of the Nix manual].
On other Linux distributions or on macOS, you can install Nix following the [https://nix.dev/manual/nix/stable/installation/ installation section of the Nix manual].


=== Nix commands ===
=== Nix commands ===


The [[Nix (command line utilities)|Nix commands]] are documented in the [https://nixos.org/manual/nix/stable/command-ref/command-ref Nix reference manual]: main commands, utilities and experimental commands. Prior to version 2.0 (released in February 2018) there have been different commands.
The [[Nix (command line utilities)|Nix commands]] are documented in the [https://nix.dev/manual/nix/stable/command-ref/ Nix reference manual]: main commands, utilities and experimental commands. Prior to version 2.0 (released in February 2018) there have been different commands.


=== Configuration ===
=== Configuration ===
On NixOS, Nix can be configured using the [https://search.nixos.org/options?query=nix. <code>nix</code> option].  
On NixOS, Nix can be configured using the [https://search.nixos.org/options?query=nix <code>nix</code> option].  


Standalone Nix is configured through <code>nix.conf</code> (usually found in <code>/etc/nix/</code>). Details on the available options are [https://nixos.org/manual/nix/stable/command-ref/conf-file found in the Nix reference manual].  
Standalone Nix is configured through <code>nix.conf</code> (usually found in <code>/etc/nix/</code>). Details on the available options are [https://nix.dev/manual/nix/stable/command-ref/conf-file found in the Nix reference manual].  


You can also configure Nix using [[Home Manager]], which manages declarative environments for a single user. For system-wide configuration, you can use [https://github.com/numtide/system-manager System Manager] on Linux and [https://github.com/LnL7/nix-darwin nix-darwin] on macOS.
You can also configure Nix using [[Home Manager|Home Manager]], which manages declarative environments for a single user. For system-wide configuration, you can use [https://github.com/numtide/system-manager System Manager] on Linux and [https://github.com/nix-darwin/nix-darwin nix-darwin] on macOS.


== Internals ==
== Internals ==
Line 59: Line 60:
There is an ongoing effort to reimplement Nix, from the ground up, in Rust.
There is an ongoing effort to reimplement Nix, from the ground up, in Rust.


* [https://cs.tvl.fyi/depot/-/tree/tvix tvix]
* [https://code.tvl.fyi/tree/tvix tvix]


There is also a community-led fork of Nix 2.18 named Lix, focused on correctness, usability, and growth. While it has also ported some components of Nix to Rust, it is not a ground-up rewrite like Tvix.
There is also a community-led fork of Nix 2.18 named Lix, focused on correctness, usability, and growth. While it has also ported some components of Nix to Rust, it is not a ground-up rewrite like Tvix.