NixOS: Difference between revisions
imported>Ixxie m Converted examples in modules section to the file template. |
imported>Ixxie Rename Nix links. |
||
Line 1: | Line 1: | ||
[https://nixos.org/ NixOS] is a Linux distribution based on the [[Nix | [https://nixos.org/ NixOS] is a Linux distribution based on the [[Nix]] package manager and build system. It supports reproducible and declarative system-wide configuration management as well as atomic upgrades and rollbacks, although it can additionally support imperative package and user management. In NixOS, all components of the distribution — including the kernel, installed packages and system configuration files — are built by [[Nix]] from [[Wikipedia:Pure function|purely functions]] called [[Nix Expression Language|Nix expressions]]. | ||
Since Nix uses binary caching, this provides a unique compromise between the binary-oriented approach used by distributions such as Debian and the source-oriented approach used by distributions such as Gentoo. Binaries can be used for standard components, and custom-built packages and modules can be used automatically when a prebuilt binary is not available. | Since Nix uses binary caching, this provides a unique compromise between the binary-oriented approach used by distributions such as Debian and the source-oriented approach used by distributions such as Gentoo. Binaries can be used for standard components, and custom-built packages and modules can be used automatically when a prebuilt binary is not available. | ||
Line 94: | Line 94: | ||
==== User Environments ==== | ==== User Environments ==== | ||
In addition to declarative system configuration, NixOS users can utilize Nix's imperative <code>nix-env</code> command to install packages at the user level, without changing the system state. See the [[Nix | In addition to declarative system configuration, NixOS users can utilize Nix's imperative <code>nix-env</code> command to install packages at the user level, without changing the system state. See the [[Nix#User Environments| user environments section of the Nix article]] for more information. | ||
==== Channels ==== | ==== Channels ==== | ||
Line 134: | Line 134: | ||
The main difference between NixOS and other Linux distributions is that NixOS does not follow the [https://en.wikipedia.org/wiki/Linux_Standard_Base Linux Standard Base] file system structure. On LSB-compliant systems software is stored under <code>/{,usr}/{bin,lib,share}</code> and configuration is generally stored in <code>/etc</code>. Software binaries are available in the user environment if they are placed in one of the LSB's <code>/bin</code> directories. When a program references dynamic libraries it will search for the required libraries in the LSB folders (<code>/lib</code>, <code>/usr/lib</code>). | The main difference between NixOS and other Linux distributions is that NixOS does not follow the [https://en.wikipedia.org/wiki/Linux_Standard_Base Linux Standard Base] file system structure. On LSB-compliant systems software is stored under <code>/{,usr}/{bin,lib,share}</code> and configuration is generally stored in <code>/etc</code>. Software binaries are available in the user environment if they are placed in one of the LSB's <code>/bin</code> directories. When a program references dynamic libraries it will search for the required libraries in the LSB folders (<code>/lib</code>, <code>/usr/lib</code>). | ||
In NixOS however <code>/lib</code> and <code>/usr/lib</code> do not exist. Instead all system libraries, binaries, kernels, firmware and configuration files are placed in the [[Nix | In NixOS however <code>/lib</code> and <code>/usr/lib</code> do not exist. Instead all system libraries, binaries, kernels, firmware and configuration files are placed in the [[Nix#Nix store|Nix store]]. The files and directories in <code>/nix/store</code> are named by hashes of the information describing the built data. All of the files and directories placed in the Nix store are immutable. <code>/bin</code> and <code>/usr/bin</code> are almost absent: they contain only <code>/bin/sh</code> and <code>/usr/bin/env</code> respectively, to provide minimal compatibility with existing scripts using shebang lines. User-level environments are implemented using a large number of symbolic links to all required packages and auxiliary files. These environments are called [[Nix#Profiles|profiles]] and are stored in <code>/nix/var/nix/profiles</code>, each user having their own profiles. Structuring the system in this way is how NixOS obtains its key advantages over conventional Linux distributions, such as atomicity and rollback support. | ||
=== Usage of the Nix store === | === Usage of the Nix store === |