Series

How NixOS Works

Declarative Linux, Configured with Flakes

Most Linux systems are shaped by years of accumulated commands — a package installed here, a config file edited there, a service enabled and half-forgotten. NixOS takes the opposite approach: the entire system is described by a set of files, and a single command makes reality match that description. The result is declarative, reproducible, atomic, and rollbackable — if an upgrade breaks your machine, you reboot into the previous version from the boot menu.

This series is flakes-first. Flakes are the modern way to pin a NixOS configuration's inputs so it builds the same way on any machine, at any time. They're still technically an "experimental" feature of Nix, but they've become the de-facto standard for new configurations — so that's where we start and stay.

How to read this series: Start from the top. The first section builds your mental model, teaches just enough of the Nix language, and gets you to a working flake-based configuration. Later sections go advanced — the repl, overlays and overrides, writing your own derivations, dev shells, and finally debugging builds and flake gotchas.

Getting Started

The mental model, the Nix language, and your first flake-based config.

  1. 001
    Intermediate The NixOS Mental Model

    Why a whole Linux system can be a single, rebuildable description

    19 min
  2. 002
    Intermediate The Nix Language

    The small functional language behind every NixOS config and flake

    26 min
  3. 003
    Intermediate Your First Flake-Based Configuration

    Build a real, minimal NixOS system from two small files

    27 min
  4. 004
    Intermediate The Module System

    How a pile of small files becomes one coherent Linux system

    26 min
  5. 005
    Intermediate Generations, the Store & Rollbacks

    The commands and symlinks behind atomic upgrades and one-reboot recovery

    20 min
  6. 006
    Intermediate Managing Your User with Home Manager

    Bring the same declarative, rollbackable discipline to your dotfiles, shell, and user packages

    22 min

Going Deeper

Advanced configuration and packaging.

  1. 007
    Advanced Exploring nixpkgs with the REPL

    Turn nixpkgs from an opaque monolith into something you can poke at, one expression at a time

    23 min
  2. 008
    Advanced Overlays & Overrides

    Bend nixpkgs to your needs without forking a 100,000-package repo

    27 min
  3. 009
    Advanced Writing Your Own Derivations

    From the builtins.derivation primitive up to stdenv.mkDerivation and the language builders

    28 min
  4. 010
    Advanced Packaging Software That Isn't in Nixpkgs

    Write a local package and wire it into your NixOS configuration

    25 min
  5. 011
    Advanced Reproducible Dev Environments

    Pin a project's exact toolchain in its flake — and enter it automatically

    31 min
  6. 012
    Advanced Handling Secrets with SOPS

    Keep passwords, keys, and tokens out of the world-readable Nix store

    26 min

Troubleshooting & Tips

Debugging builds and flake gotchas.

  1. 013
    Advanced Troubleshooting & Debugging

    A systematic way to read Nix errors, tell eval failures from build failures, and reach for the right tool

    31 min
  2. 014
    Advanced Flakes: Tips, Tricks & Gotchas

    A practical grab-bag for people already living in flakes

    24 min