An OS as code
Nix — package manager developed by Eelco Dolstra during his PhD (2003-2006, Utrecht University) — introduces a radical paradigm: every package lives in /nix/store/<hash>-name-version/, immutable, identified by the hash of its transitive dependencies. Two installations with the same inputs produce the same hash → reproducible builds.
NixOS, Linux distribution built on Nix, evolves from 2005. Release 15.09 (October 2015) consolidates the YY.MM naming scheme and production maturity. MIT licence.
Features
- Declarative configuration in
/etc/nixos/configuration.nix:
{
services.nginx.enable = true;
services.postgresql.enable = true;
users.users.alice = {
isNormalUser = true;
extraGroups = [ "wheel" ];
};
}
nixos-rebuild switch applies the configuration. The entire system is deterministic: same configuration, bit-identical system.
- Atomic rollbacks — each system generation is a link; one can go back with
nixos-rebuild --rollback - Multiple coexisting versions —
python-3.9andpython-3.11on the same system, no conflicts - User profiles — different users with different packages, no sudo
- Development shells —
nix-shell -p foo barcreates temporary environment with packages
Reproducibility
Nix is reproducible builds-compliant: a package built from identical Nix files gives bit-identical output. Value for:
- Supply chain security — build integrity verification
- Scientific computing — analysis reproducibility
- DevOps — bit-identical dev/staging/prod
- Legacy bug fixing — exact reproduction of old build environments
NixOS, Guix, Nix standalone
- NixOS — complete distribution based on Nix
- Nix (standalone package manager) — installable on macOS, other Linux, WSL
- Guix (GNU) — Nix philosophy fork with Guile Scheme and FSF-pure focus
In the Italian context
Limited but growing adoption:
- Scientific HPC — for reproducibility
- Sophisticated DevOps — small Nix-managed clusters
- Individual developers — per-project dev environments
- Academic research — Universities of Turin, Trento, Pisa
Steep learning curve (functional Nix language is peculiar) but significant architectural impact.
References: NixOS 15.09 (October 2015). Eelco Dolstra, Utrecht University (PhD thesis 2006). Nix package manager. MIT licence. Content-addressed /nix/store. Declarative configuration.nix. Determinism and reproducible builds.
