Checks and Decision Records

This page lists what the 23 flake checks guard, how to run them, the contributing rules in short, and what the decision records hold.

If it is not in the flake, it does not exist. The checks test the flake against itself, so a breakage shows up in your change instead of a stranger's rebuild.

1. Run the checks

You need nix with flakes enabled. The development shell carries the linters, and no check builds a host closure, so you do not need Emanix or NixOS to run them.

nix flake check                 # every check
nix flake check --no-build      # the same evaluation, building nothing
nix build .#checks.x86_64-linux.prose
nix develop                     # a shell with nixd, nixpkgs-fmt, deadnix, statix
nix fmt                         # format with nixpkgs-fmt

The third command runs one check. Replace prose with any name below. Run it from the root of the distribution's checkout.

Caution: nix flake check builds eight of the checks, and those build Emacs. The first run takes time and disk. --no-build evaluates all 23 and builds none, which is what the cheap continuous-integration job does on every pull request. The job that builds them runs on main.

1.1. What "evaluated, never built" means

The role-* checks and template-host compose a throwaway host through the real mkHost and compute its derivation path. They do not realise the closure. A workstation closure source-compiles the compositor, and a check that cannot run safely on the machine you are using is not a check. The username in those hosts is not the author's: a module that hardcodes a real one fails here, not on someone else's machine.

2. What the 23 checks guard

2.1. Evaluation and the three role labels (4)

Check What it finds
role-workstation, role-server, role-wsl The distribution evaluates for each role label. A do-nothing consumer module goes through homeModules, so that seam is evaluated
template-host The template that a new machine is built from evaluates, including the compositor module. It is the only thing a newcomer has, and one that fails does so on a console with no context. Two fixtures exercise both paths of the optional hardware module

2.2. Theme (2)

Check What it finds
palette-contrast Every accent and text slot of the high-contrast palettes clears WCAG AAA (7:1) against its base. The Catppuccin palettes are exempt by name; see Theming
theme-switch The theme switch works. It runs in a plain batch Emacs, with every side effect stubbed and a temporary theme tree

2.3. Emacs and the agent integration

The authoritative list of these checks — names, what each guards and why — is the walkthrough's table of checks: WALKTHROUGH.md.

2.4. Hardware (1)

Check What it finds
hardware-gpu Each value of emanix.hardware.gpu produces the right forced initrd modules, and a GPU value with firmware disabled fails evaluation. A wrong value is a black screen on a machine with no other console

2.5. The installer (1)

Check What it finds
disk-layout The generated disk layout equals its recorded fixtures, and literal facts about it hold (partition type codes, mount options and paths). The fixtures come from the generator, so a diff alone is circular; the literal assertions catch a fixture re-recorded from a broken generator

2.6. Documentation and index (5)

Check What it finds
welcome-keys Every C-* key the welcome buffer advertises is bound by a live binding form in the shipped Lisp. It caught the docs naming a package for weeks after the code had replaced it
check-index Every check is named in the walkthrough's table of checks. A check nobody can find is a check nobody runs
decisions-index Every decision record is linked from the records' index
retired-names No live .nix file names a directory that was renamed. A comment cannot fail a build; this does
comment-budget No comment block runs past 30 consecutive lines. A longer block is an essay, and an essay belongs in a decision record

2.7. Tests that are not flake checks

Three scripts in tests/ are not checks, because they need a live filesystem, a real subprocess or a nested nix eval. Run them before a pull request:

./tests/disk-layout.sh
./tests/installer-modes.sh
EMACS=$(nix build --no-link --print-out-paths .#emacs)/bin/emacs \
  ./tests/init-guard.sh
  • disk-layout.sh holds the cases the build sandbox cannot have: the ext4 branch and the rejection cases.
  • installer-modes.sh runs the real installer with --check-only and asserts that a known host takes the pre-staged path, that no argument or an unknown host name enters interactive mode, and that an invalid hostname is rejected.
  • init-guard.sh runs Emacs in batch mode against a temporary tree and asserts that a broken config.el cannot take the desktop down. It needs the distribution's own Emacs.

3. Contributing, in short

The distribution's CONTRIBUTING.md is the authority on the rules — where a file goes, what the distribution refuses to ship, and that a check must be able to fail: CONTRIBUTING.md.

4. Decision records

The distribution keeps a directory of decision records: a measurement, a rejected alternative, an incident or an exit condition that a code comment cannot carry. The comment states the decision and links to the record.

The directory is maintained: if a decision changes, its record changes with it, and a stale record is a bug. A second directory of earlier design history is frozen and is not edited to match the present.

The records and their index are in docs/decisions/ (README). Read a record before you change the code that links to it; its exit condition tells you when the workaround stops being needed.

5. What you should now know

nix flake check tests the distribution against itself in 23 checks, and nix build .#checks.x86_64-linux.<name> runs one. Three more scripts need a live filesystem and run by hand. The contributing rules say where a file goes, what the distribution refuses to ship, and that a check must be able to fail. The decision records hold the working-out behind the comments. For the settings you may change without patching anything, see Emacs Settings and Options.