NixOS: Difference between revisions
imported>HLandau |
imported>HLandau |
||
Line 164: | Line 164: | ||
''See also: [[Nix vs. Linux Standard Base]]'' | ''See also: [[Nix vs. Linux Standard Base]]'' | ||
The main difference between to Linux Distribution 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 | The main difference between to Linux Distribution 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 | 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 | 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 stored beneath <code>/nix/store</code>. 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. | |||
Structuring the system in this way is how NixOS obtains its key advantages over conventional Linux distributions, such as atomicity and rollback support. Every item inside the store is the product of the evaluation of a pure function in Nix called a ''derivation'' (essentially a build). Essentially, the store is the reification of the pure, functional description of the system, which is consumed by Nix and used to generate the contents of the store. | |||
User-level environments are implemented using a large number of symbolic links to all required packages and auxiliary files. These environments are stored in <code>/nix/var/nix/profiles</code>. Each user has their own environment. | |||
=== Usage of the Nix Store === | === Usage of the Nix Store === |