NixOS: The Linux distribution that revolutionizes configuration and reproducibility

Introduction to NixOS

NixOS is a Linux distribution based on the Nix package manager, whose main focus is declarative configuration and full system reproducibility. Instead of modifying configuration files imperatively, NixOS allows describing the entire desired state of the system in a single file, which facilitates replication, deployment, and recovery of identical environments on different machines.

What is NixOS?

NixOS differs from other distributions because its entire operating system is built from functional expressions in the Nix language. Each package, service, and configuration is treated as a pure dependency, which eliminates version conflicts and guarantees that an installation is identical regardless of the history of prior changes. This is achieved via an immutable package store located at /nix/store, where each version of a package has its own unique path based on its cryptographic hash.

The Nix Package Manager

At the heart of NixOS is the Nix package manager, which operates with a functional model: packages are built from expressions that specify their exact dependencies. When installing or updating a package, Nix creates a new path in the store, leaving the previous one intact. This allows performing instantaneous rollbacks to any prior state simply by changing the symlink that points to the active version.

Advantages of NixOS

  • Full reproducibility: the same configuration file generates identical systems on any hardware.
  • Safe updates and rollbacks: thanks to the immutable store, reverting to a previous version is as simple as changing a link.
  • Dependency isolation: each package receives its own versions of libraries, avoiding the so-called “dependency hell”.
  • Declarative configuration: manage services, users, and filesystems via readable and versionable code.
  • Consistent development environments: temporary shells with exact dependencies can be created using nix-shell.

Disadvantages and Challenges

  • Steep learning curve: the functional paradigm and the Nix language can feel foreign to users accustomed to traditional distributions.
  • Scarcity of packages in some repositories: although the ecosystem grows quickly, certain proprietary or uncommon software may require manual packaging.
  • Disk space consumption: keeping multiple versions of packages can occupy more space than a traditional approach.

Typical Use Cases

NixOS shines in scenarios where consistency and traceability are critical: production servers that must be replicated exactly, research environments that require reproducibility of experiments, CI/CD pipelines that deploy identical infrastructure on each run, and developer workstations that need to isolate dependencies of diverse projects without conflicts.

Getting Started with NixOS

  1. Download the latest official ISO from the NixOS website and create a bootable medium.
  2. Boot the installer and partition the disk according to needs (it is recommended to use ext4 or btrfs for the root).
  3. Mount the partitions and run nixos-generate-config to create a base configuration file at /mnt/etc/nixos/configuration.nix.
  4. Edit that file to define the hostname, user, services (such as SSH, Docker, etc.), and the desired desktop environment.
  5. Run nixos-install to install the system based on the declarative configuration.
  6. Reboot, remove the installation medium, and begin using the system; any future change is made by editing configuration.nix and running nixos-rebuild switch.

Community and Resources

The NixOS community is active and collaborative, with channels on Discourse, Matrix, and IRC where modules, tips, and troubleshooting solutions are shared. The official documentation, available at , includes tutorials, reference for the Nix language, and packaging guides. Moreover, the nixpkgs repository on GitHub hosts more than 80,000 packages, constituting one of the largest free software repositories in existence.

Conclusion

NixOS represents a powerful alternative for those seeking an operating system where configuration is treated as code, guaranteeing reproducibility, security, and ease of maintenance. Although its adoption requires a mindset shift, the long-term benefits — especially in professional and development environments — make the time investment worthwhile.

This post is also available in ESPAÑOL.

Leave a Reply

Your email address will not be published. Required fields are marked *

Esta obra está bajo una Licencia Creative Commons Atribución 4.0 Internacional para Francesc Roig francesc@vivaldi.net .