Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

CI/CD

GitHub Actions runs the flake’s checks. The workflows live in .github/workflows/.

Pipeline

The Build workflow splits the flake’s checks into two tiers. Both run on every pull request, every push to main and every manual dispatch, so the core tier reports early while the whole suite still gates what lands:

  • Commit signatures (signatures job) verifies every commit of a push to main, and of a pull request from a branch of this repository, against the keys tracked under keys/. It is skipped for a pull request from a fork.
  • Core (core job) runs on every PR/push/dispatch and builds its checks in one nix build. They are the lint hooks, the secret scan, the docs build, the host evaluations and read-backs in the table below, and impermanence-test. Their closures are small.
  • Core on ARM (core-aarch64 job) runs on every PR/push/dispatch on an ubuntu-24.04-arm runner. It builds the portable host evaluations for aarch64-linux, which is every check named in portableChecks in flake/checks/default.nix. It is not required by branch protection.
  • Core on darwin (core-darwin job) runs on every PR/push/dispatch on a macos-latest runner, which is Apple Silicon. It builds the checks named in darwinChecks in flake/checks/default.nix apart from darwin-enable-matrix, the treefmt check, every dev shell and the formatter for aarch64-darwin. Branch protection requires it.
  • Extended (extended job) runs on every PR/push/dispatch. Neither the changed paths nor the pull request title decides whether it runs. A matrix fans the suite out, one runner per check: eval-default and the two desktop evals, eval-ashell (the bar’s generated config for a desktop and a laptop), enable-matrix (every module enabled with defaults), and the runtime VM tests (restic-test, headscale-test, auto-upgrade-test, crowdsec-test, router-test, router-ips-test, integration-test, listeners-test, impermanence-reboot-test, impermanence-wipe-test, wallpaper-test, keyring-test, soju-test, yubikey-onboard-dry-run).
  • Extended verdict (extended-ok job) turns the matrix into one status that branch protection can require. It passes only when every matrix leg succeeded, so a failed, cancelled or skipped leg fails it.
  • Extended on darwin (extended-darwin job) runs on the same events on a macos-latest runner, with a matrix of its own. It holds darwin-enable-matrix (every darwin module enabled with defaults). It evaluates darwin hosts and builds none of them, with the sandbox on for the wrapper it builds.
  • Extended verdict (darwin) (extended-darwin-ok job) is the darwin leg’s own status, on the same terms as the Extended verdict.
CheckWhat it covers
pre-commit-checkThe eight commit hooks, run over the whole tree
secret-scangitleaks over every tracked file
docsThe MdBook build, with the generated options reference injected
docs-includesEvery include, anchor, relative link and heading fragment under docs/src resolves
eval-host-minA minimal functioning host evaluates
eval-host-headless, eval-host-server, eval-host-anonymous, eval-host-server-accountThe four server-contract host shapes, each with no Home Manager module imported
eval-host-app-no-hm, eval-host-app-no-hm-fullA slice of the app and desktop modules, and all of them, each on a host with an account that Home Manager does not manage
eval-host-encryptedAn encrypted workstation’s disk shape, the disko layout with FIDO2 unlock beside impermanence, built to its top level so every assertion runs
eval-pairsEvery conflict or requirement between two modules or two options, each matched by a fragment of its assertion message
eval-contractNo module file takes username or hostname, only modules/system/home.nix writes home-manager.users on a NixOS or a darwin host, only modules/system/impermanence.nix writes environment.persistence, and the NixOS and darwin fixtures and the template pass inputs alone or nothing
eval-inputsA host handed no specialArgs enables ashell, Hyprland, nixvim, comma and claude-code, gets each from this flake’s lock, and gets the package it sets through a package option
ci-coverageEvery check of every system is named by a job in build.yml for that system, and every name there is a check
eval-bootloaderEvery bootloader type with secureBoot off and on
eval-host-hardening, eval-host-hardening-hibernateThe hardening profile’s values, and its hibernation assertion
eval-impermanenceWhat the impermanence module writes into the initrd
eval-persistenceWhat the app and desktop modules persist, with a managed account and without one
eval-service-stateWhat the service modules persist under impermanence
eval-nixWhat the nix module trusts and pins
eval-shellThe login shell, the editor variables and the aliases
eval-typesThe values the option types refuse, and the git identity and bridge or vlan reference assertions
eval-exportsThe export list in flake/modules.nix, held to the module tree
eval-optional-exportsA host with default and no upstream module at all, a managed account rejected without nixosModules.home, an account Home Manager does not manage accepted without it, a host built from nixosModules.full, impermanence on a device named by hand, the rejection of impermanence without its export, and what the disko, secrets and impermanence exports write beside their upstream modules. The same for the darwin default, stylix, secrets and full exports, with a darwin host refused for want of sops.age.keyFile
eval-templateThe nix flake init template, instantiated with only the inputs a consumer has
eval-darwin-templateThe darwin template, instantiated the same way, with no warning, Lix as its Nix and Home Manager managing the user. The darwin job builds its toplevel
eval-dev-shellsThe hooks each dev shell installs
eval-darwin-host-min, eval-darwin-host-user, eval-darwin-host-apps, eval-darwin-host-full, eval-darwin-host-services, eval-darwinA darwin host from darwinModules.default with a user named, the same host with the system modules and Home Manager on, the same host with every darwin app on, a host from darwinModules.full with Stylix and the secrets plumbing on, one host each for SSH, Tailscale, mosh, the YubiKey and Ollama on by itself, and what the account, Nix, locale and service modules write there, the Ollama launchd agent’s host and port, the T3 Code launchd agent, the senpai configuration and its refusal of an unset address, and the project-environment launchers that codex and Claude Code reach Home Manager and T3 Code through among them. The core job evaluates them with import-from-derivation off, and the darwin job builds the hosts
eval-auto-upgradeThe evaluation-time rules of the auto-upgrade verify gate
eval-ssh, eval-ssh-settingsThe known hosts and client defaults, the server’s ports, firewall, jail and hardened defaults, and the mosh module’s programs.mosh and UDP 60000 to 61000 with openFirewall on and off
eval-pamWhich PAM services take the YubiKey, and with what control
eval-traefikThe Traefik TLS floor, header defaults and TCP routers
eval-sojusoju’s loopback listeners, message store, TLS credentials, firewall port and Traefik TCP router, the state directory it persists, the config it generates, and its five refusals
eval-senpaiWhat senpai hands Home Manager on NixOS, which is the address, the nickname, the password-cmd a password file sets and the further settings, the senpai.scfg rendered from them, the soju loopback default and its port, the cache directory it persists, the store path its type refuses, and its four refusals. eval-darwin reads the same on a Mac
eval-router, eval-router-servicesThe router’s rendered ruleset, and the start-up defaults of Suricata and CrowdSec
eval-headscale, eval-tailscaleWhat the two modules render, pass to the daemon and refuse
eval-exposureWhat ntfy, Scrutiny and the two Victoria stores expose and persist
eval-grafanaWhat the Grafana module serves and refuses
eval-listenWhere the metrics, logs, dashboard and alerting modules find each other
eval-servicesWhat the smaller service modules pass upstream and refuse
eval-k3s, eval-containersWhat k3s opens and requires, and what the container modules run and prune
eval-gamingThe gamemode group GameMode needs for its root helpers, the GameMode defaults and the GPU key for each vendor, the ntsync driver and device access with and without Steam, the ntsync rename, and osu!’s GameMode default and launcher
eval-hardware, eval-nvidiaWhat the hardware, CPU, mount and disk modules write, which NVIDIA driver a host gets, and the container toolkit on Podman and rootless Docker
eval-desktop, eval-lock, eval-loginWhat the desktop modules and terminals write, the session lock, and what greetd is handed
eval-vicinaeThe Vicinae settings, theme, unit and persisted directories, the launcher chord on Hyprland and Niri with Vicinae on and off, and the hosts it writes nothing to
eval-keyringThe Secret Service provider each setting of othrys.desktop.keyring selects, the keyring written without a password, and the combinations the module refuses
eval-themeThe palette, fonts and schemes of othrys.theme on hosts with no Stylix module, and what the Stylix adapter hands over and takes back
eval-wallpaperThe wallpaper daemon’s configuration for each form of othrys.theme.wallpaper.source, the hosts that get no daemon, and the image the Stylix adapter is handed
eval-languagesThe binaries nixvim and VSCodium take from the language registry
eval-floorp, eval-rustdeskThe Floorp and Discord settings, and what RustDesk persists and launches
eval-remminaRemmina’s Home Manager service, the login service it leaves off unless a host turns it on, and the two directories it persists at 0700
eval-chromiumChromium’s user package, wrapper arguments, extension manifests, persistence, registry guards and typed refusals
eval-claude-codeThe settings, pre-approved tools, skills and context the AI modules hand Claude Code
eval-claude-desktopThe package, the graphical and unfree refusals, what the module persists, and the local MCP servers its activation step merges into the app’s config
claude-desktop-activationThe claude-desktop activation step, run against a config holding the app’s own keys, no config, invalid JSON, whitespace and an unreadable file
project-environment-launcherThe launcher othrys.apps.ai.projectEnvironment puts in front of codex and claude, run around a stand-in program in a directory without an .envrc, with an allowed one, with a blocked one, in a git worktree whose .envrc matches the allowed main checkout and in one whose .envrc differs, in a worktree reached through a symlink, in a worktree the user denied, in one matching a main .envrc changed after it was allowed, under an environment direnv already loaded, and in a nested .envrc under a parent project’s loaded environment, and with trustWorktrees off in a worktree whose .envrc matches the allowed main checkout. Each case reads FOO, the refusal line and the exit status back. The darwin job runs it too
eval-orcaThe wrapped package and its telemetry switch, what the module persists, the graphical refusal, and the runtime port that opens on Tailscale’s interface alone
eval-t3codeThe agents T3 Code is handed, the telemetry and self-update switches of its wrappers, the server’s systemd user unit and its command line for each listen mode, the firewall rule for lan and tailscale, what the module persists, and its five refusals
eval-paseoThe packages Paseo installs, the daemon’s systemd user unit and lingering, the serve script’s listen address, relay switch, web UI switch, hostnames, password and agent PATH for each setting, the direnv plugin’s default and its config.json edit on and off with the switch entry that removes it, the unit’s restart settings and PATH, the desktop package option, the firewall rule for lan and tailscale, what the module persists, its refusals and the warning for an open port without a password
paseo-serveThe Paseo serve script, run around a stand-in paseo-server with no config.json, with one the daemon wrote, with a stale plugin entry in the store and the plugin off, with an entry outside the store that stays, with an empty file and one jq cannot read, with a file that needs no change and is not rewritten, through the script a Home Manager switch runs with the plugin off, with a readable and a missing password file, and with the web UI on under two hostnames. Each case reads the file, its mode, the variables and umask the daemon is handed and the exit status back. The darwin job runs it too
eval-codexThe package, telemetry switches, sign-in store, skills, context and MCP servers the codex module hands Codex, and what it persists
agent-configThe committed Claude Code configuration under .claude/, which is the settings file, the hooks behind their dev-shell gate, the agent, skill and command frontmatter, and the hook program’s refusals under pytest
eval-ghThe gh settings and credential helper, the wrapper a token file installs, and the read-only commands pre-approved for Claude Code
yubikey-onboard-buildsThe onboarding script’s package, whose build runs shellcheck and bash -n over the script
impermanence-testA VM test of the wipe script and the persistence invariant

