Jump to content

NixOS

From Archania
NixOS
Logo of the NixOS Linux distribution
Type Linux distribution
Meaning A declarative, reproducible, and functional operating system built on the Nix package manager
Related Nix (package manager), GNU Guix
Date 2003
Origin Netherlands (initial development at Utrecht University)
Wikidata Q21998874

NixOS is a Linux distribution built on top of the Nix package manager, designed with a declarative approach to system configuration and package management. It allows users to define the entire operating system—including the kernel, system services, and applications—in a single configuration file. This model emphasizes reproducibility, atomic upgrades and rollbacks, and the coexistence of multiple package versions.

History

NixOS was created by Eelco Dolstra as part of academic research in the early 2000s. The first official release was in 2003. It evolved from a prototype to a full-featured Linux distribution with a strong community and formal governance under the NixOS Foundation.

Features

Declarative configuration

NixOS uses a configuration file called configuration.nix to define system settings. The system builds itself according to this specification, ensuring consistency and ease of automation. For example:

{ config, pkgs, ... }:

{
 imports = [ ./hardware-configuration.nix ];

 networking.hostName = "my-nixos";
 time.timeZone = "UTC";

 users.users.alice = {
   isNormalUser = true;
   extraGroups = [ "wheel" ];
   packages = with pkgs; [ firefox vim ];
 };

 services.openssh.enable = true;
 system.stateVersion = "24.05";
}

This file describes the desired state of the entire system, including hostname, time zone, user accounts, installed software, enabled services, and more. Because this configuration is a plain text file, it can easily be version-controlled (e.g. with Git) and copied to other computers. Running nixos-rebuild switch on another machine with the same configuration will reproduce an identical system setup.

This declarative approach is the core reason why NixOS is considered reproducible. It ensures that all dependencies and settings are explicitly defined and that the system can always be rebuilt to match a known state.

Atomic upgrades and rollbacks

All system changes in NixOS are atomic. Each system build is stored in isolation, and switching between configurations is instantaneous and reversible. The bootloader automatically includes entries for previous system states.

Functional package management

Packages are defined as pure functions in the Nix expression language. Each package build is isolated from others, ensuring no hidden dependencies. This model supports multiple versions of the same package without conflict.

Reproducibility

Because all dependencies are explicitly defined, builds can be reproduced across machines. This is especially useful in development, deployment, and scientific computing environments.

Flakes

Flakes are an experimental feature that improves reproducibility and modularity by introducing version-pinned and composable Nix projects. While not yet stable, flakes are increasingly used by the Nix community.

Community and Governance

NixOS is maintained by a large open-source community and governed by the NixOS Foundation. Development occurs through open processes on GitHub, mailing lists, and community channels like Matrix and Discourse. The project publishes stable releases every six months and maintains rolling channels for cutting-edge use.

Use Cases

NixOS is widely used in:

  • DevOps and infrastructure as code
  • Continuous integration and deployment pipelines
  • Reproducible scientific computing
  • Secure system configurations
  • Learning functional and declarative paradigms

Limitations

Despite its strengths, NixOS has a steep learning curve. The Nix expression language can be unfamiliar to new users, and the functional paradigm differs from traditional imperative configuration management tools.

See also

  • Nix (package manager)
  • GNU Guix – a related distribution with similar principles, built on Guile Scheme
  • Infrastructure as code
  • Immutable infrastructure

References