NixOS

Last updated
NixOS
NixOS logo.svg
Developer NixOS contributors
NixOS Foundation [1] [2]
Written in Nix expression language [note 1]
OS family Linux (Unix-like)
Working stateCurrent
Source model Open source
Initial release0.1 / June 3, 2003;20 years ago (2003-06-03)
Latest release 23.11 [3] / November 29, 2023;4 months ago (2023-11-29)
Repository
Marketing targetGeneral purpose
Package manager Nix
Platforms i686, x86-64, AArch64
Kernel type Monolithic (Linux kernel)
License MIT [4] [note 2]
Official website nixos.org

NixOS is a free and open source Linux distribution based on the Nix package manager. NixOS uses an immutable design and an atomic update model. [5] Its use of a declarative configuration system allows reproducibility and portability. [6]

Contents

NixOS is configured using composable modules, and relies on packages defined in the Nixpkgs project. Package recipes and configurations are written in the purpose-built "Nix language" that ships with the Nix package manager.

History

In 2003, Eelco Dolstra started Nix as a research project. [7] [8] Dolstra says that the purpose of the project was to achieve a system for correct software deployment. [9] His influences included Eelco Visser, who had supervised his PhD at Utrecht University. [10] In 2006, Armijn Hemel presented NixOS as the result of his Master's thesis at Utrecht. [11]

In 2015, the NixOS Foundation was founded in the Netherlands, aiming to support projects like NixOS that implement the purely functional deployment model. [12]

Versions

Release version history

NameDate
NixOS 13.10 "Aardvark"October 2013
NixOS 14.04 "Baboon"April 2014
NixOS 14.12 "Caterpillar"December 2014
NixOS 15.09 "Dingo"September 2015
NixOS 16.03 "Emu"March 2016
NixOS 16.09 "Flounder"September 2016
NixOS 17.03 "Gorilla"March 2017
NixOS 17.09 "Hummingbird"September 2017
NixOS 18.03 "Impala"March 2018
NixOS 18.09 "Jellyfish"September 2018
NixOS 19.03 "Koi"March 2019
NixOS 19.09 "Loris"September 2019
NixOS 20.03 "Markhor"March 2020
NixOS 20.09 "Nightingale"September 2020
NixOS 21.05 "Okapi"May 2021
NixOS 21.11 "Porcupine"November 2021
NixOS 22.05 "Quokka"May 2022
NixOS 22.11 "Raccoon"November 2022
NixOS 23.05 "Stoat"May 2023
NixOS 23.11 "Tapir"November 2023

NixOS publishes stable releases twice a year, around the end of May and the end of November. [13] [14] [15]

Features

NixOS graphical installer Nixos-installer.png
NixOS graphical installer

Declarative configuration model

In NixOS, the entire operating system—including the kernel, applications, system packages, and configuration files—is built by the Nix package manager from a description in the Nix language. Building a new version will not overwrite previous versions. [16]

A NixOS system is configured by writing a specification of the functionality that the user wants on their machine in a global configuration file (typically located in /etc/nixos). The following is a minimal specification of a machine running an SSH daemon: [17]

{   boot.loader.grub.device="/dev/sda";   fileSystems."/".device="/dev/sda1";   services.sshd.enable=true;}

After changing the specification file, the system can be updated using the nixos-rebuild command. This does everything necessary to create the new version of the system, including downloading and installing packages, and generating configuration files.

Reliable and atomic upgrades

Since Nix files are pure and declarative, evaluating them will always produce the same result, regardless of what packages or configuration files are on the system.

NixOS has a transactional approach to configuration management, making configuration changes such as upgrades atomic. For example, if an upgrade to a new configuration is interrupted by power failure, the system will still be in a consistent state: it will either boot in the old or the new configuration. [18]

Rollbacks

If, after a system update, the new configuration is undesirable, it can be rolled back using a special command (nixos-rebuild switch --rollback). Every system configuration version automatically shows up in the system boot menu. If the new configuration crashes or does not boot properly, an older version can be selected. Rollbacks are lightweight operations that do not involve files being restored from copies. [19]

Reproducible system configurations

NixOS's declarative configuration model makes it easy to reproduce a system configuration on another machine. Copying the configuration file to the target machine and running the system update command generates the same system configuration (kernel, applications, system services, and so on) except for parts of the system not managed by the package manager, such as user data.

Source-based model with binary cache

The Nix build language used by NixOS specifies how to build packages from source. This makes it easy to adapt the system to user needs. However, building from source being a slow process, the package manager automatically downloads pre-built binaries from a cache server when they are available. It is possible to disable the binary cache and force building from source by using --option substitute false as an argument. This gives the flexibility of a source-based package management model, with the efficiency of a binary model. [20]

Consistency