Core on ARM (core-aarch64 job) runs on the same events on an ubuntu-24.04-arm runner. It builds the portable host evaluations for aarch64-linux, which is every check named in portableChecks in flake/checks/default.nix. It is not required by branch protection.

Core on darwin (core-darwin job) runs on the same events on a macos-latest runner. nixosSystem cannot evaluate for a darwin system, so checks.aarch64-darwin holds only the checks that evaluate no NixOS host. They are the darwin hosts eval-darwin-host-min, eval-darwin-host-user, eval-darwin-host-apps, eval-darwin-host-full, eval-darwin-host-services and eval-darwin-template, built there as systems, the read-back eval-darwin, pre-commit-check, secret-scan, docs-includes, eval-dev-shells, agent-config, project-environment-launcher and paseo-serve, and darwin-enable-matrix, which the darwin leg of the extended tier builds. The job also builds the treefmt check, the eight dev shells and formatter.aarch64-darwin. Nix turns the build sandbox off on macOS by default, and the job sets sandbox = relaxed, which sandboxes every build except one that asks for __noChroot, as the llm-agents build of Claude Code does on darwin. The job trusts cache.numtide.com, as a host with an llm-agents module does, so Claude Code arrives prebuilt. That cache holds no darwin build of Codex, so the runner compiles it, and the job takes about 90 minutes. The macOS runner has 3 CPUs, 7 GB of memory and 14 GB of disk, and it skips the disk and swap steps of the Linux jobs. yubikey-onboard needs unshare and findmnt and options-doc is rendered from a NixOS evaluation, so neither package exists for darwin, and the docs and yubikey-onboard-builds checks stay on Linux.

Extended (extended job) runs on every pull request, push and manual dispatch. A matrix gives each check its own runner. The extended-ok job reports one status for branch protection, and a failed, cancelled or skipped matrix fails it. extended-darwin and extended-darwin-ok do the same on a Mac.

CheckWhat it covers
eval-default, eval-host-desktop, eval-host-desktop-niriThe whole module tree with defaults, and the two desktop stacks
eval-ashellThe bar’s generated config for a desktop and a laptop
enable-matrixEvery othrys.*.enable option turned on with defaults, where an expected failure has to carry the assertion message the allowlist names
darwin-enable-matrixThe same over every othrys.*.enable option of the darwin exports, the apps and desktop options over a managed account and the rest over a host with none, with Home Manager, Stylix and sops-nix imported, run on a Mac by the darwin leg
restic-testA backup, a restore and the integrity check, in a VM
headscale-testA Tailscale client registering against Headscale
auto-upgrade-testThe signature gate in front of the unattended upgrade
crowdsec-testThe CrowdSec engine and bouncer on a fresh host
router-test, router-ips-testThe router, Kea and Unbound on a virtual network, and Suricata inline on the NFQUEUE hook
integration-testA booted machine with a representative set of modules
listeners-testThe listening sockets and the firewall accept rules of a booted server, compared with a list written in the test
impermanence-reboot-test, impermanence-wipe-testHost identity across a reboot with an empty root, and the wipe unit booted from a btrfs root
wallpaper-testThe wallpaper daemon’s unit, its rendered configuration and the directory built from a list of images, on a booted machine
keyring-testA secret stored and read back through the Secret Service on two booted machines, one with a gnome-keyring store that has no password and one with pass and a software OpenPGP key
soju-testsoju started behind Traefik, an account made with sojuctl, registration in plaintext on loopback and over TLS through Traefik, the client address soju takes from the PROXY header, and a trusted peer that sends no header still registering
yubikey-onboard-dry-runThe packaged onboarding script’s dry run as an unprivileged user, which must take the unshare -Urm path, exit 0, write nothing, and name a summary directory outside the working directory

