Nix (package manager)/en: Difference between revisions
Updating to match new version of source page |
Updating to match new version of source page Tags: Mobile edit Mobile web edit |
||
| (2 intermediate revisions by the same user not shown) | |||
| 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 [ | |||
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 other Linux distributions or on macOS, you can install Nix following the [https:// | On [[NixOS|NixOS]], Nix is automatically installed. | ||
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:// | 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]. | |||
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/ | 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|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 48: | Line 51: | ||
=== Sandboxing === | === Sandboxing === | ||
When sandbox builds are enabled, Nix will setup an isolated environment for each build process. It is used to remove further hidden dependencies set by the build environment to improve reproducibility. This includes access to the network during the build outside of <code>fetch*</code> functions and files outside the Nix store. Depending on the operating system access to other resources are blocked as well (ex. inter process communication is isolated on Linux) | When sandbox builds are enabled, Nix will setup an isolated environment for each build process. It is used to remove further hidden dependencies set by the build environment to improve reproducibility. This includes access to the network during the build outside of <code>fetch*</code> functions and files outside the Nix store. Depending on the operating system access to other resources are blocked as well (ex. inter process communication is isolated on Linux). | ||
Sandboxing is enabled by default on Linux, and disabled by default on macOS. | Sandboxing is enabled by default on Linux, and disabled by default on macOS. | ||
| Line 59: | Line 62: | ||
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:// | * [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. | ||
| Line 68: | Line 71: | ||
==Notes== | ==Notes== | ||
<references /> | <references /> | ||
[[Category:Pedias]] | [[Category:Pedias]] | ||