The Nix package manager ensures that the running system is consistent with the logical specification of the system, meaning that it will rebuild all packages that need to be rebuilt. For instance, if the kernel is changed, then the package manager will ensure that external kernel modules will be rebuilt. Similarly, when a library is updated, it ensures that all the system packages use the new version, even packages statically linked to it.

Multi-user package management

There is no need for special privileges to install software in NixOS. In addition to the system-wide profile, every user has a dedicated profile in which they can install packages. Nix also allows multiple versions of a package to coexist, so different users can have different versions of the same package installed in their respective profiles. If two users install the same version of a package, only one copy will be built or downloaded. Nix's security model ensures that this is secure, because only the users explicitly trusted by the system configuration are allowed to use build parameters that would allow them to control the content of a derivation's output (such as adding impurities to the sandbox, or using an untrusted substituter).[ clarification needed ] Without those parameters, paths can only be substituted from a substituter trusted by the system, or a local sandboxed build which is implicitly trusted.

Implementation

NixOS is based on the Nix package manager, which stores all packages in isolation from each other in the package store.

Installed packages are identified by a cryptographic hash of all input used for their build. Changing the build instructions of a package modifies its hash, and that will result in a different package being installed in the package store. This system is also used to manage configuration files, ensuring that newer configurations do not overwrite older ones.

An implication of this is that NixOS does not follow the Filesystem Hierarchy Standard. The only exceptions are that a /bin/sh symlink is created to the version of bash in the Nix store (e.g. /nix/store/s/5rnfzla9kcx4mj5zdc7nlnv8na1najvg-bash-4.3.43/), and while NixOS does have an /etc directory to keep system-wide configuration files, most files in that directory are symlinks to generated files in /nix/store, such as /nix/store/s2sjbl85xnrc18rl4fhn56irkxqxyk4p-sshd_config. Not using global directories such as /bin is part of what allows multiple versions of a package to coexist.

Reception

Jesse Smith, reviewing NixOS 15.09 for DistroWatch Weekly in 2015, [21] wrote:

I very much like the way NixOS takes the worry out of upgrading packages by placing each change in its own "generation" and I found, from the end user's point of view, NixOS worked just the same as any other Linux distribution. Setting up NixOS is not for beginners, and I do not think NixOS is intended to be used as a general purpose desktop operating system. But what NixOS does do is give us a useful playground in which to examine the Nix package manager and I think this is very interesting technology which deserves further exploration and adoption by additional distributions.

A 2022 review of NixOS 21.11 "Porcupine" in Full Circle magazine concluded:

Overall NixOS Gnome 21.11 impresses as serious, neat and elegant. If you are a fan of the unmodified Gnome desktop, then you will find a lot to like here. The downside of this distribution is the steep learning curve for package management, including updates and the like. No matter which distribution you come from, you will have much to learn to be able to make Nix work well for you on the command-line. [22]

NixOS 22.11 "Raccoon" reviewed by Liam Proven at The Register:

Compared to reports of NixOS from just two or three years ago, we found it was very simple to get it installed and working. This suggests that the tools are maturing well and reaching a certain level of polish, but from a first-time perspective we have no prior baseline to compare against. This is very much not a traditional distro, or even a traditional Unix, but it works and we can see the appeal. [23]

NixOS 23.11 "Tapir" reviewed by Jesse Smith at DistroWatch:

NixOS is a rare gem in that I don't think I ran into any errors while I was using it. The distribution was stable, it worked well with my hardware, and I didn't run into a single issue while running it. I feel NixOS is well worth a try, especially if you're a system administrator and want to deploy (or maintain) identical distributions across multiple machines [24]

Notes

  1. Various other programming languages are used throughout NixOS (as of December 2023).
  2. Various other licenses are used for software included with NixOS, for example the Linux kernel is licensed under the GNU GPL version 2.0 (as of December 2023)

See also

Related Research Articles

<span class="mw-page-title-main">Linux distribution</span> Operating system based on the Linux kernel

A Linux distribution is an operating system made from a software collection that includes the Linux kernel and often a package management system. Linux users usually obtain their operating system by downloading one of the Linux distributions, which are available for a wide variety of systems ranging from embedded devices and personal computers to powerful supercomputers.

<span class="mw-page-title-main">Package manager</span> Software tools for handling software packages

A package manager or package-management system is a collection of software tools that automates the process of installing, upgrading, configuring, and removing computer programs for a computer in a consistent manner.

<span class="mw-page-title-main">GoboLinux</span> Linux distribution

GoboLinux is a Linux distribution whose most prominent feature is a reorganization of the traditional Linux file system. Rather than following the Filesystem Hierarchy Standard like most Unix-like systems, each program in a GoboLinux system has its own subdirectory tree, where all of its files may be found. Thus, a program "Foo" has all of its specific files and libraries in /Programs/Foo, under the corresponding version of this program at hand. For example, the commonly known GCC compiler suite version 8.1.0, would reside under the directory /Programs/GCC/8.1.0.