Unchanged derivations are pulled from the cache and not rebuilt. On x86_64-linux, nix flake check runs every check regardless of tier. On a Mac it runs the darwin list and treefmt. The Linux run includes comment-hygiene, contract-guards and treefmt as checks of their own, which no workflow job builds by name, since pre-commit-check runs all three as hooks over the whole tree. It includes darwin-enable-matrix as well, which evaluates the same darwin hosts on any system and which the darwin leg builds on a Mac.

The workflow lists its checks by name, so a check added to flake/checks/ and left out of build.yml would be built by no job. The ci-coverage check fails on that. For each of x86_64-linux, aarch64-linux and aarch64-darwin it reads the attribute names of checks.<system>, reads build.yml for every checks.<system>.<name> installable and every item of a matrix.check list whose build line names that system, and fails naming any check that no job builds for its system and any listed name that is not a check there. A matrix list with no build line naming a system fails too. The four checks above are named in localOnly in flake/checks/ci-coverage.nix for x86_64-linux, and treefmt for aarch64-linux, which the treefmt-nix module registers on every system. An entry there that a job does build, or that names no check, fails as well. A new check therefore needs a line in build.yml or an entry in localOnly with its reason.

Branch protection on main requires four statuses, Core checks, Core checks (darwin), Extended verdict and Extended verdict (darwin). That requirement is a repository setting, and the workflow only reports them.

A newer push to a pull request cancels the run before it. A run on main is never cancelled, since its concurrency group is keyed on the commit, so a release commit keeps its run when another push follows it.

Permissions

Every workflow starts from permissions: contents: read, and a job that needs more declares it on itself. The deploy job of pages.yml holds pages: write and id-token: write, while the build job beside it holds read access only. The analysis job of scorecard.yml holds security-events: write and id-token: write. The update job of update-inputs.yml holds contents: write and pull-requests: write, which only its fallback uses. It opens the pull request with a token minted from the maintenance GitHub App, scoped to this repository with write on Contents and Pull requests, since a pull request opened with GITHUB_TOKEN starts no workflow run. Every actions/checkout step sets persist-credentials: false, so no job leaves the token in .git/config. No job reads the pull request title or any other event text.

Workflows

FileJobsPurpose
build.ymlcoreEvery PR/push: lint, docs, docs-includes, ci-coverage, eval-host-min, the server-contract and app-contract evals, eval-pairs, eval-contract, eval-inputs, eval-bootloader, impermanence-test (fast gate)
build.ymlcore-aarch64Every PR/push: the portable host evaluations for aarch64-linux on an ARM runner
build.ymlcore-darwinEvery PR/push: the darwin checks, dev shells and formatter for aarch64-darwin on a macOS runner
build.ymlextendedEvery PR/push: a matrix of whole-tree evals, enable-matrix and the runtime VM tests, one runner each
build.ymlextended-okEvery PR/push: one status for the matrix, passing only when every leg succeeded
build.ymlextended-darwinEvery PR/push: darwin-enable-matrix on a macOS runner
build.ymlextended-darwin-okEvery PR/push: one status for the darwin matrix
pages.ymlbuild + deployBuilds this MdBook and publishes it to GitHub Pages on main (requires Pages enabled with Source = GitHub Actions)
flake-inputs.ymlflake-inputsHealth check of the nixpkgs pins in the flake lock, which covers the branch they track, their age and whether the release is supported. It runs when flake.{lock,nix} change and weekly, and it does not scan for security advisories
update-inputs.ymlupdateWeekly nix flake update, opened as a chore(flake) pull request and never merged automatically. nixpkgs moves only as far as the newest commit that both nixos-unstable and nixpkgs-unstable have reached, so core-darwin finds its binaries on cache.nixos.org
scorecard.ymlanalysisOpenSSF Scorecard on main, weekly, and on branch protection changes. Publishes the score behind the README badge and uploads findings to code scanning
codeql.ymlanalyzeEvery PR, push to main and weekly: CodeQL with the security-extended queries over the workflows (actions) and the scripts under flake/checks/ (python), one leg each, uploaded to code scanning. Nix has no CodeQL extractor and stays with statix, deadnix and gitleaks

.github/dependabot.yml raises weekly PRs that move the sha pins of the actions these workflows use. Nix inputs are left to update-inputs.yml.

Disk Space

The core and extended jobs use nothing-but-nix to reclaim ~115GB of disk space on GitHub runners, replacing the default ~20GB limit.

On the ubuntu-26.04 runners / and /mnt share one filesystem. The action keeps a safe haven on / and gives every other free byte to /nix, at once and then in the background while the job runs. The extended job replaces the runner’s swap with an 8G swapfile on / before the action runs, so the swapfile is already used space when the action measures /. Allocated after the action, the swapfile competed with that growth, and runners died with no space left on / within seconds of starting. The job also raises root-safe-haven to 10240MB, above the 6144MB that v12 resolves auto to for cleave.

Cachix

CI pushes to othrys-nix.cachix.org, which exists to make this repository’s own builds cheap. The expensive artifacts are the extended tier’s VM tests, so a run on main reuses closures a previous run already built.

It is not a distribution cache. Consuming flakes gain nothing from it, since this repository builds a shell-script wrapper and a generated options reference while a consumer’s system closure comes from nixpkgs. Nothing here adds othrys-nix.cachix.org to a host’s substituters, and othrys.system.nix.cachix.* exists so a consumer points at their own cache instead.

Contributors can pull from it to skip rebuilding the VM tests locally:

nix.settings = {
  substituters = ["https://othrys-nix.cachix.org"];
  trusted-public-keys = [
    "othrys-nix.cachix.org-1:0CCqJPmhMxN3PLPDEoS+vChsmWgx1pQQ4Ih4qdfqbg4="
  ];
};

Pushes are gated on main through skipPush, so pull-request branches read without writing. The push filter drops source archives and man pages. extraPullNames adds the nix-community and hyprland caches, so CI pulls those prebuilt closures rather than rebuilding Hyprland from source, which is what its deliberate refusal to follow nixpkgs would otherwise cost.

Flake Checks