<span class="mw-page-title-main">GNU Project</span> Free software project

The GNU Project is a free software, mass collaboration project announced by Richard Stallman on September 27, 1983. Its goal is to give computer users freedom and control in their use of their computers and computing devices by collaboratively developing and publishing software that gives everyone the rights to freely run the software, copy and distribute it, study it, and modify it. GNU software grants these rights in its license.

<span class="mw-page-title-main">Slax</span> Linux distribution

Slax is a LiveCD Linux distribution developed by Tomáš Matějíček and based on upstream customizable Linux distributions. Packages can be added by apt package manager or can be prepared as modules. The tagline for Slax refers to itself as "your pocket operating system".

<span class="mw-page-title-main">Arch Linux</span> Rolling release distribution of Linux

Arch Linux is an independently developed x86-64 general-purpose Linux distribution that strives to provide the latest stable versions of most software by following a rolling-release model. The default installation is intentionally minimal so that users can add only the packages they require.

<span class="mw-page-title-main">PCLinuxOS</span> Linux distribution

PCLinuxOS, often shortened to PCLOS, is a rolling release Linux distribution for x86-64 computers, with KDE Plasma, MATE, and XFCE as its default user interfaces. It is a primarily FOSS operating system for personal computers aimed at ease of use.

Dependency hell is a colloquial term for the frustration of some software users who have installed software packages which have dependencies on specific versions of other software packages.

Puppy Linux is a family of light-weight Linux distributions that focus on ease of use and minimal memory footprint. The entire system can be run from random-access memory (RAM) with current versions generally taking up about 600 MB (64-bit), 300 MB (32-bit), allowing the boot medium to be removed after the operating system has started. Applications such as AbiWord, Gnumeric and MPlayer are included, along with a choice of lightweight web browsers and a utility for downloading other packages. The distribution was originally developed by Barry Kauler and other members of the community, until Kauler retired in 2013. The tool Woof can build a Puppy Linux distribution from the binary packages of other Linux distributions.

<span class="mw-page-title-main">VectorLinux</span> Linux distribution

VectorLinux, abbreviated VL, is a Linux distribution for the x86 platform based on the Slackware Linux distribution, originally developed by Canadian developers Robert S. Lange and Darell Stavem. Since version 7 the Standard Edition is also available for the x86-64 platform, known as VLocity64 7.

<span class="mw-page-title-main">Software remastering</span>

Software remastering is software development that recreates system software and applications while incorporating customizations, with the intent that it is copied and run elsewhere for "off-label" usage. The term comes from remastering in media production, where it is similarly distinguished from mere copying.

Nix is a cross-platform package manager. It employs a model in which software packages are each installed into unique directories with immutable contents. These directory names correspond to cryptographic hashes that take into account all dependencies of a package, including other packages managed by Nix.

<span class="mw-page-title-main">Linux-libre</span> Version of the Linux kernel without proprietary code

According to the Free Software Foundation Latin America, Linux-libre is a modified version of the Linux kernel that contains no binary blobs, obfuscated code, or code released under proprietary licenses. In the Linux kernel, they are mostly used for proprietary firmware images. While generally redistributable, binary blobs do not give the user the freedom to audit, modify, or, consequently, redistribute their modified versions. The GNU Project keeps Linux-libre in synchronization with the mainline Linux kernel.

<span class="mw-page-title-main">Salix OS</span> Linux distribution

Salix OS is a multi-purpose Linux distribution based on Slackware.

Alpine Linux is a Linux distribution designed to be small, simple, and secure. It uses musl, BusyBox, and OpenRC instead of the more commonly used glibc, GNU Core Utilities, and systemd. This makes Alpine one of few Linux distributions not to be based on the GNU Core Utilities.

<span class="mw-page-title-main">Parabola GNU/Linux-libre</span> Linux distribution based on Arch Linux offering only free software

Parabola GNU/Linux-libre is a free and open-source Linux distribution based on Arch Linux and Arch Linux ARM for the x86-64, i686, and ARMv7 architectures. It is distinguished from other Arch-based distributions by offering only free software. It includes the GNU operating system components common to many Linux distributions and the Linux-libre kernel instead of the generic Linux kernel. Parabola is listed by the Free Software Foundation as a completely free operating system, true to their Free System Distribution Guidelines.

<span class="mw-page-title-main">Solus (operating system)</span> Linux operating system

Solus is an independently developed operating system for the x86-64 architecture based on the Linux kernel and a choice of Budgie, GNOME, MATE or KDE Plasma as the desktop environment. Its package manager, eopkg, is based on the PiSi package management system from Pardus Linux, and it has a semi-rolling release model, with new package updates landing in the stable repository every Friday. The developers of Solus have stated that Solus was intended exclusively for use on personal computers and will not include software that is only useful in enterprise or server environments.