Defined in flake/checks/, with each VM test in its own file:

    # Checks are split into two tiers. The GitHub workflow runs both on every
    # pull request, push and manual dispatch (see .github/workflows).
    # `nix flake check` on x86_64-linux still runs all of them.
    checks = onThisSystem {
      # CORE, fast, every PR

      # The least it takes for othrys to produce a bootable Linux host. Small
      # closure, so it's the cheap gate that catches most option/module errors.
      eval-host-min = mkHostEval "othrys-eval-host-min" [functioningHost];

      # The darwin exports. A host with a user named and nothing on, a host
      # with the account, Nix, git, the shell, the locale and Home Manager
      # on, the same host with every darwin app on, and a host built from
      # darwinModules.full with Stylix and the secrets plumbing on (see
      # ./darwin-eval.nix and ./exports-optional-eval.nix for what is read
      # back).
      eval-darwin-host-min = mkDarwinEval "othrys-eval-darwin-host-min" [darwinBase];
      eval-darwin-host-user = mkDarwinEval "othrys-eval-darwin-host-user" [darwinBase darwinUserHost];
      eval-darwin-host-apps = mkDarwinEval "othrys-eval-darwin-host-apps" [darwinBase darwinAppHost];
      eval-darwin-host-full = mkDarwinEval "othrys-eval-darwin-host-full" [darwinBase darwinFullHost];
      # Each darwin service module on by itself, one system per module. On a
      # Mac each is built, and elsewhere each toplevel derivation is recorded.
      eval-darwin-host-services = let
        tops = pkgs.lib.mapAttrs (_: host: (darwinConfig [darwinBase darwinManagedBase host]).system.build.toplevel) darwinServiceHosts;
      in
        if pkgs.stdenv.hostPlatform.isDarwin
        then pkgs.linkFarm "othrys-eval-darwin-host-services" tops
        else
          pkgs.runCommand "othrys-eval-darwin-host-services" {
            drvs = pkgs.lib.concatStringsSep "\n" (pkgs.lib.mapAttrsToList (n: t: "${n} ${builtins.unsafeDiscardStringContext t.drvPath}") tops);
          } "echo \"$drvs\" > \"$out\"";
      # EXTENDED. Every othrys.*.enable of the darwin exports on by itself
      # (see ./darwin-enable-matrix.nix).
      darwin-enable-matrix = import ./darwin-enable-matrix.nix {
        inherit pkgs inputs darwinEval darwinBase darwinHomeModules darwinManagedBase darwinStylixModules darwinSecretsModules;
      };
      eval-darwin = import ./darwin-eval.nix {
        inherit (inputs.nixpkgs) lib;
        inherit darwinConfig darwinBase darwinHomeModules darwinAppHost darwinManagedBase darwinServiceHosts mkExpectations rejectedWith inputs;
      };

      # Regression guard for headless/root-only hosts, with nix settings enabled but
      # NO primary user account (othrys.system.users stays off). othrys.system.nix
      # must not materialize a home-manager user here, since doing so trips NixOS's
      # user assertions. See modules/system/nix.nix.
      eval-host-headless = mkHostEval "othrys-eval-host-headless" [
        bootBase
        {
          othrys.system.nix = {
            enable = true;
            stateVersion = "26.05";
          };
        }
      ];

      # Server contract, named variant. A headless host with a declared user
      # name but NO managed account (users.enable off) must be able to run the
      # full server module surface. Catches per-user writes that escape the
      # users.enable guard (materialized home-manager users, phantom accounts).
      eval-host-server = mkHostEval "othrys-eval-host-server" [
        bootBase
        {
          othrys.system.nix = {
            enable = true;
            stateVersion = "26.05";
          };
        }
        serverModules
      ];

      # Server contract, anonymous variant. The same surface with
      # othrys.system.user.name entirely unset. Guards the "decoupled
      # foundation" invariant, so no server module may force a primary user
      # identity to exist.
      eval-host-anonymous = mkHostEval "othrys-eval-host-anonymous" [
        bootCore
        {
          othrys.system.nix = {
            enable = true;
            stateVersion = "26.05";
          };
        }
        serverModules
      ];

      # Server contract, account-without-home-manager variant. The primary
      # account exists (e.g. an admin login, or a user a webapp runs under)
      # but home-manager does not manage its environment
      # (users.homeManager.enable off). Guards the account/environment split,
      # no module may write home-manager state keyed on account creation alone.
      eval-host-server-account = mkHostEval "othrys-eval-host-server-account" [
        bootBase
        {
          othrys.system.nix = {
            enable = true;
            stateVersion = "26.05";
          };
          othrys.system.users = {
            enable = true;
            homeManager.enable = false;
            # Bootstrap hash for "changeme", generated with mkpasswd -m yescrypt.
            initialHashedPassword = "$y$j9T$aiZuvauf85ZjB04z3seyG0$OKYG9I1g.vAp5IA48MlGzaVoB15gqWIL.k7lSni8fe8";
          };
        }
        serverModules
      ];

      # App/desktop contract, account-without-home-manager variant. The gap the
      # guard sweep closed: every headless fixture above enables the SERVER
      # module surface and never an app or desktop module, so thirty-two
      # unguarded per-user writes sat undetected. A managed account with
      # home-manager off must be able to enable app modules without any of them
      # materializing a home-manager user. The host imports no Home Manager
      # module either, so a module that named the namespace fails here.
      #
      # A cheap representative slice runs here in CORE, one CLI module, one GUI
      # module, one desktop module, and vscode, which once read nixvim's build
      # product through config.home-manager and failed where that namespace is
      # absent, as it is on this host. The full set follows below, since a subset only proves
      # that a subset is guarded.
      eval-host-app-no-hm = mkHostEval "othrys-eval-host-app-no-hm" [
        accountNoHomeManager
        {
          othrys.apps.gh.enable = true;
          othrys.apps.ghostty.enable = true;
          othrys.apps.vscode.enable = true;
          othrys.desktop.graphical = true;
          othrys.desktop.idle.enable = true;
        }
      ];

      # Every bootloader type with secureBoot off and on (see ./bootloader.nix).
      # Every other fixture carries its own GRUB and leaves the bootloader
      # module off, and the enable matrix lists it as an expected failure for
      # the same reason, so nothing else evaluates it.
      eval-bootloader = import ./bootloader.nix {
        inherit pkgs inputs system defaultModules bootCore;
      };

      # The hardening profile, read back rather than merely evaluated. Every
      # sysctl is compared with the value the profile documents, so a dropped or
      # retyped key fails here. The toplevel is forced as well, because
      # boot.kernel.sysctl rejects two definitions at one priority and NixOS
      # itself defines kernel.kptr_restrict and, under protectKernelImage,
      # kernel.kexec_load_disabled at mkDefault. The host's plain ptrace_scope
      # assignment has to win, and the router's strict rp_filter on its WAN
      # interface has to survive beside the profile's loose one.
      eval-host-hardening = let
        sysctl = hardenedHost.boot.kernel.sysctl;
        expected = {
          "kernel.kptr_restrict" = 2;
          "kernel.dmesg_restrict" = 1;
          "kernel.unprivileged_bpf_disabled" = 1;
          "net.core.bpf_jit_harden" = 2;
          "kernel.kexec_load_disabled" = 1;
          "net.ipv4.conf.all.rp_filter" = 2;
          "net.ipv4.conf.default.rp_filter" = 2;
          "net.ipv4.conf.all.accept_redirects" = 0;
          "net.ipv4.conf.default.accept_redirects" = 0;
          "net.ipv4.conf.all.secure_redirects" = 0;
          "net.ipv4.conf.default.secure_redirects" = 0;
          "net.ipv4.conf.all.send_redirects" = 0;
          "net.ipv4.conf.default.send_redirects" = 0;
          "net.ipv6.conf.all.accept_redirects" = 0;
          "net.ipv6.conf.default.accept_redirects" = 0;
          "net.ipv4.conf.all.accept_source_route" = 0;
          "net.ipv4.conf.default.accept_source_route" = 0;
          "net.ipv6.conf.all.accept_source_route" = 0;
          "net.ipv6.conf.default.accept_source_route" = 0;
          "net.ipv4.tcp_syncookies" = 1;
          "net.ipv4.icmp_echo_ignore_broadcasts" = 1;
          "net.ipv4.tcp_rfc1337" = 1;
          "fs.suid_dumpable" = 0;
          "fs.protected_fifos" = 2;
          "fs.protected_regular" = 2;
          "vm.unprivileged_userfaultfd" = 0;
          "dev.tty.ldisc_autoload" = 0;
          "dev.tty.legacy_tiocsti" = 0;
          "kernel.perf_event_paranoid" = 2;
        };
        sandbox = (import ../../modules/lib/sandbox.nix).baseline;
      in
        mkExpectations "othrys-eval-host-hardening" (
          inputs.nixpkgs.lib.mapAttrs' (key: value:
            inputs.nixpkgs.lib.nameValuePair "sysctl ${key} is ${toString value}" ((sysctl.${key} or null) == value))
          expected
          // {
            "the hardened host evaluates" = hardenedHost.system.build.toplevel.drvPath != null;
            "the profile adds its kernel parameters" = builtins.all (p: builtins.elem p hardenedHost.boot.kernelParams) ["slab_nomerge" "page_alloc.shuffle=1" "vsyscall=none"];
            "the sandbox baseline hides the clock, the host name, the kernel log and other processes" = sandbox.ProtectClock && sandbox.ProtectHostname && sandbox.ProtectKernelLogs && sandbox.ProtectProc == "invisible" && sandbox.ProcSubset == "pid";
            "the sandbox baseline keeps mounts, IPC and new files private" = sandbox.PrivateMounts && sandbox.RemoveIPC && sandbox.UMask == "0077";
            "a plain host assignment of kernel.yama.ptrace_scope wins" = sysctl."kernel.yama.ptrace_scope" == 0;
            "security.lockKernelModules is set" = hardenedHost.security.lockKernelModules;
            "security.protectKernelImage is set" = hardenedHost.security.protectKernelImage;
            "Tailscale keeps the firewall reverse path check loose" = hardenedHost.networking.firewall.checkReversePath == "loose";
            "the hardened router evaluates" = hardenedRouter.system.build.toplevel.drvPath != null;
            "the router's rp_filter on all wins over the profile, at 0" = hardenedRouter.boot.kernel.sysctl."net.ipv4.conf.all.rp_filter" == 0;
            "the router keeps loose rp_filter on default" = hardenedRouter.boot.kernel.sysctl."net.ipv4.conf.default.rp_filter" == 2;
            "the router keeps strict rp_filter on its WAN interface" = hardenedRouter.boot.kernel.sysctl."net.ipv4.conf.wan0.rp_filter" == 1;
          }
        );

      # protectKernelImage disables hibernation, so the profile has to refuse a
      # host configured to hibernate, by either signal it reads. The last
      # expectation keeps the assertion from firing on a host that does not.
      eval-host-hardening-hibernate = let
        needle = "othrys.system.hardening.protectKernelImage";
      in
        mkExpectations "othrys-eval-host-hardening-hibernate" {
          "boot.resumeDevice is rejected" = rejectedWith needle (hibernatingHost {boot.resumeDevice = "/dev/disk/by-label/swap";});
          "a resume= kernel parameter is rejected" = rejectedWith needle (hibernatingHost {boot.kernelParams = ["resume=LABEL=swap"];});
          "a host that does not hibernate is accepted" = !rejectedWith needle hardenedHost;
        };

      eval-impermanence = import ./impermanence-eval.nix {inherit impermanenceModules hostConfig mkExpectations rejectedWith bootBase diskoModules;};

      # A host with no upstream module at all, a host that imports each
      # export, and a host built from the aggregate (see
      # ./exports-optional-eval.nix).
      eval-optional-exports = import ./exports-optional-eval.nix {
        inherit inputs system impermanenceModules hostEval mkExpectations rejectedWith bootBase functioningHost diskoModules secretsModules stylixModules;
        inherit darwinEval darwinBase darwinHomeModules darwinStylixModules darwinSecretsModules darwinFullHost;
      };

      # What the app and desktop modules persist, read back on an impermanence
      # host without a managed account and on one with (see ./persistence-eval.nix).
      eval-persistence = import ./persistence-eval.nix {inherit impermanenceModules hostConfig mkExpectations bootBase functioningHost appDesktopModules;};
      # What the service modules persist under impermanence (see ./service-state-eval.nix).
      eval-service-state = import ./service-state-eval.nix {inherit impermanenceModules hostConfig mkExpectations bootBase;};

      eval-lock = import ./lock.nix {inherit hostConfig mkExpectations rejectedWith functioningHost;};
      eval-login = import ./login.nix {inherit hostConfig mkExpectations rejectedWith functioningHost;};

      # What the desktop modules, kitty and ghostty write (see ./desktop-eval.nix).
      eval-desktop = import ./desktop-eval.nix {
        inherit (inputs.nixpkgs) lib;
        inherit hostConfig mkExpectations rejectedWith bootBase functioningHost stylixModules;
      };

      # What the Vicinae module writes, persists and refuses, and the launcher
      # chord on both compositors (see ./vicinae-eval.nix).
      eval-vicinae = import ./vicinae-eval.nix {
        inherit (inputs.nixpkgs) lib;
        inherit impermanenceModules stylixModules hostConfig mkExpectations rejectedWith bootCore functioningHost accountNoHomeManager;
      };

      # The Secret Service provider each keyring setting selects, and what the
      # module refuses (see ./keyring-eval.nix).
      eval-keyring = import ./keyring-eval.nix {
        inherit (inputs.nixpkgs) lib;
        inherit impermanenceModules hostConfig mkExpectations rejectedWith bootBase functioningHost accountNoHomeManager;
      };

      # The theme interface with and without the Stylix adapter (see
      # ./theme-eval.nix).
      eval-theme = import ./theme-eval.nix {
        inherit (inputs.nixpkgs) lib;
        inherit hostConfig mkExpectations rejectedWith functioningHost stylixModules;
      };

      # The wallpaper daemon's configuration for each form of
      # othrys.theme.wallpaper.source (see ./wallpaper-eval.nix).
      eval-wallpaper = import ./wallpaper-eval.nix {
        inherit (inputs.nixpkgs) lib;
        inherit hostConfig mkExpectations rejectedWith bootBase functioningHost stylixModules;
      };

      # Every conflict and dependency assertion that takes two modules or
      # two options to fire (see ./pairs.nix).
      eval-pairs = import ./pairs.nix {inherit impermanenceModules hostConfig mkExpectations rejectedWith bootBase functioningHost secretsModules;};

      # Three clauses of the consumer contract, read back from evaluation
      # (see ./contract-eval.nix).
      eval-contract = import ./contract-eval.nix {
        inherit impermanenceModules homeModules inputs hostEval mkExpectations templateHost darwinTemplateHost moduleHelpers;
        inherit functioningHost accountNoHomeManager appDesktopModules serverModules;
        inherit darwinEval darwinBase darwinHomeModules darwinAppHost darwinFullHost darwinManagedBase darwinServiceHosts;
      };

      # Where the modules take ashell, Hyprland, nixvim and nix-index-database
      # from, on a host that is handed no specialArgs (see ./inputs-eval.nix).
      eval-inputs = import ./inputs-eval.nix {
        inherit inputs system defaultModules secretsModules functioningHost mkExpectations;
      };

      # The check names in .github/workflows/build.yml, held to the checks
      # defined here (see ./ci-coverage.nix).
      ci-coverage = import ./ci-coverage.nix {inherit pkgs inputs;};

      # The same contract over every app and desktop module that writes per-user
      # configuration. It is an evaluation, and only the wrapper that records
      # the derivation path is built, so it runs in CORE beside
      # eval-persistence, which evaluates the same module set twice. It is the
      # only fixture that proves the claim for all of them rather than for four.
      eval-host-app-no-hm-full = mkHostEval "othrys-eval-host-app-no-hm-full" [
        accountNoHomeManager
        appDesktopModules
      ];

      # EXTENDED, heavy, one runner each

      # Whole-tree evaluation over the minimal host plus Stylix through the
      # adapter and the mangohud settings merge (Stylix themes mangohud too, and
      # this pairing caught the mangohud x Stylix conflict). Heavier GUI apps
      # (floorp, vesktop) are left out so this doesn't pull a browser/Electron
      # closure. Their merges are trivial `//` unions covered by plain eval + parse.
      eval-default = mkHostEval "othrys-eval-default" [
        functioningHost
        stylixModules
        {
          othrys.system.shell.zsh.enable = true;
          othrys.system.stylix.enable = true;
          othrys.apps.gaming.mangohud.enable = true;
        }
      ];

      # The disk shape of an encrypted workstation, the disko layout with FIDO2
      # unlock beside impermanence, built to its top level so every assertion
      # runs. A removed nixpkgs option set by one of these modules shows only
      # as a failed assertion, which no expectation-only check reads.
      eval-host-encrypted = mkHostEval "othrys-eval-host-encrypted" [
        functioningHost
        impermanenceModules
        diskoModules
        {
          fileSystems = {
            "/nix" = {
              device = "/dev/disk/by-label/nix";
              fsType = "btrfs";
            };
            "/persist" = {
              device = "/dev/disk/by-label/persist";
              fsType = "btrfs";
            };
          };
          othrys.system.impermanence.enable = true;
          # The layout's filesystems would collide with the fixture's root, so
          # disko declares none, and the LUKS device it would name is named here.
          disko.enableConfig = false;
          boot.initrd.luks.devices.cryptroot.device = "/dev/disk/by-id/example-part3";
          othrys.system.disko = {
            enable = true;
            device = "/dev/disk/by-id/example";
            luks.fido2.enable = true;
          };
        }
      ];

      # Desktop-session surface with MODULE DEFAULTS, covering compositor, bar, login,
      # session manager, prompt, none of which eval-default covers. Notably
      # hyprland is evaluated with its default (unnamed) monitor config, which
      # once crashed workspace auto-generation, so this check pins enable-with-
      # defaults working for the whole desktop stack. Stylix is on through the
      # adapter here, so both compositors are evaluated beside its targets.
      eval-host-desktop = mkHostEval "othrys-eval-host-desktop" [
        functioningHost
        stylixModules
        {
          othrys.system.stylix.enable = true;
          othrys.system.shell.zsh.enable = true;
          othrys.system.shell.starship.enable = true;
          othrys.desktop.compositors.hyprland.enable = true;
          othrys.desktop.ashell.enable = true;
          othrys.desktop.uwsm.enable = true;
          othrys.desktop.login = {
            enable = true;
            defaultDesktop = "hyprland";
          };
          othrys.services.automount.enable = true;
          othrys.desktop.graphical = true;
          othrys.desktop.idle.enable = true;
          othrys.desktop.nightLight = {
            enable = true;
            latitude = 0.0;
            longitude = 0.0;
          };
          othrys.hardware.scanner.enable = true;
          # Pins two failure classes, an unfree package inside home-manager
          # (needs useGlobalPkgs to see nixpkgs.config.allowUnfree) and a
          # dereference across two Home Manager modules (vscode reads nixvim's
          # package inside the user's configuration).
          # allowUnfree is opt-in, so a host wanting claude-code says so.
          othrys.system.nix.allowUnfree = true;
          othrys.apps.ai.claude-code.enable = true;
          othrys.apps.nixvim.enable = true;
          othrys.apps.vscode.enable = true;
          # Exercise the shared language toolchain path, from signal to shared
          # binaries on PATH -> both editors pointing at them.
          othrys.apps.languages.nix.enable = true;
          othrys.apps.languages.python.enable = true;
          # Both compositors enabled at once (greeter picks the session):
          # coexistence must eval, with one graphical flag and two config surfaces.
          othrys.desktop.compositors.niri.enable = true;
        }
      ];

      # Niri-only desktop with ashell. Login starts niri-session directly and
      # defaultDesktop stays UNSET, pinning that sessionCommand doesn't force
      # the uwsm-path option. No Stylix module is imported, so niri and the bar
      # take their colours from othrys.theme alone.
      eval-host-desktop-niri = mkHostEval "othrys-eval-host-desktop-niri" [
        functioningHost
        {
          othrys.desktop.compositors.niri.enable = true;
          othrys.desktop.ashell.enable = true;
          othrys.desktop.login = {
            enable = true;
            sessionCommand = "niri-session";
          };
        }
      ];

      # The export list, held to the module tree (see ./exports-eval.nix).
      eval-exports = import ./exports-eval.nix {inherit pkgs inputs moduleHelpers;};

      # The default template, as templateHost above instantiates it. A
      # template that stops matching the consumer contract, or the required
      # options, fails here instead of in a new user's first build.
      #
      # The host the template describes also has to be one somebody can log
      # in to. It ships a bootstrap hash rather than a secrets path, since no
      # secrets module is enabled there and a path under /run/secrets/ is
      # installed after the account is created. Both facts are read back.
      #
      # The shipped hash is a placeholder, and NixOS says so with its "may be
      # invalid" notice, which is the right message for a template built
      # unedited. That one warning is expected, and any other means an othrys
      # module objects to the template as shipped.
      eval-template = let
        template = templateHost.config;
        account = template.users.users.${template.othrys.system.user.name};
      in
        pkgs.runCommand "othrys-eval-template" {
          drv = builtins.unsafeDiscardStringContext template.system.build.toplevel.drvPath;
          passwordFile = toString account.hashedPasswordFile;
          hasBootstrapHash =
            if account.initialHashedPassword != null && account.initialHashedPassword != ""
            then "1"
            else "0";
          warningCount = toString (builtins.length (builtins.filter (w: !inputs.nixpkgs.lib.hasInfix "password hash" w) template.warnings));
        } ''
          [ -z "$passwordFile" ] || {
            echo "template: passwordFile is set to $passwordFile, but the template enables no secrets module" >&2
            exit 1
          }
          [ "$hasBootstrapHash" = 1 ] || {
            echo "template: initialHashedPassword is unset, so the account has no password" >&2
            exit 1
          }
          [ "$warningCount" = 0 ] || {
            echo "template: evaluates with $warningCount warning(s)" >&2
            exit 1
          }
          echo "$drv" > "$out"
        '';

      # The darwin template, as darwinTemplateHost above instantiates it. On
      # a Mac its toplevel is built, and elsewhere its derivation is
      # recorded, as for the other darwin hosts. A warning means an othrys
      # module objects to the template as shipped, and so does an account
      # that comes out without Home Manager or a Nix other than Lix.
      eval-darwin-template = let
        template = darwinTemplateHost.config;
        toplevel = template.system.build.toplevel;
      in
        pkgs.runCommand "othrys-eval-darwin-template" {
          drv = builtins.unsafeDiscardStringContext toplevel.drvPath;
          built =
            if pkgs.stdenv.hostPlatform.isDarwin
            then toplevel
            else "";
          warningCount = toString (builtins.length template.warnings);
          nixName = pkgs.lib.getName template.nix.package;
          homeManaged =
            if template.home-manager.users ? alice
            then "1"
            else "0";
        } ''
          [ "$warningCount" = 0 ] || {
            echo "darwin template: evaluates with $warningCount warning(s)" >&2
            exit 1
          }
          [ "$nixName" = lix ] || {
            echo "darwin template: nix.package is $nixName, not Lix" >&2
            exit 1
          }
          [ "$homeManaged" = 1 ] || {
            echo "darwin template: Home Manager does not manage alice" >&2
            exit 1
          }
          echo "$drv" > "$out"
        '';

      # The dev shells, held to the hooks they claim to install. The default
      # shell has to match pre-commit-check, and the consumer shell has to
      # carry no hook that reads this repository's own tree. It is also the
      # one check that evaluates the dev shells on every system.
      eval-dev-shells = let
        inherit (inputs.nixpkgs) lib;
        default = config.devShells.default.hookIds;
        consumer = config.devShells.consumer.hookIds;
        portable = builtins.attrNames portableHooks;
        repository = builtins.attrNames repositoryHooks;
      in
        mkExpectations "othrys-eval-dev-shells" {
          "the default shell installs every portable hook" = lib.all (hook: builtins.elem hook default) portable;
          "the default shell installs every repository hook" = lib.all (hook: builtins.elem hook default) repository;
          "the default shell installs what pre-commit-check runs and nothing else" = default == lib.sort builtins.lessThan (portable ++ repository);
          "the consumer shell installs every portable hook" = lib.all (hook: builtins.elem hook consumer) portable;
          "the consumer shell installs no repository hook" = !(lib.any (hook: builtins.elem hook consumer) repository);
          "the four repository hooks are the ones expected" = repository == ["comment-hygiene" "contract-guards" "contract-mirror" "hygiene-scan"];
          "the hygiene hook scans filenames in a clean CI checkout" = repositoryHooks.hygiene-scan.pass_filenames;
        };

      # Start-up defaults of Suricata and CrowdSec (see ./router-services.nix).
      eval-router-services = import ./router-services.nix {inherit hostConfig mkExpectations rejectedWith bootBase;};
      eval-router = import ./router-eval.nix {inherit hostConfig hostEval mkExpectations rejectedWith bootBase;};
      eval-headscale = import ./headscale-eval.nix {inherit impermanenceModules hostConfig mkExpectations rejectedWith bootBase;};
      eval-tailscale = import ./tailscale-eval.nix {inherit hostConfig mkExpectations bootBase;};
      eval-exposure = import ./exposure-eval.nix {inherit impermanenceModules hostConfig mkExpectations rejectedWith bootBase functioningHost;};
      eval-claude-code = import ./claude-code-eval.nix {inherit impermanenceModules hostConfig mkExpectations rejectedWith functioningHost bootBase inputs system;};
      # What the codex module hands Codex (see ./codex-eval.nix).
      eval-codex = import ./codex-eval.nix {inherit hostConfig mkExpectations functioningHost inputs system;};
      # What the claude-desktop module installs, refuses and merges (see ./claude-desktop-eval.nix).
      eval-claude-desktop = import ./claude-desktop-eval.nix {inherit hostConfig mkExpectations rejectedWith functioningHost inputs system;};
      # The claude-desktop activation step, run against fixture files (see ./claude-desktop-activation.nix).
      claude-desktop-activation = import ./claude-desktop-activation.nix {inherit pkgs hostConfig functioningHost;};
      # The project-environment launcher, run around a stand-in agent in
      # temporary projects with and without an .envrc and in git worktrees
      # (see ./project-environment-launcher.nix). It builds the launcher for
      # the system it runs on, so a Mac runs it too.
      project-environment-launcher = import ./project-environment-launcher.nix {inherit pkgs hostConfig darwinConfig bootBase darwinBase;};
      # What the orca module installs, persists and opens (see ./orca-eval.nix).
      eval-orca = import ./orca-eval.nix {inherit hostConfig mkExpectations rejectedWith functioningHost inputs system;};
      # What the t3code module installs, runs, opens and persists (see ./t3code-eval.nix).
      eval-t3code = import ./t3code-eval.nix {
        inherit (inputs.nixpkgs) lib;
        inherit hostConfig mkExpectations rejectedWith functioningHost accountNoHomeManager;
      };
      # What the paseo module installs, runs, opens and persists, and the
      # serve script's lines for each setting (see ./paseo-eval.nix).
      eval-paseo = import ./paseo-eval.nix {
        inherit (inputs.nixpkgs) lib;
        inherit hostConfig hostEval mkExpectations rejectedWith functioningHost accountNoHomeManager inputs system;
      };
      # The paseo serve script, run around a stand-in paseo-server against
      # fixture config.json files (see ./paseo-serve.nix). It builds the
      # script for the system it runs on, so a Mac runs it too.
      paseo-serve = import ./paseo-serve.nix {inherit pkgs hostConfig darwinConfig bootBase darwinBase;};
      # What the WSL adapter hands NixOS-WSL and which modules it refuses
      # beside it (see ./wsl-eval.nix).
      eval-wsl = import ./wsl-eval.nix {
        inherit inputs hostEval mkExpectations rejectedWith wslModules diskoModules impermanenceModules;
      };

      # The committed Claude Code configuration, read as files, and the hook
      # program it runs. Every agent, skill and command carries a description
      # and known keys, every skill name matches its directory, the hooks sit
      # behind the dev-shell gate (see ./agent-config.py), and the hook refuses
      # what it must (see ./agent-hook-test.py).
      agent-config =
        pkgs.runCommand "othrys-agent-config" {
          nativeBuildInputs = [agentConfig agentHook hygieneScan pkgs.git (pkgs.python3.withPackages (ps: [ps.pytest]))];
        } ''
          agent-config ${inputs.self}
          # pytest takes the common directory of what it is handed as its
          # root and collects it, and for a store path that is /nix/store,
          # which the macOS build sandbox does not let a build list. A copy
          # in the build directory keeps the root there.
          cp ${./agent-hook-test.py} "$TMPDIR/agent_hook_test.py"
          HOME=$TMPDIR OTHRYS_ROOT=${inputs.self} python3 -m pytest -q -p no:cacheprovider \
            --rootdir "$TMPDIR" "$TMPDIR/agent_hook_test.py"
          touch $out
        '';
      # What the gh module renders, wraps and pre-approves (see ./gh-eval.nix).
      eval-gh = import ./gh-eval.nix {
        inherit (inputs.nixpkgs) lib;
        inherit hostConfig mkExpectations functioningHost bootBase;
      };
      eval-k3s = import ./k3s-eval.nix {inherit impermanenceModules hostConfig hostEval mkExpectations rejectedWith bootBase;};
      eval-pam = import ./pam-eval.nix {inherit hostConfig mkExpectations rejectedWith functioningHost;};
      eval-containers = import ./containers-eval.nix {inherit hostConfig mkExpectations rejectedWith functioningHost;};
      eval-nix = import ./nix-eval.nix {inherit hostConfig mkExpectations rejectedWith bootBase functioningHost inputs;};
      eval-grafana = import ./grafana-eval.nix {inherit hostConfig mkExpectations rejectedWith functioningHost;};
      eval-listen = import ./listen-eval.nix {inherit hostConfig mkExpectations functioningHost;};
      eval-shell = import ./shell-eval.nix {inherit hostConfig mkExpectations bootBase functioningHost;};
      eval-floorp = import ./floorp-eval.nix {inherit hostConfig mkExpectations functioningHost;};
      eval-chromium = import ./chromium-eval.nix {
        inherit (inputs.nixpkgs) lib;
        inherit pkgs hostConfig mkExpectations rejectedWith functioningHost bootBase bootCore homeModules accountNoHomeManager;
      };

      # Which binaries nixvim and vscode take from the language registry (see
      # ./languages-eval.nix).
      eval-languages = import ./languages-eval.nix {
        inherit (inputs.nixpkgs) lib;
        inherit hostConfig mkExpectations functioningHost;
      };

      # What the hardware, mount and disk modules write (see ./hardware-eval.nix).
      # What the GameMode, Steam and ntsync modules grant the user (see ./gaming-eval.nix).
      eval-gaming = import ./gaming-eval.nix {inherit hostConfig mkExpectations rejectedWith bootBase functioningHost inputs;};

      eval-hardware = import ./hardware-eval.nix {inherit hostConfig mkExpectations rejectedWith bootBase functioningHost diskoModules inputs;};

      # What the smaller service modules pass upstream and refuse (see ./services-eval.nix).
      eval-services = import ./services-eval.nix {inherit impermanenceModules hostConfig mkExpectations rejectedWith functioningHost inputs;};
      eval-auto-upgrade = import ./auto-upgrade-eval.nix {inherit hostConfig mkExpectations rejectedWith functioningHost;};

      # What the option types and the named assertions refuse (see ./types-eval.nix).
      eval-types = import ./types-eval.nix {inherit impermanenceModules homeModules hostConfig mkExpectations rejectedWith bootBase functioningHost inputs;};

      # Which NVIDIA driver, kernel modules and container toolkit a host gets (see ./nvidia.nix).
      eval-nvidia = import ./nvidia.nix {inherit hostConfig mkExpectations functioningHost inputs;};

      # What the Remmina module hands Home Manager and persists (see ./remmina.nix).
      eval-remmina = import ./remmina.nix {inherit impermanenceModules hostConfig mkExpectations functioningHost;};

      # What the RustDesk module persists and launches (see ./rustdesk.nix).
      eval-rustdesk = import ./rustdesk.nix {inherit impermanenceModules hostConfig mkExpectations functioningHost;};

      # The SSH known hosts and client defaults (see ./ssh.nix).
      eval-ssh = import ./ssh.nix {inherit hostConfig mkExpectations functioningHost;};

      # The SSH server's ports, firewall, jail and hardened defaults (see ./ssh-eval.nix).
      eval-ssh-settings = import ./ssh-eval.nix {inherit hostConfig mkExpectations functioningHost;};

      # The Traefik TLS floor, header defaults and TCP routers (see ./traefik.nix).
      eval-traefik = import ./traefik.nix {inherit hostConfig mkExpectations rejectedWith bootBase;};

      # What the soju module hands services.soju, Traefik and the firewall,
      # what it persists and what it refuses (see ./soju-eval.nix).
      eval-soju = import ./soju-eval.nix {
        inherit (inputs.nixpkgs) lib;
        inherit impermanenceModules hostConfig mkExpectations rejectedWith bootBase;
      };

      # What the senpai module hands Home Manager on NixOS, what it persists
      # and what it refuses (see ./senpai-eval.nix). eval-darwin reads the
      # darwin half.
      eval-senpai = import ./senpai-eval.nix {
        inherit (inputs.nixpkgs) lib;
        inherit impermanenceModules hostConfig mkExpectations rejectedWith functioningHost inputs system;
      };

      # EXTENDED. The ashell bar config for a desktop and a laptop (see ./ashell.nix).
      eval-ashell = import ./ashell.nix {
        inherit (inputs.nixpkgs) lib;
        inherit hostConfig mkExpectations functioningHost;
      };

      # EXTENDED. Enable-with-defaults matrix (see ./enable-matrix.nix).
      enable-matrix = import ./enable-matrix.nix {
        inherit impermanenceModules pkgs inputs system defaultModules stylixModules diskoModules secretsModules bootCore bootBase functioningHost;
      };

      # EXTENDED. Runtime VM tests, one file each.
      integration-test = import ./integration.nix {inherit pkgs inputs;};
      listeners-test = import ./listeners.nix {inherit pkgs inputs;};
      restic-test = import ./restic.nix {inherit pkgs inputs hostConfig rejectedWith bootBase;};
      crowdsec-test = import ./crowdsec.nix {inherit pkgs inputs;};
      headscale-test = import ./headscale.nix {inherit pkgs inputs;};
      impermanence-reboot-test = import ./impermanence-reboot.nix {inherit pkgs inputs;};
      impermanence-wipe-test = import ./impermanence-wipe.nix {inherit pkgs inputs;};
      router-test = import ./router.nix {inherit pkgs inputs;};
      router-ips-test = import ./router-ips.nix {inherit pkgs inputs;};
      auto-upgrade-test = import ./auto-upgrade.nix {inherit pkgs inputs;};
      wallpaper-test = import ./wallpaper.nix {inherit pkgs inputs;};
      keyring-test = import ./keyring.nix {inherit pkgs inputs;};
      soju-test = import ./soju.nix {inherit pkgs inputs;};

      # EXTENDED. The onboarding script's dry run in a VM (see ./yubikey-onboard.nix).
      yubikey-onboard-dry-run = import ./yubikey-onboard.nix {
        inherit pkgs;
        package = config.packages.yubikey-onboard;
      };

      # CORE. The onboarding script's package builds. writeShellApplication
      # runs shellcheck and `bash -n` over the script at build time, and
      # `nix flake check` evaluates a package without building it, so this
      # check is the only place either runs.
      yubikey-onboard-builds = config.packages.yubikey-onboard;

      # CORE. Pre-commit hooks check (treefmt formats, statix and deadnix lint,
      # comment-hygiene enforces the CONTRIBUTING.md comment conventions).
      pre-commit-check = inputs.git-hooks.lib.${system}.run {
        src = inputs.self;
        hooks = portableHooks // repositoryHooks;
      };

      # CORE. The hook above only sees what one commit stages. This scans every
      # tracked file, so a secret that arrived any other way still fails CI.
      secret-scan =
        pkgs.runCommand "othrys-secret-scan" {
          nativeBuildInputs = [pkgs.gitleaks];
        } ''
          gitleaks dir ${inputs.self} --redact --no-banner
          touch $out
        '';

      # CORE. The comment conventions in CONTRIBUTING.md are only a convention
      # until something fails on them. The 56 banner rules this check now
      # rejects accumulated while a written rule against them already existed.
      comment-hygiene =
        pkgs.runCommand "othrys-comment-hygiene" {
          nativeBuildInputs = [commentHygiene];
        } ''
          cd ${inputs.self}
          comment-hygiene
          touch $out
        '';

      # CORE. The consumer contract, enforced rather than described. The
      # home-manager clause held for twenty of fifty-two modules while the prose
      # said all of them, and nothing failed, because the fixtures never enabled
      # an app module on a host without a managed user.
      contract-guards =
        pkgs.runCommand "othrys-contract-guards" {
          nativeBuildInputs = [contractGuards];
        } ''
          cd ${inputs.self}
          contract-guards
          touch $out
        '';

      # CORE. Every include and every relative link in docs/src resolves. mdbook
      # exits 0 on an include it cannot read, so a renamed anchor or a moved
      # file leaves a gap in the rendered page unless something else fails. The
      # fixtures run first and show that each broken case does fail. The
      # options reference is generated, so links to it are accepted here and
      # resolved in the docs check below, which has the file.
      docs-includes =
        pkgs.runCommand "othrys-docs-includes" {
          nativeBuildInputs = [docsIncludes docsIncludesFixtures];
        } ''
          docs-includes-fixtures
          cd ${inputs.self}
          docs-includes docs/src --generated reference/options.md
          touch $out
        '';

      # CORE. The book builds. The generated options reference is injected
      # first (see flake/docs-options.nix), then the resolver runs over the
      # complete source and fails the build on a missing include, anchor, page
      # or heading before mdbook renders anything.
      docs = pkgs.stdenv.mkDerivation {
        name = "othrys-docs";
        src = inputs.self;
        nativeBuildInputs = [pkgs.mdbook docsIncludes];
        buildPhase = ''
          install -m644 ${config.packages.options-doc} docs/src/reference/options.md
          docs-includes docs/src
          mdbook build docs/
        '';
        installPhase = "cp -r docs/book $out";
      };

      # CORE. The impermanence root-wipe invariant (see ./impermanence.nix).
      impermanence-test = import ./impermanence.nix {inherit pkgs inputs;};
    };

This repository holds no hosts, so host build checks belong to the consuming fleet flake.

Documentation Includes

mdbook logs an include it cannot read, renders the page with nothing in its place and exits 0. The docs-includes check is what fails instead. It runs flake/checks/docs-includes.py over docs/src, which resolves each include relative to the page that holds it and reports the page, the directive and the reason when the file is missing, when the named anchor has no ANCHOR: and ANCHOR_END: pair in the target, or when a line range starts past the end of the file. The same pass reports a relative link to a page that does not exist and a #fragment that matches no heading in the page it points at.

The docs check runs the resolver again before mdbook build, with the generated options reference in place, so links into that page are resolved there. The script needs only Python and runs from a checkout:

python3 flake/checks/docs-includes.py docs/src --generated reference/options.md

Running Locally

just ci       # Full CI (lint plus flake check)
just lint     # Just linting
just check    # Just flake check