<span class="mw-page-title-main">GNU Guix</span> Purely functional package manager for the GNU system

GNU Guix is a functional cross-platform package manager and a tool to instantiate and manage Unix-like operating systems, based on the Nix package manager. Configuration and package recipes are written in Guile Scheme. GNU Guix is the default package manager of the GNU Guix System distribution.

<span class="mw-page-title-main">GNU Guix System</span> Rolling release distribution of the GNU operating system built around the GNU Guix package manager

GNU Guix System or Guix System is a rolling release, free and open source Linux distribution built around the GNU Guix package manager. It enables a declarative operating system configuration and allows system upgrades which the user can rollback. It uses the GNU Shepherd init system and the Linux-libre kernel, with support of the GNU Hurd kernel under development. On February 3, 2015, the Free Software Foundation added the distribution to its list of endorsed free Linux distributions. The Guix package manager and the Guix System drew inspiration from and were based on the Nix package manager and NixOS respectively.

References

  1. "Community - nixos.org". Archived from the original on 2022-09-23. Retrieved 2022-09-23.
  2. "NixOS/nixos-foundation - Github". GitHub . Archived from the original on 2022-09-23. Retrieved 2022-09-23.
  3. ""NixOS 23.11 released"". 29 Nov 2023.
  4. "nixpkgs/COPYING at master · NixOS/nixpkgs · GitHub". Github.com. Retrieved 2015-09-19.
  5. "What Is an Immutable Linux Distro, and Should You Use One?". HowToGeek.com. Archived from the original on 2023-12-07. Retrieved 2023-12-07.
  6. "DistroWatch.com: NixOS". Distrowatch.com. Retrieved 2015-09-19.
  7. Dolstra, Eelco (2003). "Integrating Software Construction and Software Deployment" (PDF). Software Configuration Management. Lecture Notes in Computer Science. Vol. 2649. pp. 102–117. doi:10.1007/3-540-39195-9_8. ISBN   978-3-540-14036-8. Archived from the original (PDF) on 2019-04-21.
  8. Dolstra, Eelco (2006). The Purely Functional Software Deployment Model (PDF) (Ph.D.). Archived from the original (PDF) on 2019-06-09.
  9. Jonatha Lorimer. "The Nix Thesis".
  10. "Sander van der Burg's blog: In memoriam: Eelco Visser (1966-2022)". Sander van der Burg's blog. 2022-04-20. Retrieved 2024-04-03.
  11. Dolstra, Eelco. "Purely Functional System Configuration Management". www.usenix.org. Retrieved 2024-03-04.
  12. "Stichting NixOS Foundation". Nixos.org. Retrieved 2015-09-19.
  13. "Governance". Nixos.org. Archived from the original on 2020-08-16. Retrieved 2020-08-28.
  14. "Nix RFCS (Request for Comments)". GitHub . 17 December 2021.
  15. "Release Announcements". Nixos.org. Retrieved 2023-12-09.
  16. Dolstra, Eelco; Hemel, Armijn (2007-05-07). Purely Functional System Configuration Management (PDF). 11th USENIX workshop on Hot topics in operating systems. San Diego, California, USA: USENIX Association. Archived (PDF) from the original on 2020-07-10. Retrieved 2023-07-19.
  17. "About NixOS". Nixos.org. Retrieved 2015-09-19.
  18. van der Burg, Sander; Dolstra, Eelco; de Jonge, Merijn (2008-10-20). Atomic Upgrading of Distributed Systems (PDF). 1st International Workshop on Hot Topics in Software Upgrades. Nashville, Tennessee, USA: Association for Computing Machinery. doi:10.1145/1490283.1490294. ISBN   978-1-60558-304-4. Archived (PDF) from the original on 2021-11-13. Retrieved 2023-07-19.
  19. NixOS Manual - Rolling Back Configuration Changes, Nixos.org
  20. Dolstra, Eelco (2005-11-07). Secure Sharing Between Untrusted Users in a Transparent Source/Binary Deployment Model (PDF). 20th IEEE/ACM International Conference on Automated Software Engineering. Long Beach, California, USA: Association for Computing Machinery. doi:10.1145/1101908.1101933. ISBN   978-1-58113-993-8. Archived (PDF) from the original on 2021-11-13. Retrieved 2023-07-19.
  21. DistroWatch Weekly, Issue 637, 23 November 2015
  22. Hunt, Adam (28 October 2022). "Review - NixOS" (PDF). Full Circle magazine . Archived (PDF) from the original on 28 October 2022. Retrieved 28 October 2022.
  23. Proven, Liam. "NixOS 22.11 'Raccoon': Like a proof of concept you can do things with OSes".
  24. Smith, Jesse. "NixOS 23.11".