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

Mount Othrys

othrys.nix

A reusable NixOS module library of composable, opt-in modules under a unified othrys.* namespace, spanning workstation, server, router and security. It is consumed as a flake input by a private fleet repository that holds the actual host configurations.

Design Principles

  • Library, not config. This repository exports modules. Hosts, secrets and identity live in the consuming flake.
  • Capabilities curated, opinions configurable. Modules define what can be done, such as window focus, an nftables router ruleset or alias groups. Options decide the keys, interfaces, apps and workflow.
  • Identity-free. No usernames, domains, keys or hardware IDs are baked in. Everything personal arrives through options with neutral defaults.
  • Flakes with flake-parts for modular, reproducible structure.
  • Impermanence. An ephemeral root filesystem with opt-in persistence.
  • One namespace. Every custom option lives under othrys.*.
  • Home Manager integrated as a NixOS module rather than standalone.
  • One theme. A base16 palette under othrys.theme that every module reads, with Stylix as an optional adapter.

How This Book Is Organized

  • Architecture. How the flake and modules fit together, and the contract a consuming flake must satisfy.
  • System Infrastructure. Disk partitioning, impermanence, bootloader, secrets.
  • Module Reference. One page per module category with options and code snippets.
  • Guides. Step-by-step walkthroughs for common tasks.
  • Development. Dev shells, CI, linting.
  • Reference. Justfile commands, all module options, keybindings.

Overview

othrys.nix is a public NixOS module library built with flake-parts. It exports reusable modules under the othrys.* namespace; host configurations live in a separate private fleet flake that consumes this one as an input (see Host Configuration).

Repository Structure

flake.nix                    # Flake entrypoint (no hosts, no secrets)
flake/                       # Flake-parts modules
  ├── modules.nix            # Exported nixosModules (incl. aggregates `default` and `full`)
  ├── templates.nix          # `nix flake init` starting points
  ├── packages.nix           # Packaged scripts and tools
  ├── dev-shells.nix         # Development environments
  ├── treefmt.nix            # Multi-language formatter (nix fmt)
  ├── docs-options.nix       # Generated othrys.* options reference
  └── checks/                # Flake checks, with each VM test and read-back in its own file
modules/                     # Reusable NixOS modules (othrys.* namespace)
  ├── system/                # System fundamentals
  │   ├── user.nix           # Primary user identity option
  │   ├── users.nix          # User options and the Home Manager registry
  │   ├── users.nixos.nix    # The account, shell and essential packages
  │   ├── home.nix           # Home Manager adapter, a separate export
  │   ├── locale.nix         # Locale, timezone, console
  │   ├── nix.nix            # Nix daemon, substituters, GC
  │   ├── kernel.nix         # Kernel selection
  │   ├── hardening.nix      # Opt-in kernel and sysctl hardening
  │   ├── networking.nix     # systemd-networkd interfaces, bridges, VLANs
  │   ├── auto-upgrade.nix   # Unattended upgrades with signature verification
  │   ├── bootloader.nix     # Bootloader + Secure Boot
  │   ├── disko.nix          # Disk layout, exported on its own
  │   ├── ephemeral-root.nix # Ephemeral root wipe
  │   ├── impermanence.nix   # Impermanence adapter, a separate export
  │   ├── persistence.nix    # Persistence registry, also declared on darwin
  │   ├── persistence.nixos.nix # The system-critical set
  │   ├── secrets.nix        # Secrets options and what both platforms write
  │   ├── secrets.nixos.nix  # sops-nix plumbing, exported on its own
  │   ├── secrets.darwin.nix # sops-nix plumbing for darwin
  │   ├── git.nix            # Git configuration
  │   └── shell/             # Shell (Zsh, Bash, Starship)
  ├── theme/                 # The theme every module reads
  │   ├── default.nix        # othrys.theme: palette, fonts, opacity, wallpaper
  │   ├── schemes/           # Colour schemes as Nix data
  │   ├── stylix.nix         # Stylix adapter options and shared writes
  │   ├── stylix.nixos.nix   # Stylix adapter, exported on its own
  │   └── stylix.darwin.nix  # Stylix adapter for darwin
  ├── desktop/               # Desktop environment
  │   ├── compositors/       # Hyprland, Niri
  │   ├── ashell/            # Status bar
  │   ├── login.nix          # greetd login manager
  │   ├── idle.nix           # Staged idle policy
  │   ├── keyring.nix        # Secret Service provider
  │   ├── night-light.nix    # Color temperature shifting
  │   ├── uwsm.nix           # Session management
  │   └── wallpaper.nix      # Wallpaper daemon
  ├── hardware/              # Hardware
  │   ├── audio.nix          # PipeWire audio
  │   ├── webcam.nix         # Webcam support
  │   ├── scanner.nix        # SANE scanning
  │   ├── smart.nix          # Disk health monitoring
  │   ├── ups.nix            # UPS monitoring (NUT)
  │   ├── usb.nix            # USB utilities
  │   ├── graphics/          # NVIDIA, PRIME offload, shader cache
  │   ├── laptop/            # Laptop features + specific models
  │   └── wireless/          # Bluetooth, WiFi
  ├── services/              # Services
  │   ├── security/          # Sudo, Polkit, YubiKey, fail2ban, CrowdSec
  │   ├── containerization/  # Podman, Docker, k3s
  │   ├── mounts/            # Disk and CIFS mounts
  │   └── *.nix              # SSH, Tailscale, router, Traefik, monitoring, etc.
  ├── apps/                  # Applications
  │   ├── cli/               # nixvim, ai (claude-code, ollama, mcp), gh, yazi, ...
  │   ├── gui/               # floorp, ghostty, gaming/, vscode, ...
  │   └── languages/         # Per-language toolchains shared by both editors
  └── lib/                   # Shared option types, address helpers, the systemd sandbox baseline, the sshd settings
templates/                   # The `nix flake init` templates, default and darwin
scripts/                     # Operational scripts
  └── yubikey-onboard.sh     # YubiKey provisioning (PGP, U2F, age)
docs/                        # This book

The consuming fleet flake holds everything machine- or person-specific: host configurations, shared profiles, fleet data (SSH host maps, cache keys, YubiKey identities), and the private secrets input.

Flake Inputs

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";

    # Flake framework for modular configuration
    flake-parts = {
      url = "github:hercules-ci/flake-parts";
      inputs.nixpkgs-lib.follows = "nixpkgs";
    };

    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # nix-darwin, the module system a macOS host is built with. The darwin
    # exports are written against it, and the darwin host checks evaluate
    # with its darwinSystem.
    nix-darwin = {
      url = "github:nix-darwin/nix-darwin";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    hyprland = {
      # Deliberately does not follow nixpkgs, for cache hits rather than for
      # any build failure. Upstream builds against its own pin, so
      # hyprland.cachix.org serves the exact derivations this flake asks for.
      # Adding `follows` while still reading inputs.hyprland.packages changes
      # those hashes and puts every consumer on a source build, which is the
      # one combination to avoid.
      #
      # nixpkgs carries hyprland too, so defaulting to pkgs.hyprland with
      # mkDefault (what the niri module does) is viable and would drop the
      # second nixpkgs this input costs. Left alone because no check here can
      # prove a packaging swap leaves a live session behaving the same.
      url = "github:hyprwm/Hyprland";
      # Only upstream's own checks and dev shell read this, so following ours
      # leaves the package hashes alone and drops a second copy from the lock.
      inputs.pre-commit-hooks.follows = "git-hooks";
    };

    ashell = {
      url = "github:MalpenZibo/ashell";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # Packages for AI agents and their desktop clients, the default of the
    # package options of the claude-code, codex, claude-desktop and orca
    # modules. Like hyprland it does not follow nixpkgs. Upstream builds and
    # tests against its own pin, and cache.numtide.com serves those exact
    # derivations, so following ours would put every consumer on a local
    # build of each package.
    llm-agents = {
      url = "github:numtide/llm-agents.nix";
      # Only upstream's own outputs and checks read these, so following ours
      # leaves the package hashes alone and drops a copy from the lock.
      inputs.flake-parts.follows = "flake-parts";
      inputs.treefmt-nix.follows = "treefmt-nix";
    };

    # The Paseo plugin that loads each agent's direnv environment, the
    # default of othrys.apps.ai.paseo.direnv.package. Its package is the
    # plugin's TypeScript source, which Paseo compiles when it loads it, so
    # following our nixpkgs costs no cache hit. Only a host with Paseo and
    # its direnv option on reads it, and no other host fetches it.
    paseo-direnv = {
      url = "github:MatthewDeSouza/paseo-direnv";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # Niri compositor, packages plus the typed programs.niri.settings module
    # (build-time-validated KDL config). Self-contained, since the compositor
    # module imports its NixOS module directly, and its auto-cache is disabled in
    # favor of the curated substituter list in othrys.system.nix.
    niri = {
      url = "github:sodiboo/niri-flake";
      inputs.nixpkgs.follows = "nixpkgs";
      # niri-flake builds its own niri-stable package against nixpkgs-stable.
      # The compositor module takes niri from pkgs and never reads that
      # package, so the second nixpkgs follows ours and leaves the lock.
      inputs.nixpkgs-stable.follows = "nixpkgs";
    };

    # Declarative disk partitioning
    disko = {
      url = "github:nix-community/disko";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # NixOS-WSL, the module a host running as a WSL distro is built with,
    # written into by the optional nixosModules.wsl export. Its flake-compat
    # input is a plain source tree that no output reads.
    nixos-wsl = {
      url = "github:nix-community/NixOS-WSL";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # Nix-index database, a prebuilt index for comma and nix-locate
    nix-index-database = {
      url = "github:nix-community/nix-index-database";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # Impermanence, opt-in state persistence
    impermanence = {
      url = "github:nix-community/impermanence";
      inputs.nixpkgs.follows = "nixpkgs";
      inputs.home-manager.follows = "home-manager";
    };

    # Nixvim - Neovim configuration with Nix modules
    nixvim = {
      url = "github:nix-community/nixvim";
      inputs.nixpkgs.follows = "nixpkgs";
      inputs.flake-parts.follows = "flake-parts";
    };

    # Stylix - System-wide theming using base16
    stylix = {
      url = "github:nix-community/stylix";
      inputs.nixpkgs.follows = "nixpkgs";
      inputs.flake-parts.follows = "flake-parts";
    };

    # Git hooks for pre-commit validation
    git-hooks = {
      url = "github:cachix/git-hooks.nix";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # Multi-language formatting (drives `nix fmt` + the treefmt pre-commit hook)
    treefmt-nix = {
      url = "github:numtide/treefmt-nix";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # Secrets management with age encryption
    sops-nix = {
      url = "github:Mic92/sops-nix";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # Lanzaboote, Secure Boot for systemd-boot. Pinned to a release tag, which
    # is what upstream asks consumers to track. No module imports it. It is
    # here so flake/checks can evaluate the systemd-boot Secure Boot path, and
    # a consumer who wants that path imports the module from their own input.
    lanzaboote = {
      url = "github:nix-community/lanzaboote/v1.1.0";
      inputs.nixpkgs.follows = "nixpkgs";
      # Upstream names this input after the repository's former name. It is
      # the project this flake carries as git-hooks.
      inputs.pre-commit.follows = "git-hooks";
      # crane and rust-overlay stay unfollowed. This flake declares neither,
      # and the copies ashell brings are pinned for ashell's toolchain rather
      # than for the lzbt build.
    };
  };

Flake Imports

      imports = [
        inputs.treefmt-nix.flakeModule
        # flake.modules.<class>.<name>, the output the darwin modules publish
        # under. flake-parts declares no darwinModules option.
        inputs.flake-parts.flakeModules.modules

        ./flake/modules.nix # Exported nixosModules
        ./flake/templates.nix # `nix flake init` starting points
        ./flake/packages.nix # Packaged scripts and tools
        ./flake/dev-shells.nix # Development environments
        ./flake/treefmt.nix # Multi-language formatter (nix fmt)
        ./flake/docs-options.nix # Generated othrys.* options reference
        ./flake/checks # CI/CD checks
      ];

Module System

All custom options use the othrys.* namespace (e.g., othrys.desktop.login.enable). Each module follows a consistent pattern.

Standard Module Structure

A module declares options under options.othrys.{category}.{name}, guards config with lib.mkIf cfg.enable, and integrates with Home Manager and impermanence as needed.

Example: Login Manager (greetd)

Options:

  options.othrys.desktop.login = {
    enable = lib.mkEnableOption "graphical login manager (greetd)";

    greeter = lib.mkOption {
      type = lib.types.enum ["tuigreet" "cosmic-greeter"];
      default = "tuigreet";
      description = "Greeter frontend. Both run on greetd.";
    };

    defaultDesktop = lib.mkOption {
      type = lib.types.nullOr lib.types.str;
      default = null;
      description = ''
        Wayland session the default `sessionCommand` launches via `uwsm start`
        (e.g. hyprland-uwsm.desktop). The hyprland module sets it. Unused when
        `sessionCommand` is set explicitly and ignored by cosmic-greeter, which
        lists the installed sessions instead.
      '';
    };

    sessionCommand = lib.mkOption {
      type = lib.types.str;
      default = defaultSession;
      defaultText = lib.literalExpression ''"uwsm start ''${defaultDesktop}" when a compositor sets defaultDesktop, "niri-session" on a niri host, otherwise required'';
      description = ''
        Command the greeter runs to start the session. The default launches
        `defaultDesktop` through uwsm when a compositor registered one, which
        hyprland does, and `niri-session` on a niri host. A host running a
        desktop othrys does not manage sets it directly.
      '';
    };

    autoLogin = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = ''
        Skip the greeter and start the session as the primary user (tuigreet
        only). Anyone at the console gets the session, so the host must lock
        it on idle and before sleep, which `othrys.desktop.idle` provides,
        and the module refuses the option without it.
      '';
    };
  };

Config:

  config = lib.mkIf cfg.enable {
    assertions = [
      {
        assertion = cfg.sessionCommand != "";
        message = "othrys.desktop.login has no session to start: enable a compositor module, or set othrys.desktop.login.sessionCommand for a desktop othrys does not manage.";
      }
      {
        assertion = cfg.autoLogin -> config.othrys.desktop.idle.enable;
        message = "othrys.desktop.login.autoLogin starts a session for whoever is at the console, so the host needs a lock path: enable othrys.desktop.idle.";
      }
      {
        assertion = cfg.autoLogin -> usersEnabled;
        message = "othrys.desktop.login.autoLogin starts the session as the primary user, which needs othrys.system.users.enable.";
      }
    ];

    # tuigreet is the minimal greeter that launches the default session. The
    # greeter itself runs as the `greeter` account nixpkgs creates, since it
    # draws the prompt before anyone has authenticated; only the session
    # started after login runs as the primary user. useTextGreeter keeps
    # kernel messages off the terminal the TUI draws on.
    services.greetd = lib.mkIf (cfg.greeter == "tuigreet") {
      enable = true;
      useTextGreeter = true;
      settings = {
        default_session.command = "${pkgs.tuigreet}/bin/tuigreet --time --cmd '${cfg.sessionCommand}'";

        initial_session = lib.mkIf (cfg.autoLogin && usersEnabled) {
          command = cfg.sessionCommand;
          user = username;
        };
      };
    };

    # cosmic-greeter is System76's graphical greeter, which configures greetd itself.
    services.displayManager.cosmic-greeter.enable = cfg.greeter == "cosmic-greeter";
  };

Category Organization

Each modules/{category}/default.nix imports all modules in that category, and nixosModules.default aggregates every category. A consuming flake that imports nixosModules.default pulls in every module, but nothing activates until othrys.{category}.{name}.enable = true is set in the consumer’s configuration.

Five files are left out of their category, since each writes into an option namespace that only an upstream flake’s module declares. modules/system/home.nix, modules/theme/stylix.nixos.nix, modules/system/disko.nix, modules/system/secrets.nixos.nix and modules/system/impermanence.nix are exported as nixosModules.home, nixosModules.stylix, nixosModules.disko, nixosModules.secrets and nixosModules.impermanence, and a host imports each together with the upstream module it configures. nixosModules.full aggregates default, the five and their upstream modules. See Host Configuration.

Shared Options and Platform Files

A module that nix-darwin will implement as well is split into two files. modules/services/tailscale.nix declares othrys.services.tailscale, and modules/services/tailscale.nixos.nix imports it and holds every NixOS setting. The category’s default.nix and the individual export both name the .nixos.nix file, so a NixOS host evaluates exactly what it did before the split. nix-darwin refuses a write to an option it does not declare, such as networking.firewall or systemd, so the darwin implementation of a module, such as git.darwin.nix, imports the shared file and writes its own settings beside it, and the options keep one name on both platforms. A shared file also holds what both platforms write the same way, which is a Home Manager registry entry or an assertion that reads only othrys options, as git.nix and zsh.nix do, so neither platform file repeats it.

The split applies to the system modules users, nix, git, locale and secrets, the editor option and zsh under system/shell, ssh, tailscale, mosh and yubikey, the development, ollama and t3code apps, the Stylix adapter, the persistence registry, Floorp, Discord, Vesktop and Ghostty, and the graphical-session signal in desktop/graphical.nix, which a Mac sets on. Ghostty is split because its package differs on darwin. apps/gui/chromium.nix stays whole and Linux only, since nixpkgs builds ungoogled-chromium for Linux alone. The eval-exports check counts a shared file as exported through its .nixos.nix file, and fails on a .nixos.nix file with no shared file beside it.

Home Manager Integration

Home Manager is loaded as a NixOS or nix-darwin module and manages one user, the primary user named by othrys.system.user.name. A module does not write home-manager.users itself. It contributes an attribute set to the othrys.internal.homeConfig registry, under a key that is its own option path.

othrys.internal.homeConfig."apps.gh" = {
  programs.gh.enable = true;
};

modules/system/users.nix declares the registry, and modules/system/home.nix merges every entry into home-manager.users.<name> behind othrys.system.users.homeManaged.

      # The guard is applied here, once, and at the attribute-set level.
      # homeManaged implies othrys.system.users.enable, so the user name is
      # read only on a host that has the account. A guard on a leaf would
      # still declare the Home Manager user and trip the NixOS account
      # assertions on a host without one.
      home-manager.users = lib.mkIf cfg.homeManaged {
        ${username} = lib.mkMerge (
          # Essential user CLI tools, kept here rather than in
          # environment.systemPackages so they follow the user.
          [{home.packages = with pkgs; [tree jq just];}]
          ++ lib.attrValues config.othrys.internal.homeConfig
        );
      };

The guard sits at the attrset level in that one place, so a headless host never materializes a Home Manager user. A leaf-level mkIf in each module would still create the user.

home.nix is exported as nixosModules.home and is not part of nixosModules.default, so the tree evaluates on a host that imports no Home Manager module. homeManaged is true when the account exists, othrys.system.users.homeManager.enable is on and the export is imported. On any other host users.nix warns once and names every module whose entry was skipped. A host with the account and homeManager.enable left on fails an assertion that names the export, since most modules that configure the user write nothing else.

A module does not read config.home-manager either, for the same reason it does not write it. A value one Home Manager module needs from another is read inside the user’s configuration, as modules/apps/gui/vscode/default.nix does for the neovim that nixvim builds.

A module with a condition of its own wraps the whole entry in a top-level lib.mkIf, as modules/services/docs.nix does. A false condition drops the key from the registry.

othrys.internal.homeConfig."services.docs" = lib.mkIf cfg.desktopEntry {
  # User-level configuration here
};

Account-level writes, such as group memberships in users.users.${username}.extraGroups, stay in the module and are guarded on othrys.system.users.enable at the attrset level. CONTRIBUTING.md carries the full reasoning, and the contract-guards hook rejects a module that names home-manager.users or environment.persistence.

Impermanence Pattern

Modules that store persistent state declare their own persistence, in a second registry, othrys.internal.persist, under the same key as the Home Manager one. A path in the primary user’s home goes under user, relative to the home.

othrys.internal.persist."apps.{app}" = {
  user.directories = [
    ".config/{app}"
  ];
};

A system path goes in directories or files.

othrys.internal.persist."services.{service}" = {
  directories = [
    "/var/lib/{service}"
  ];
};

Neither form spells a guard. modules/system/impermanence.nix reads the registry and writes it into environment.persistence under config.othrys.system.impermanence.persistRoot. It writes the system paths when impermanence is on, and the paths under user only when othrys.system.users.enable is on as well, since impermanence reads the account’s home directory to place the bind mount.

That file is exported as nixosModules.impermanence and is not part of nixosModules.default, so the tree evaluates on a host that imports no impermanence module. See Impermanence.

Host Configuration

Hosts compose modules by setting othrys.* options. Host configurations do not live in this repository. They belong to a private fleet flake that consumes othrys.nix as an input. This page documents the contract a consuming flake must satisfy and sketches what a host looks like.

Consuming the Module Library

nix flake init -t github:<owner>/othrys.nix writes a minimal consuming flake with everything below already in place. The eval-template check instantiates that template with only the inputs a consumer has, so it cannot drift from the contract described here.

A fleet flake takes othrys.nix as an input and builds hosts with nixosSystem. nixosModules.default is the module tree, and it writes into no option namespace of another flake, so a host built from it alone imports nothing else. Five exports sit outside it, each of which hands part of the tree to an upstream module, and nixosModules.full is default with all five and the five upstream modules.

A host that wants everything imports the aggregate. The upstream modules come from the lock of othrys, so the fleet flake declares no input for them:

# fleet flake.nix (illustrative)
inputs = {
  othrys.url = "github:<owner>/othrys.nix";
  nixpkgs.follows = "othrys/nixpkgs";
};
# mkHost (illustrative)
inputs.nixpkgs.lib.nixosSystem {
  inherit system;
  specialArgs = {inherit inputs;};
  modules = [
    ./hosts/${hostname}

    # The tree, the five exports and the five upstream modules.
    inputs.othrys.nixosModules.full
  ];
}

A host that imports full imports none of the five upstream modules itself, since two revisions of one module declare every option twice. A fleet that wants its own revision of one makes the input of othrys follow it, as in inputs.othrys.inputs.home-manager.follows = "home-manager", and every host then gets that revision through full.

A server with no managed user imports default alone:

modules = [
  ./hosts/${hostname}
  inputs.othrys.nixosModules.default
];

A host between the two imports default and the exports it wants, each beside the upstream module it configures. The fleet flake then declares those inputs, typically following othrys so hosts build against the versions the library is locked and tested with:

# fleet flake.nix (illustrative)
inputs = {
  othrys.url = "github:<owner>/othrys.nix";
  nixpkgs.follows = "othrys/nixpkgs";

  # One for each export a host imports.
  home-manager.follows = "othrys/home-manager";
  impermanence.follows = "othrys/impermanence";
  disko.follows = "othrys/disko";
  sops-nix.follows = "othrys/sops-nix";
  stylix.follows = "othrys/stylix";
};
# the host's module list (illustrative)
modules = [
  ./hosts/${hostname}

  inputs.othrys.nixosModules.default

  # Each othrys export beside the upstream module it configures.
  inputs.othrys.nixosModules.home
  inputs.home-manager.nixosModules.home-manager
  inputs.othrys.nixosModules.impermanence
  inputs.impermanence.nixosModules.impermanence
  inputs.othrys.nixosModules.disko
  inputs.disko.nixosModules.disko
  inputs.othrys.nixosModules.secrets
  inputs.sops-nix.nixosModules.sops
  inputs.othrys.nixosModules.stylix
  inputs.stylix.nixosModules.stylix
];
ExportUpstream moduleNeeded by
nixosModules.homeinputs.home-manager.nixosModules.home-managerA host whose primary user Home Manager manages
nixosModules.impermanenceinputs.impermanence.nixosModules.impermanenceA host with an ephemeral root
nixosModules.diskoinputs.disko.nixosModules.diskoA host that wants the othrys disk layout
nixosModules.secretsinputs.sops-nix.nixosModules.sopsA host that wants the othrys sops-nix plumbing
nixosModules.stylixinputs.stylix.nixosModules.stylixA host that wants Stylix

Home Manager is needed only on a host with a managed user. Every module names its user configuration in othrys.internal.homeConfig, an option nixosModules.default declares itself, and modules/system/home.nix is the only file that writes into the home-manager namespace. It is the separate export nixosModules.home, which a host imports together with inputs.home-manager.nixosModules.home-manager. It hands the registry to home-manager.users.<name>, and while othrys.system.nix is on it sets home-manager.useGlobalPkgs and home-manager.useUserPackages as defaults, so the user’s packages follow the system’s nixpkgs policy. A host that enables othrys.system.users and leaves othrys.system.users.homeManager.enable on without the export fails an assertion that names it. See User Identity and Headless Hosts.

impermanence is needed only on a host with an ephemeral root. Every module names what it persists in othrys.internal.persist, an option nixosModules.default declares itself, and modules/system/impermanence.nix is the only file that writes into environment.persistence. It is the separate export nixosModules.impermanence, which a host imports together with inputs.impermanence.nixosModules.impermanence. A host with a persistent root imports neither. A host that sets othrys.system.impermanence.enable without the export fails an assertion that names it. See Impermanence.

disko is needed only on a host that wants the othrys disk layout. modules/system/disko.nix is the only file that writes into the disko namespace, and it is the separate export nixosModules.disko, which a host imports together with inputs.disko.nixosModules.disko. A host that partitions another way imports neither and, if it enables impermanence, sets othrys.system.impermanence.device itself. See Disko and Impermanence.

sops-nix is needed only on a host that wants the othrys secrets plumbing. modules/system/secrets.nixos.nix is the only file that writes into the sops namespace, and it is the separate export nixosModules.secrets, which a host imports together with inputs.sops-nix.nixosModules.sops. Every other module takes a secret as a runtime file path, so a host with another provider imports neither. See Secrets Management.

Stylix is needed only on a host that wants it. Nothing in nixosModules.default writes into the stylix namespace, since every module reads its colours and fonts from othrys.theme. The adapter that configures Stylix from the theme is the separate export nixosModules.stylix, and a host imports it together with inputs.stylix.nixosModules.stylix. A host that imports neither evaluates the same without them. See Theming.

Lanzaboote is needed only for Secure Boot on systemd-boot, where the host adds a lanzaboote input and imports inputs.lanzaboote.nixosModules.lanzaboote. Every other host leaves it out and evaluates the same without it. See Bootloader & Secure Boot.

Darwin Hosts

A nix-darwin host is built the same way, from othrys.darwinModules.default or othrys.darwinModules.full and nix-darwin’s darwinSystem, under the option names a NixOS host uses. Darwin describes the darwin exports, what each module does on a Mac, the darwin template and what is tested.

Re-exporting the Dev Shell

A consuming flake that wants the same tools and commit hooks re-exports devShells.consumer, not devShells.default:

devShells.default = inputs'.othrys.devShells.consumer;

Both shells carry the same packages. consumer installs the hooks that suit any Nix repository, which are treefmt, statix, deadnix, commitizen and gitleaks. default adds comment-hygiene, contract-mirror and contract-guards, which read this repository’s own tree and reject any other.

The specialArgs Contract

othrys modules read one argument from specialArgs, and a host may leave it out:

ArgumentTypeUsed for
inputsattrsetThe two names in the table below, each read with a fallback
InputRead byWithout it
nixpkgsothrys.system.nix, which pins the flake registry and NIX_PATH to it and turns channels offNixOS pins the registry and NIX_PATH to the source nixpkgs.lib.nixosSystem was called from, without the revision and hash, and channels stay as NixOS sets them
secretsothrys.system.secrets, as the default of secretFiles when the input existssecretFiles defaults to an empty set

Both stay with the consumer because they are the consumer’s by nature. The registry pin has to name the revision the host is built from, and the secrets are the consumer’s own data. No Home Manager module here reads inputs, so home-manager.extraSpecialArgs is needed only by a fleet’s own modules.

Every other flake comes from this flake’s own lock. nixosModules.default hands ashell, hyprland, nixvim and nix-index-database to the modules as the othrysInputs module argument, and imports niri-flake’s module directly. A consuming flake declares none of them, and an input of one of those names is not read. Flake Inputs describes how a consumer substitutes its own.

Locked inputModuleOverride
hyprlandothrys.desktop.compositors.hyprlandpackage and portalPackage
ashellothrys.desktop.ashellpackage
nixvimothrys.apps.nixviminputs.othrys.inputs.nixvim.follows
nix-index-databaseothrys.apps.commainputs.othrys.inputs.nix-index-database.follows

The individual exports nixosModules.hyprland, ashell, nix, secrets, system and desktop carry the same arguments, so they work without default.

There is no username or hostname specialArg. The primary user is named via the othrys.system.user.name option, and hosts set networking.hostName directly.

User Identity and Headless Hosts

othrys.system.user.name names the primary user. It is read lazily, only when a per-user feature is active. Account creation and environment management are separate toggles, so hosts pick the coupling they want:

  • Workstations set user.name, enable othrys.system.users, import nixosModules.home with the Home Manager module, and get the managed account plus all home-manager configuration (users.homeManager.enable defaults to true). nixosModules.full holds both imports.
  • Servers with a login account (an admin user, or an account a webapp runs under) enable othrys.system.users but set othrys.system.users.homeManager.enable = false: the account, groups, and persisted home exist, and no home-manager state is generated. Such a host needs neither the export nor the Home Manager module.
  • Headless/root-only hosts leave othrys.system.users off entirely, or even omit user.name. Server modules like ssh, docker, secrets, or impermanence work without a primary user, and the host imports nixosModules.default alone.

Modules key account-level writes (group memberships, /persist home directories) on othrys.system.users.enable. Home Manager configuration goes to the othrys.internal.homeConfig registry, which nixosModules.home applies behind the derived othrys.system.users.homeManaged flag. That flag is true when the account exists, homeManager.enable is on and the export is imported. On any other host the registry entries are skipped and one warning names the modules they came from. Service accounts for individual daemons are not othrys’s concern. Declare them with plain users.users.<name>.isSystemUser (most NixOS service modules do this themselves).

The eval-host-server, eval-host-anonymous, and eval-host-server-account checks in flake/checks/ enforce this contract in CI, on hosts that import no Home Manager module, and eval-optional-exports reads back each shape above.

Additionally, nixosModules.default injects othrysSelf (this flake’s own source) as a module argument, so modules that build from the flake source, such as the docs server, work without extra wiring. Importing individual module files instead of default skips that injection. The argument then does not exist, so set othrys.services.docs.package explicitly, or the default fails with the module system’s missing-argument error when it is read.

Secrets are the consumer’s responsibility. On a host that imports nixosModules.secrets, othrys.system.secrets.secretFiles defaults to inputs.secrets.secretFiles when the consuming flake declares a secrets input, which this library does not.

Anatomy of a Host

A host config should hold only what is true of that machine specifically, meaning hardware facts and role selection. Shared settings belong in profile modules the fleet defines once and imports per host:

# hosts/example/default.nix (illustrative)
{...}: {
  imports = [
    ./hardware.nix
    ../../profiles/base.nix # identity, shell, secrets, ssh, security
    ../../profiles/desktop.nix # hyprland session, theming, GUI apps
  ];
  networking.hostName = "example";

  othrys.system.disko = {
    enable = true;
    device = "/dev/disk/by-id/<disk-id>";
    swapSize = "16G";
    luks.fido2.enable = true;
  };

  othrys.desktop.compositors.hyprland.monitors = [
    {
      output = "desc:<monitor>";
      mode = "1920x1080@144";
      position = "0x0";
      scale = "1";
    }
  ];

  othrys.hardware.nvidia.enable = true;
}

The rule of thumb for what goes where is simple. If you would have to re-discover a value when the disk dies (disk IDs, bus IDs, monitor descriptors), it belongs in the host. If it is true of every machine or of a machine role, it belongs in a profile.

Darwin

othrys.nix builds nix-darwin hosts as well as NixOS ones. The darwin exports take the same othrys.* option names, so a module that runs on both platforms is configured the same way on each, and a NixOS-only module is not in the darwin tree at all. aarch64-darwin is the darwin platform the checks build. The options reference marks each option with the platforms that declare it (see Module Options).

The Exports

A nix-darwin host imports othrys.darwinModules.default, the same set as othrys.modules.darwin.default. It holds the primary user, the account, Nix, git, the locale, the shell modules, the theme, SSH, Tailscale, Mosh, the YubiKey and the apps that build for darwin, under the option names a NixOS host uses. The apps are gh, tmux, yazi, comma, nixvim, Claude Code, Codex, T3 Code, Ollama and the MCP servers, the language registry, Ghostty, kitty, mpv, VSCodium, IntelliJ IDEA and Signal. Picard is left out, since its pyqt6 fails to build on darwin in the pinned nixpkgs. Most are the darwin implementations of split modules (see Module System), and the rest, such as bash, starship and the theme, write only options nix-darwin declares as well. The export imports no upstream module, so a host built from it alone imports nothing else.

inputs.nix-darwin.lib.darwinSystem {
  specialArgs = {inherit inputs;};
  modules = [
    inputs.othrys.darwinModules.default
    inputs.othrys.darwinModules.home
    inputs.home-manager.darwinModules.home-manager
    {
      nixpkgs.hostPlatform = "aarch64-darwin";
      system.stateVersion = 6;
      othrys.system = {
        user.name = "alice";
        users.enable = true;
        nix = {
          enable = true;
          stateVersion = "26.05";
        };
      };
    }
  ];
}

The Account, Nix and the Locale

macOS creates the administrator account at setup, and the module leaves it with macOS. othrys.system.users.enable sets the account’s home to /Users/<name> and makes it system.primaryUser, which nix-darwin needs for system.defaults and launchd user agents. nix-darwin applies a login shell only to an account it owns, and owning one takes a uid, so the shell from othrys.system.users.defaultShell applies only once the host sets othrys.system.users.uid. nix-darwin then lists the account in users.knownUsers and may create it.

othrys.system.nix leaves nix.enable to nix-darwin and defaults nix.package to Lix. system.stateVersion is an integer on nix-darwin, which the host sets itself, while othrys.system.nix.stateVersion remains the Home Manager state version. The store is optimised by the scheduled nix.optimise job, since nix-darwin refuses auto-optimise-store on Nix and Lix releases that corrupt the store with it on macOS. othrys.system.locale sets time.timeZone and LANG, since nix-darwin has no i18n and no console options. othrys.desktop.graphical defaults to true on a Mac.

Home Manager and the Apps

darwinModules.home is the same adapter as nixosModules.home, and it hands the registry of user configuration to Home Manager’s darwin module in the same way. An account with Home Manager on and no adapter imported is refused, and othrys.system.users.homeManager.enable = false keeps an account Home Manager does not manage. Ghostty takes ghostty-bin on darwin, since nixpkgs builds ghostty for Linux alone. The persistence registry is declared and nothing reads it, since a Mac has no ephemeral root, and the assistants’ context leaves out the NixOS text there.

Services

SSH writes the known hosts and the client configuration as on NixOS, and server.enable turns on Remote Login with the hardened settings, on port 22 alone. Tailscale runs tailscaled and refuses the options that only tailscale up and tailscale set apply, since nix-darwin runs neither. Mosh puts mosh on the system path, where sshd finds mosh-server for an account whose shell is zsh. The YubiKey module keeps the GnuPG agent with pinentry_mac and refuses a U2F mapping. Ollama runs as the user’s launchd agent through Home Manager, with nixpkgs’ one darwin build. See Services, Security and AI for each.

Adapters

darwinModules.stylix and darwinModules.secrets are the darwin forms of the NixOS adapters, and a host imports each with darwinModules.stylix of the stylix flake or darwinModules.sops of the sops-nix flake. Stylix on darwin themes the fonts, jankyborders and neovim, and the rest of what it themes is in the user’s Home Manager configuration, so a host with the Stylix adapter imports darwinModules.home as well. It sets no cursor and turns the user’s GTK target off there. The secrets adapter takes no ssh host key, since a Mac may have none, and generates an age key at sops.age.keyFile. A host that names no age key, ssh key or GnuPG home is refused. darwinModules.full is default with home, stylix and secrets and the three upstream darwin modules, taken from this flake’s lock, so a host built from it imports nothing else.

inputs.nix-darwin.lib.darwinSystem {
  specialArgs = {inherit inputs;};
  modules = [
    inputs.othrys.darwinModules.full
    {
      nixpkgs.hostPlatform = "aarch64-darwin";
      system.stateVersion = 6;
      othrys.system = {
        user.name = "alice";
        users.enable = true;
        nix = {
          enable = true;
          stateVersion = "26.05";
        };
        stylix.enable = true;
        secrets.enable = true;
      };
      sops.age = {
        keyFile = "/var/lib/sops-nix/key.txt";
        generateKey = true;
      };
    }
  ];
}

The Template

nix flake init -t github:bippsoft/othrys.nix#darwin writes a consuming flake for one Mac, darwinConfigurations.mymac, built from darwinModules.full. Its inputs are othrys, with nixpkgs and nix-darwin following the lock of othrys, and nothing else, since full brings Home Manager, Stylix and sops-nix from that lock. configuration.nix names the administrator account as the primary user, leaves Home Manager managing it and turns on Nix, the locale, zsh and the SSH client. nix-darwin manages the Nix installation and othrys sets Lix as its package. Any Nix or Lix installation runs the first switch, which moves the daemon to Lix. The first switch takes nix-darwin from the template’s own lock:

sudo nix run --inputs-from . nix-darwin -- switch --flake .#mymac

Later switches run sudo darwin-rebuild switch --flake .#mymac.

eval-darwin-template instantiates the template with only those inputs. It fails on any warning, on a Nix other than Lix and on an account Home Manager does not manage, and on a Mac it builds the toplevel.

What Is Tested

The core-darwin job builds the darwin checks on an Apple Silicon runner, and the core job evaluates the same hosts on Linux with import-from-derivation off. The hosts are a user named and nothing on, the system modules with Home Manager, every darwin app on, darwinModules.full with Stylix and the secrets plumbing, one host for each darwin service module on by itself and the template. eval-darwin reads back what the modules write there. darwin-enable-matrix in the darwin leg of the extended tier turns every darwin enable option on by itself, and eval-contract holds the darwin hosts to the consumer contract. No check activates a system on a Mac, so a setting that macOS reads at activation or at run time is unchecked. See CI/CD.

What Stays on NixOS

Disko, impermanence, the bootloader, the compositors and the rest of the desktop, the hardware modules and every service module other than SSH, Tailscale, Mosh and the YubiKey are NixOS only. nix-darwin declares none of the options they write, and a Mac has no ephemeral root, no Linux boot chain and no compositor for othrys to manage. The apps outside the list under The Exports stay on NixOS too, among them Picard, whose pyqt6 fails to build on darwin, and Chromium, which nixpkgs builds for Linux alone.

Flake Inputs

All external dependencies are declared in flake.nix:

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";

    # Flake framework for modular configuration
    flake-parts = {
      url = "github:hercules-ci/flake-parts";
      inputs.nixpkgs-lib.follows = "nixpkgs";
    };

    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # nix-darwin, the module system a macOS host is built with. The darwin
    # exports are written against it, and the darwin host checks evaluate
    # with its darwinSystem.
    nix-darwin = {
      url = "github:nix-darwin/nix-darwin";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    hyprland = {
      # Deliberately does not follow nixpkgs, for cache hits rather than for
      # any build failure. Upstream builds against its own pin, so
      # hyprland.cachix.org serves the exact derivations this flake asks for.
      # Adding `follows` while still reading inputs.hyprland.packages changes
      # those hashes and puts every consumer on a source build, which is the
      # one combination to avoid.
      #
      # nixpkgs carries hyprland too, so defaulting to pkgs.hyprland with
      # mkDefault (what the niri module does) is viable and would drop the
      # second nixpkgs this input costs. Left alone because no check here can
      # prove a packaging swap leaves a live session behaving the same.
      url = "github:hyprwm/Hyprland";
      # Only upstream's own checks and dev shell read this, so following ours
      # leaves the package hashes alone and drops a second copy from the lock.
      inputs.pre-commit-hooks.follows = "git-hooks";
    };

    ashell = {
      url = "github:MalpenZibo/ashell";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # Packages for AI agents and their desktop clients, the default of the
    # package options of the claude-code, codex, claude-desktop and orca
    # modules. Like hyprland it does not follow nixpkgs. Upstream builds and
    # tests against its own pin, and cache.numtide.com serves those exact
    # derivations, so following ours would put every consumer on a local
    # build of each package.
    llm-agents = {
      url = "github:numtide/llm-agents.nix";
      # Only upstream's own outputs and checks read these, so following ours
      # leaves the package hashes alone and drops a copy from the lock.
      inputs.flake-parts.follows = "flake-parts";
      inputs.treefmt-nix.follows = "treefmt-nix";
    };

    # The Paseo plugin that loads each agent's direnv environment, the
    # default of othrys.apps.ai.paseo.direnv.package. Its package is the
    # plugin's TypeScript source, which Paseo compiles when it loads it, so
    # following our nixpkgs costs no cache hit. Only a host with Paseo and
    # its direnv option on reads it, and no other host fetches it.
    paseo-direnv = {
      url = "github:MatthewDeSouza/paseo-direnv";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # Niri compositor, packages plus the typed programs.niri.settings module
    # (build-time-validated KDL config). Self-contained, since the compositor
    # module imports its NixOS module directly, and its auto-cache is disabled in
    # favor of the curated substituter list in othrys.system.nix.
    niri = {
      url = "github:sodiboo/niri-flake";
      inputs.nixpkgs.follows = "nixpkgs";
      # niri-flake builds its own niri-stable package against nixpkgs-stable.
      # The compositor module takes niri from pkgs and never reads that
      # package, so the second nixpkgs follows ours and leaves the lock.
      inputs.nixpkgs-stable.follows = "nixpkgs";
    };

    # Declarative disk partitioning
    disko = {
      url = "github:nix-community/disko";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # NixOS-WSL, the module a host running as a WSL distro is built with,
    # written into by the optional nixosModules.wsl export. Its flake-compat
    # input is a plain source tree that no output reads.
    nixos-wsl = {
      url = "github:nix-community/NixOS-WSL";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # Nix-index database, a prebuilt index for comma and nix-locate
    nix-index-database = {
      url = "github:nix-community/nix-index-database";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # Impermanence, opt-in state persistence
    impermanence = {
      url = "github:nix-community/impermanence";
      inputs.nixpkgs.follows = "nixpkgs";
      inputs.home-manager.follows = "home-manager";
    };

    # Nixvim - Neovim configuration with Nix modules
    nixvim = {
      url = "github:nix-community/nixvim";
      inputs.nixpkgs.follows = "nixpkgs";
      inputs.flake-parts.follows = "flake-parts";
    };

    # Stylix - System-wide theming using base16
    stylix = {
      url = "github:nix-community/stylix";
      inputs.nixpkgs.follows = "nixpkgs";
      inputs.flake-parts.follows = "flake-parts";
    };

    # Git hooks for pre-commit validation
    git-hooks = {
      url = "github:cachix/git-hooks.nix";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # Multi-language formatting (drives `nix fmt` + the treefmt pre-commit hook)
    treefmt-nix = {
      url = "github:numtide/treefmt-nix";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # Secrets management with age encryption
    sops-nix = {
      url = "github:Mic92/sops-nix";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # Lanzaboote, Secure Boot for systemd-boot. Pinned to a release tag, which
    # is what upstream asks consumers to track. No module imports it. It is
    # here so flake/checks can evaluate the systemd-boot Secure Boot path, and
    # a consumer who wants that path imports the module from their own input.
    lanzaboote = {
      url = "github:nix-community/lanzaboote/v1.1.0";
      inputs.nixpkgs.follows = "nixpkgs";
      # Upstream names this input after the repository's former name. It is
      # the project this flake carries as git-hooks.
      inputs.pre-commit.follows = "git-hooks";
      # crane and rust-overlay stay unfollowed. This flake declares neither,
      # and the copies ashell brings are pinned for ashell's toolchain rather
      # than for the lzbt build.
    };
  };

Input Summary

InputPurpose
ashellGPU-accelerated Wayland status bar, the default of othrys.desktop.ashell.package
nixpkgsMain package set (unstable channel)
flake-partsModular flake framework
home-managerDeclarative user environment management, written into by the optional nixosModules.home export
hyprlandWayland compositor (pinned, not following nixpkgs), the default of othrys.desktop.compositors.hyprland.package and portalPackage
niriniri-flake, the typed programs.niri.settings module the Niri compositor module imports
llm-agentsPackages for AI agents and their desktop clients (pinned, not following nixpkgs), the default package of the AI modules that name it
diskoDeclarative disk partitioning, written into by the optional nixosModules.disko export
nixos-wslNixOS-WSL, written into by the optional nixosModules.wsl export
nix-index-databasePrebuilt database for comma and nix-locate, as the Home Manager module othrys.apps.comma imports
impermanenceOpt-in state persistence, written into by the optional nixosModules.impermanence export
nixvimNeovim configuration via Nix modules, as the Home Manager module othrys.apps.nixvim imports
stylixSystem-wide theming, read by the optional Stylix adapter and the checks
git-hooksPre-commit hooks (treefmt, Statix, Deadnix, commitizen, gitleaks and the three repository hooks)
treefmt-nixMulti-language formatter behind nix fmt
sops-nixSecrets management with age encryption, written into by the optional nixosModules.secrets export
lanzabooteSecure Boot for systemd-boot (read by the checks only, since no module imports it and a consumer who wants it declares their own)

The private secrets input is declared only in the consuming fleet flake, never here, since this flake must remain evaluable by anyone.

What a Consumer Declares

A consuming flake declares othrys, nixpkgs and the inputs whose modules it imports itself. home-manager, impermanence, disko, sops-nix, stylix and nixos-wsl are for a host that imports the matching othrys export, and none of them is required. Each is typically written as follows = "othrys/<name>", so hosts build against the exact versions this library is locked to (see Host Configuration). A flake whose hosts import nixosModules.full declares none of the first five, since that export imports each upstream module from this flake’s lock. full leaves NixOS-WSL out, so a WSL host declares nixos-wsl itself.

It declares none of ashell, hyprland, nixvim, nix-index-database, llm-agents or niri. flake/modules.nix hands the first five to the modules from this flake’s lock, as a module argument named othrysInputs, and imports niri-flake’s module directly. An input of one of those names in the consuming flake is not read by any module.

A consumer changes what a module builds from in one of two ways.

  • A package option. othrys.desktop.compositors.hyprland.package and portalPackage, and othrys.desktop.ashell.package, take any package. The defaults are the packages of the locked flakes.
  • A follows on this flake’s input. inputs.othrys.inputs.<name>.follows = "<name>" replaces the locked flake with the consumer’s own. It is the only way to change nixvim and nix-index-database, which are Home Manager modules with no package to set.
inputs = {
  othrys.url = "github:<owner>/othrys.nix";

  # The consumer's own nixvim, in place of the one othrys locks.
  nixvim.url = "github:nix-community/nixvim";
  othrys.inputs.nixvim.follows = "nixvim";
};

The Hyprland input deliberately does not follow nixpkgs, so its packages match what hyprland.cachix.org serves. A follows that replaces it, or a package from another source, gives up those cache hits.

The llm-agents input does not follow nixpkgs either, for the same reason. Upstream builds and tests against its own pin, and cache.numtide.com serves those derivations. A host trusts that cache only while a module whose package comes from the input is on.

Security Model

This page states what othrys.nix protects, what it trusts, and where protection stops. The reasoning for single options lives beside those options. This page collects the parts that span modules, so a consumer can read the whole position in one place.

What reaches the Nix store

The Nix store is world-readable, and a path stays in it for as long as any generation refers to it. Anything a module interpolates into a derivation is therefore public to every user and every process on the host.

Modules that need credentials take a runtime path and never the credential itself. The secretPath type in modules/lib/types.nix rejects path literals and store paths, since a literal such as ./token is copied into the store the moment it is interpolated. The consuming flake decides what writes the file at that path, which is typically sops-nix decrypting to /run/secrets at activation. See Secrets Management.

Two options place material in the store on purpose, and each says so in its description.

OptionWhat lands in the storeWhy it is accepted
othrys.system.users.initialHashedPasswordA password hashIt bootstraps the first boot before secrets decrypt. Treat the hash as public and move the host to passwordFile
othrys.system.secrets.ageIdentityStubsAn age-plugin-yubikey stubThe stub names a hardware token and holds no key. An assertion rejects a raw AGE-SECRET-KEY

Where a service only accepts a secret inside its own configuration file, the module renders that file under /run at start from the runtime path. The ntfy bridge token in alerting.nix is handled this way.

Where a program only reads a credential from its environment, the module installs a wrapper that reads the runtime path into the variable for that one process and then becomes the program. cachix-push loads the cache token this way, and gh loads othrys.apps.gh.tokenFile the same way on a headless host. The variable is never set in a shell, so nothing else started from that shell inherits it.

No module keeps a credential of its own. modules/system/secrets.nixos.nix is the only file that writes into the sops namespace, where it sets the decryption keys, and every secret is declared by the consuming flake. On a desktop the gh login lives in the Secret Service keyring, which othrys.desktop.keyring provides, and Claude Code keeps its own login under ~/.claude.

Trust roots

A host built from these modules trusts the following, and nothing in this repository can reduce that set.

  • The consuming flake’s repository. othrys.system.autoUpgrade runs nixos-rebuild switch against whatever the configured flake ref resolves to, so by default write access to that repository is root on every host that follows it. With autoUpgrade.verify on, the host fetches the repository itself, requires a good signature from a configured key on the commit or tag, refuses anything that does not descend from the last verified commit, and rebuilds from that checkout. The signing keys then take the repository’s place as the trust root. Only the tip is verified, and the signature covers flake.lock, which pins every input by hash.
  • The flake lock. Every input is pinned by content hash in the consuming flake’s flake.lock, this repository included. A changed input cannot reach a host without a changed lock.
  • Binary caches. A substituter with a trusted public key can serve any store path. Every host trusts cache.nixos.org. othrys.system.nix.communityCache adds nix-community.cachix.org when a host asks, the hyprland and niri caches come with their compositor modules, cache.numtide.com comes with the AI modules whose package is taken from the llm-agents input, and othrys.system.nix.cachix.* lets a consumer add their own cache. The cache this repository’s CI pushes to is a build cache for CI and is not meant for hosts.
  • Trusted Nix users. nix.settings.trusted-users is root alone by default. A trusted user can point the daemon at any substituter and import unsigned paths, which is root over the host with no password and no second factor, so @wheel is added only by a host that wants it. The primary user is in wheel by default, which is sudo and nothing more.
  • Release tags. Tags from v0.4.0 onward are signed. Earlier tags are not, and a consumer pinning one of them relies on GitHub alone.
  • CI credentials. CACHIX_AUTH_TOKEN can write to the CI cache. MAINTENANCE_CLIENT_ID and MAINTENANCE_SECRET are the client ID and private key of a GitHub App installed on this repository alone, and the token minted from them can push branches and open pull requests here for an hour. Neither can write to main, which is protected and needs passing checks.

The registry resolves nixpkgs to the host’s own input. Channels are off on a host built from a flake, and the global flake registry is not fetched unless othrys.system.nix.globalRegistry is set, so an indirect name such as home-manager resolves only when the host declares it.

Authentication

The YubiKey module makes the key a second factor by default. pam_u2f is inserted as required into the services listed in u2fServices, so the password and the touch must both succeed. The PAM control applies to the whole service, which means every account that authenticates through one of those services needs an enrolled credential. An account without one is locked out of them, and that includes a service account an administrator logs into rarely. Setting u2fRequirePassword = false switches the control to sufficient, where a touch replaces the password and an account with no credential falls through to its password. See Security.

Network inspection fails open

With the router handing forwarded traffic to Suricata over NFQUEUE, two mechanisms decide what happens when inspection stops. The bypass flag on the queue accepts packets while no process is bound to it, and othrys.services.suricata.nfqueue.failOpen accepts them while the queue is full. Both are deliberate, since an IPS fault on a router should not cut off the network behind it. While Suricata is down the link stays up and forwarded traffic is not inspected. See Services.

Boot chain

The disko layout encrypts the root with LUKS, with an optional FIDO2 unlock, and that protects data at rest. It does not protect the boot chain. The kernel and the initrd sit unencrypted on the EFI system partition, and someone with physical access can replace them with a copy that records the passphrase at the next unlock.

Secure Boot closes that gap by having the firmware verify what it loads. othrys.system.bootloader.secureBoot supports it on Limine, which is the default bootloader, and on systemd-boot through lanzaboote when the consuming flake imports that module. GRUB has no Secure Boot path in NixOS and the option is rejected there. The firmware enforces nothing until the keys are enrolled, which is a manual step. See Bootloader & Secure Boot and the Secure Boot guide.

No measured boot option exists. The LUKS key is not bound to TPM PCR values, so a changed boot chain does not by itself prevent an unlock.

SSH host trust

othrys.services.ssh.knownHosts distributes host keys to every user, and the published keys of four public forges are included by default. A host that is not listed still prompts on the first connection, and whoever answers accepts it on trust. Setting StrictHostKeyChecking yes through settings refuses unlisted hosts and ends that. There is no host certificate authority option, so each host key is listed one by one. See Services.

AI assistants

othrys.apps.ai.claude-code ships allow and deny lists for the tools the assistant can run without asking. The lists limit accidents and are not a sandbox. See AI Assistants.

Stability & Releases

othrys.nix is consumed as a flake input by fleet repositories, so option surfaces are contracts. This page defines what consumers can rely on and how change is signaled.

The consumer contract

Four properties hold across every module, and changing any of them is a breaking change. flake/checks/ encodes all four, so a violation fails evaluation rather than reaching a consumer.

  1. No username module argument. Read the primary user from config.othrys.system.user.name. The option has no default.
  2. Guard every per-user write. Account writes behind othrys.system.users.enable, at the attrset level, never on a leaf. Home Manager configuration goes to othrys.internal.homeConfig and persistent paths go to othrys.internal.persist, never to home-manager.users or environment.persistence. One export applies each registry and its guard, nixosModules.home for the first, or darwinModules.home on nix-darwin, and nixosModules.impermanence for the second.
  3. nixosModules.default writes into no upstream namespace. A host built from it alone imports no other module. Five exports are optional, and a host imports each together with the upstream module it configures. nixosModules.home goes with Home Manager, nixosModules.stylix with Stylix, nixosModules.disko with disko, nixosModules.secrets with sops-nix and nixosModules.impermanence with impermanence. nixosModules.full is default with all five and the five upstream modules, taken from this flake’s own lock. darwinModules.default holds to the same rule on nix-darwin. Its optional exports are home with Home Manager, stylix with Stylix and secrets with sops-nix, and darwinModules.full is default with the three and their upstream darwin modules.
  4. specialArgs carry inputs or nothing. Modules read two names from it, nixpkgs for the registry pin and the optional secrets. Not username, not hostname. The same holds for a host built with darwinSystem.

Alongside those, the othrys.* option namespaces themselves and the declared input names that consuming flakes follows-pin are load-bearing. See Host Configuration for what a consumer writes, and CONTRIBUTING.md for the reasoning behind each rule.

Option deprecation

Renamed or relocated options keep working through lib.mkRenamedOptionModule aliases (for example, the former othrys.apps.lsp.* names alias to othrys.apps.languages.*). Aliases:

  • warn on use, pointing at the new name,
  • are kept for at least two tagged releases after the rename lands,
  • are removed in a release whose notes call the removal out.

Removals without a rename (a module or option deleted outright) are breaking changes and follow the commit/release signaling below.

Change signaling

Commit messages follow Conventional Commits (enforced by commitizen in pre-commit):

  • feat!: or a BREAKING CHANGE: footer marks anything a consumer must react to, so option removals, changed defaults with behavioral impact (e.g. the fail2ban ignoreIP default), new required options, input renames.
  • feat:/fix:/refactor: without ! are safe to pull blindly.

Releases

Tags are vMAJOR.MINOR.PATCH (semver-ish; pre-1.0 minor bumps may carry breaking changes, always marked as above). Cut with:

just release          # runs the full check suite, then bumps, writes CHANGELOG.md and tags
just release minor    # the same, forcing the increment (major, minor or patch)
git push origin main v0.4.0

Without an argument commitizen derives the increment from the commits since the last tag. The bump commit lands on main, so main is pushed together with the tag.

Consumers choose their risk level:

  • Pin a tag (othrys.url = "github:<owner>/othrys.nix/v0.4.0") for hosts that must not drift. Upgrade deliberately by bumping the tag.
  • Track main for hosts on the weekly auto-update cadence. The next section states what has run against a commit by the time it is there.

What the merge gate enforces

The Build workflow runs the CORE and EXTENDED check tiers on every pull request and again on every push to main. It reports three statuses for branch protection to require, Core checks, Core checks (darwin) and Extended verdict. The verdict passes only when every extended check succeeded, so a failed, cancelled or skipped check fails it. A newer push to a pull request cancels the run before it, while a run on main is never cancelled.

Requiring the three statuses is a repository setting, and the workflow reports them without enforcing anything itself. With the setting in place, a commit that reaches main through a pull request has passed both tiers as the head of that pull request. The ARM evaluation job runs on the same events and is not one of the required statuses.

The release commit is the exception. just release runs every check locally before it writes the commit, and the commit is pushed to main without a pull request. The workflow runs both tiers on it after the push, so a consumer tracking main can receive it before that run has finished.

What the checks guarantee

The two tiers between them evaluate the three server-contract host shapes (named/anonymous/account-without-home-manager), both desktop stacks, every othrys.*.enable flipped on with defaults (the enable matrix), the impermanence wipe-script behavior against real btrfs, and a reboot of a VM with an empty root that compares the machine-id, the SSH host key and the journal directory before and after, and then makes the first live switch of a host that predates the persisted machine-id. The router stack also runs in a VM, where two LAN clients take Kea leases, resolve a local name through Unbound and reach a WAN host through the masquerade, while the default-drop input and forward chains are probed from the WAN and from the other LAN. A second VM puts Suricata inline on the router’s NFQUEUE hook and shows a local rule dropping a request, then stops Suricata and shows forwarded traffic still passing, which is the fail-open behavior the router documents. It then plants a rule that cannot load and shows the unit ending in failed, the failure hook firing, and the recovery unit bringing the engine back. A third VM serves a git repository to the auto-upgrade signature gate, which refuses unsigned refs, refs signed by an unlisted key, and a rollback.

What the checks do not cover

  • Graphical sessions. No check starts a compositor, so treat the first boot of a new desktop surface as a smoke test.
  • Secure Boot. eval-bootloader evaluates every bootloader with secureBoot on and off, with and without lanzaboote imported. No check boots a VM under firmware Secure Boot.
  • Auto-upgrade. The signature gate runs in a VM. The rebuild that follows it is never run, since the test VM has no network.
  • aarch64-linux beyond evaluation. CI evaluates the server, headless and default host fixtures on an ARM runner. No VM test runs there, no desktop fixture is evaluated, and no ARM host has been booted.
  • aarch64-darwin. CI builds the commit hooks, the scans, the dev shells, the formatter and two hosts from darwinModules.default on a macOS runner, and evaluates the same hosts from Linux. No darwin host has been activated. No other platform is evaluated at all.

The Security Model lists the design limits, as opposed to the testing limits here.

Disko (Disk Partitioning)

Platforms: NixOS only.

Declarative disk configuration with LUKS encryption and BTRFS subvolumes.

Importing

The layout is the separate export nixosModules.disko, which nixosModules.default does not import. It is the only othrys module that writes into the disko option namespace, so a host that wants it imports the export together with the disko module, and a host that partitions another way imports neither:

# flake inputs
disko.follows = "othrys/disko";

# host modules
inputs.othrys.nixosModules.disko
inputs.disko.nixosModules.disko

The export without the disko module fails at evaluation, since a write into an undeclared option namespace fails whatever guards it.

Layout

  • EFI boot partition. Unencrypted FAT32
  • Swap partition. LUKS encrypted, or encrypted with a random key on each boot when swap.randomEncryption is on, which is the default with luks.fido2.enable
  • Root partition. LUKS encrypted BTRFS with subvolumes:
    • root → / (ephemeral, wiped on boot)
    • persist → /persist (all persistent state)
    • nix → /nix (Nix store)

With luks.fido2.enable, the root’s crypttab entry carries fido2-device=auto, so the initrd tries a FIDO2 token before it asks for the passphrase. Stage 1 runs systemd on every host, so the option turns nothing else on. The keyslot itself is enrolled out of band, as Secrets describes.

Options

  options.othrys.system.disko = {
    enable = lib.mkEnableOption "Disko declarative disk configuration";

    device = lib.mkOption {
      type = lib.types.str;
      description = ''
        Disk device path. Use /dev/disk/by-id/ for reliable identification.
        Find your disk ID with: ls -l /dev/disk/by-id/

        A path outside /dev/disk/, such as /dev/sda, evaluates with a
        warning. The kernel hands those names out in probe order, so the same
        name can be another disk on the next boot.
      '';
      example = "/dev/disk/by-id/nvme-VENDOR_MODEL_XXXXXXXXXXXXX";
    };

    bootSize = lib.mkOption {
      type = lib.types.str;
      default = "1G";
      description = "EFI boot partition size.";
    };

    swapSize = lib.mkOption {
      type = lib.types.str;
      default = "8G";
      description = ''
        Swap partition size. Recommendations:
        - For hibernation: swap >= RAM size
        - Without hibernation: 4-8GB is usually sufficient
      '';
      example = "16G";
    };

    # Advanced options with sensible defaults
    luks = {
      name = lib.mkOption {
        type = lib.types.str;
        default = "cryptroot";
        description = "Name for the LUKS encrypted root device (appears as /dev/mapper/<name>).";
      };

      swapName = lib.mkOption {
        type = lib.types.str;
        default = "cryptswap";
        description = "Name for the LUKS encrypted swap device (used only when swap.randomEncryption is false).";
      };

      passwordFile = lib.mkOption {
        type = lib.types.nullOr othrysTypes.secretPath;
        default = null;
        description = ''
          Path to a file containing the LUKS passphrase used when disko first
          formats the disk. Leave null (default) to be prompted interactively at
          format time, recommended since at install time sops secrets do not
          yet exist on the target.

          With luks.fido2.enable, this passphrase becomes the break-glass
          recovery keyslot: day-to-day unlock is via YubiKey, and the passphrase
          is only needed if every enrolled key is unavailable. Boot always falls
          back to this passphrase if no token is present.
        '';
        example = lib.literalExpression ''config.sops.secrets."security/boot/password".path'';
      };

      allowDiscards = lib.mkOption {
        type = lib.types.bool;
        default = true;
        description = ''
          Pass TRIM requests through dm-crypt to the SSD. The requests show an
          observer of the raw disk which blocks are free, which is the price
          of keeping the drive's performance. `services.fstrim.enable`
          follows this option, since the passthrough alone discards nothing.
        '';
      };

      bypassWorkqueues = lib.mkOption {
        type = lib.types.bool;
        default = true;
        description = "Bypass dm-crypt workqueues for better SSD performance.";
      };

      fido2.enable = lib.mkEnableOption "FIDO2/YubiKey unlock for the encrypted root (enrolled per-key via `just luks-enroll`; the passphrase stays as break-glass recovery)";
    };

    btrfs = {
      compression = lib.mkOption {
        type = lib.types.str;
        default = "zstd";
        description = "BTRFS compression algorithm for root subvolume.";
      };

      mountOptions = lib.mkOption {
        type = lib.types.listOf lib.types.str;
        default = ["noatime" "space_cache=v2"];
        description = "Common BTRFS mount options applied to all subvolumes.";
      };
    };

    swap.randomEncryption = lib.mkOption {
      type = lib.types.bool;
      default = cfg.luks.fido2.enable;
      defaultText = lib.literalExpression "config.othrys.system.disko.luks.fido2.enable";
      description = ''
        Encrypt swap with an ephemeral key generated on each boot instead of a
        persistent LUKS passphrase. Avoids a second unlock prompt at boot
        (recommended with FIDO2) at the cost of hibernation/resume. Defaults to
        luks.fido2.enable.
      '';
    };
  };

Partition Layout

            partitions = {
              # EFI System Partition
              boot = {
                size = cfg.bootSize;
                type = "EF00";
                priority = 1;
                content = {
                  type = "filesystem";
                  format = "vfat";
                  mountpoint = "/boot";
                  mountOptions = ["fmask=0077" "dmask=0077" "defaults"];
                };
              };

              # Swap partition (random-key ephemeral, or LUKS with the recovery passphrase)
              swap = {
                size = cfg.swapSize;
                priority = 2;
                content =
                  if cfg.swap.randomEncryption
                  then {
                    # Re-encrypted with a fresh random key each boot, so no second
                    # unlock prompt, but no hibernation/resume.
                    type = "swap";
                    randomEncryption = true;
                  }
                  else {
                    type = "luks";
                    name = cfg.luks.swapName;
                    inherit (cfg.luks) passwordFile;
                    extraFormatArgs = luksFormatArgs;
                    settings = {
                      inherit (cfg.luks) allowDiscards bypassWorkqueues;
                    };
                    content = {
                      type = "swap";
                      # Without a discard policy swap never trims, whatever
                      # the LUKS layer allows, so it follows allowDiscards.
                      discardPolicy = lib.mkIf cfg.luks.allowDiscards "both";
                    };
                  };
              };

              # LUKS Encrypted BTRFS Root
              root = {
                size = "100%";
                priority = 3;
                content = {
                  type = "luks";
                  inherit (cfg.luks) name passwordFile;
                  extraFormatArgs = luksFormatArgs;
                  settings = {
                    inherit (cfg.luks) allowDiscards bypassWorkqueues;
                  };
                  content = {
                    type = "btrfs";
                    extraArgs = ["-f"];

                    subvolumes = {
                      # Ephemeral root, wiped on every boot
                      "root" = {
                        mountpoint = "/";
                        mountOptions =
                          ["subvol=root" "compress=${cfg.btrfs.compression}"]
                          ++ cfg.btrfs.mountOptions;
                      };

                      # Persistent state, surviving reboots and mounting wherever
                      # the impermanence surface declares its root.
                      "persist" = {
                        mountpoint = config.othrys.system.impermanence.persistRoot;
                        mountOptions = ["subvol=persist"] ++ cfg.btrfs.mountOptions;
                      };

                      # Nix store, persistent
                      "nix" = {
                        mountpoint = "/nix";
                        mountOptions = ["subvol=nix"] ++ cfg.btrfs.mountOptions;
                      };
                    };
                  };
                };
              };
            };

BTRFS Subvolumes

                    subvolumes = {
                      # Ephemeral root, wiped on every boot
                      "root" = {
                        mountpoint = "/";
                        mountOptions =
                          ["subvol=root" "compress=${cfg.btrfs.compression}"]
                          ++ cfg.btrfs.mountOptions;
                      };

                      # Persistent state, surviving reboots and mounting wherever
                      # the impermanence surface declares its root.
                      "persist" = {
                        mountpoint = config.othrys.system.impermanence.persistRoot;
                        mountOptions = ["subvol=persist"] ++ cfg.btrfs.mountOptions;
                      };

                      # Nix store, persistent
                      "nix" = {
                        mountpoint = "/nix";
                        mountOptions = ["subvol=nix"] ++ cfg.btrfs.mountOptions;
                      };
                    };

Usage

Configure in host config:

othrys.system.disko = {
  enable = true;
  device = "/dev/disk/by-id/...";
  swapSize = "8G";
};

luks.passwordFile stays at its default of null for an install, and disko then prompts for the LUKS passphrase when it formats the disk. A sops secret does not exist on the target at that point, so a secrets path there names a file the installer cannot read. The option is for a host where the file is already present at format time.

device is meant to be a path under /dev/disk/by-id/. A name such as /dev/sda evaluates with a warning, since the kernel assigns those in probe order and disko formats whatever disk carries the name.

Both LUKS volumes are formatted with stated parameters, which are LUKS2, aes-xts-plain64 with a 512-bit key, SHA-256 and Argon2id. They match the current cryptsetup defaults and apply at format time only.

With the layout on, othrys.system.impermanence.device defaults to the LUKS mapping of the root, /dev/mapper/<luks.name>, which is the device the boot wipe mounts. See Impermanence.

luks.allowDiscards passes TRIM through the encryption layer, and services.fstrim.enable follows it at mkDefault, so the weekly timer is what issues the discards.

The initial install runs disko once in destroy,format,mount mode against the host, which erases the target disk. This repository ships no recipe for that step, since it holds no hosts. The Installation guide walks through it with the consuming fleet’s justfile.

Impermanence

Platforms: NixOS only.

The root filesystem is wiped on every boot. Only explicitly declared state persists.

Importing

The feature has two halves. The othrys.system.impermanence options and the root wipe are part of nixosModules.default. The bind mounts that carry state across the wipe come from the impermanence module, and nixosModules.default neither imports it nor writes into its options. A host with a persistent root imports nothing for this page.

A host with an ephemeral root imports the othrys adapter together with the impermanence module:

modules = [
  inputs.othrys.nixosModules.default

  inputs.othrys.nixosModules.impermanence
  inputs.impermanence.nixosModules.impermanence
];

with impermanence.follows = "othrys/impermanence"; among the flake inputs. nixosModules.full holds both imports already, so a host built from it adds neither.

nixosModules.impermanence is modules/system/impermanence.nix, the only file in the tree that writes environment.persistence. Enabling othrys.system.impermanence without it fails an assertion that names the export, since the root would be wiped on every boot and nothing bound back. The adapter without the impermanence module fails at evaluation, because the option it writes does not exist.

How It Works

  1. BTRFS root subvolume is mounted as /
  2. On boot, a systemd stage-1 unit moves the old root to old_roots/ with a timestamp
  3. A fresh empty root subvolume is created
  4. Old roots older than retentionDays are deleted, and a delete that fails is reported and the entry kept

The unit waits for the device named by othrys.system.impermanence.device and runs after a resume from hibernation would have taken over, so a resumed system never meets a wiped root.

The device

The wipe needs one fact about the disk, which is the block device holding the btrfs filesystem with the root and persist subvolumes. That is othrys.system.impermanence.device, and the module names no partitioning tool.

A host that uses the disko layout sets nothing. The nixosModules.disko export fills the option with its LUKS mapping, /dev/mapper/<luks.name>, as a default.

A host that partitions another way names the device itself, and needs neither the disko module nor the export:

othrys.system.impermanence = {
  enable = true;
  device = "/dev/disk/by-partlabel/root";
};

That host also declares the filesystems the layout would have. The root subvolume is mounted at /, the persist subvolume at othrys.system.impermanence.persistRoot, and /nix on a volume the wipe does not touch. The module marks the last two as needed for boot. For an encrypted root the device is the opened mapping, such as /dev/mapper/cryptroot, and not the partition under it.

Enabling impermanence with no device and no layout fails an assertion that names the option.

Options

  options.othrys.system.impermanence = {
    enable = lib.mkEnableOption "Impermanence (ephemeral root with opt-in persistence)";

    persistRoot = lib.mkOption {
      type = lib.types.str;
      default = "/persist";
      description = ''
        Mountpoint of the persistent volume. `nixosModules.impermanence`
        binds everything the othrys modules declare as persistent from this
        path, and the disko layout mounts the persist subvolume here, so one
        option moves the whole persistence surface. The btrfs subvolume
        itself is still named `persist` (the boot-wipe script addresses
        subvolumes, not mounts).
      '';
    };

    retentionDays = lib.mkOption {
      type = lib.types.ints.unsigned;
      default = 30;
      description = "Days to keep old root snapshots in /btrfs_tmp/old_roots before deletion.";
    };

    device = lib.mkOption {
      type = lib.types.nullOr lib.types.str;
      default = null;
      description = ''
        Block device holding the btrfs filesystem with the `root` and
        `persist` subvolumes. The wipe unit waits for this device in the initrd
        and mounts its top-level subvolume.

        The option has to be set on a host that enables impermanence. With
        `nixosModules.disko` imported and `othrys.system.disko.enable` on, the
        layout fills it with its LUKS mapping, `/dev/mapper/<luks.name>`, as a
        default. A host that partitions any other way names the device here,
        which is the LUKS mapping for an encrypted root and the partition
        itself for a plain one.
      '';
      example = "/dev/disk/by-partlabel/root";
    };
  };

Boot Wipe Script

Runs during early boot (initrd), after resume from hibernation but before root is mounted:

      boot.initrd.systemd.services.root-wipe = {
        description = "Wipe root BTRFS subvolume for impermanence.";
        wantedBy = ["initrd.target"];
        requires = [deviceUnit];
        # A resume from hibernation never returns from the resume unit, so this
        # only runs on a boot that is not a resume. Without the ordering the
        # wipe could run first and the resumed image would see a root that is no
        # longer the one it had mounted.
        after = [deviceUnit "systemd-hibernate-resume.service"];
        before = ["sysroot.mount"];
        unitConfig.DefaultDependencies = "no";
        serviceConfig.Type = "oneshot";
        script = ''
          mkdir -p /btrfs_tmp
          # subvolid=5 names the top-level subvolume. A host whose default
          # subvolume was changed with `btrfs subvolume set-default` would
          # otherwise mount that one and find no `root` to move.
          mount -o subvolid=5 ${lib.escapeShellArg cfg.device} /btrfs_tmp
          if [[ -e /btrfs_tmp/root ]]; then
              mkdir -p /btrfs_tmp/old_roots
              timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%d_%H:%M:%S")
              mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
          fi

          # The new root exists before anything that can fail below runs. A
          # prune that aborted between the move and this line left the host
          # with no root subvolume, and sysroot.mount dropped it into the
          # emergency shell.
          btrfs subvolume create /btrfs_tmp/root

          ${lib.optionalString usersEnabled "mkdir -p ${lib.escapeShellArg "/btrfs_tmp/persist${config.users.users.${username}.home}"}"}

          # `local IFS` keeps the split scoped to this function. Assigned
          # globally it survived the first call and silently changed how every
          # later word split behaved, including the retention loop below.
          delete_subvolume_recursively() {
              local IFS=$'\n'
              for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
                  delete_subvolume_recursively "/btrfs_tmp/$i"
              done
              btrfs subvolume delete "$1"
          }

          # Retention pruning, best-effort. Data-safety invariants:
          # - The glob lists the entries of old_roots and never old_roots
          #   itself, so an archive directory whose own mtime has aged past the
          #   window (a host up longer than retentionDays) is not a candidate.
          #   With `find` and no `-mindepth 1` it was, and the ENTIRE archive
          #   would be deleted at once.
          # - Only delete entries that are actually btrfs subvolumes, and a stray
          #   file or directory in old_roots is skipped (deleting the unknown is
          #   never the right move in a boot script) and must not fail the boot.
          # - A delete that fails is reported and the entry kept. The root above
          #   already exists, so nothing here can keep the host from booting.
          #
          # A glob with nullglob handles an empty archive and an entry name with
          # whitespace. The names are generated timestamps today, and a boot
          # script that deletes subvolumes should not depend on that staying
          # true. `find` is not on the stage-1 PATH, which is why the loop uses
          # `stat` instead; see initrdBin above.
          shopt -s nullglob
          cutoff=$(( $(date +%s) - ${toString cfg.retentionDays} * 86400 ))
          for i in /btrfs_tmp/old_roots/*; do
              if [ "$(stat -c %Y "$i")" -ge "$cutoff" ]; then
                  continue
              fi
              if btrfs subvolume show "$i" > /dev/null 2>&1; then
                  delete_subvolume_recursively "$i" \
                      || echo "impermanence: could not delete '$i', keeping it" >&2
              else
                  echo "impermanence: skipping non-subvolume '$i' in old_roots" >&2
              fi
          done
          shopt -u nullglob

          umount /btrfs_tmp
        '';
      };

The Persistence Registry

A module declares what it keeps across the wipe in othrys.internal.persist, under a key that is its own option path. It does not write environment.persistence.

  # Every othrys module that keeps state across the root wipe writes here,
  # keyed by its own option path, and nixosModules.impermanence is the only
  # file that writes the option the impermanence module declares.
  #
  # That option exists only on a host that imports the impermanence module,
  # and a write into an option nothing declares fails whatever condition
  # guards it. A module that wrote there directly made every host import the
  # impermanence module, a host with a persistent root included. This option
  # is declared by othrys itself, so a write to it evaluates everywhere and
  # is read only where the export is imported and impermanence is on.
  #
  # The export also applies the two guards, once. System paths are bound when
  # impermanence is on, and the paths under `user` only when
  # othrys.system.users.enable is on as well, since the impermanence module
  # resolves them against the home of an account that has to exist. No module
  # spells either guard, so none can spell it wrongly.
  #
  # A module with a second condition wraps its own value in lib.mkIf. The key
  # then disappears when the condition is false. lib.mkIf on a single list
  # works as well.
  #
  # The value is a typed submodule, unlike othrys.internal.homeConfig, which
  # is raw. A home-manager contribution carries lib.mkForce and lib.mkDefault
  # that have to reach home-manager unprocessed. A persistence entry is a
  # plain path with an optional owner and mode and carries no priority, so
  # the lists are merged here. That lets two blocks of one module share a
  # key, lets lib.mkIf sit on one list, and reports a misspelt attribute at
  # the module that wrote it.
  #
  # An entry keeps the forms the impermanence module accepts. It is a string,
  # or an attribute set with `directory` or `file` and any of `user`, `group`
  # and `mode`. The export passes each entry on unchanged, and the
  # impermanence module checks the attribute names.
  options.othrys.internal.persist = let
    entries = description:
      lib.mkOption {
        type = lib.types.listOf (lib.types.either lib.types.str (lib.types.attrsOf lib.types.anything));
        default = [];
        inherit description;
      };
  in
    lib.mkOption {
      type = lib.types.attrsOf (lib.types.submodule {
        options = {
          directories = entries "System directories to keep, as absolute paths.";
          files = entries "System files to keep, as absolute paths.";
          user = {
            directories = entries "Directories to keep in the primary user's home, relative to it.";
            files = entries "Files to keep in the primary user's home, relative to it.";
          };
        };
      });
      default = {};
      internal = true;
      # The sub-options would otherwise be listed in the options reference
      # under a parent that is not.
      visible = false;
      example = lib.literalExpression ''{ "services.tailscale".directories = [ "/var/lib/tailscale" ]; }'';
      description = "Per-module persistent paths, keyed by option path, handed to the impermanence module by nixosModules.impermanence.";
    };

Each value holds directories and files for system paths, and user.directories and user.files for paths in the primary user’s home. An entry is a string, or an attribute set with directory or file and any of user, group and mode, which are the forms the impermanence module accepts.

The adapter reads the whole registry and writes it under othrys.system.impermanence.persistRoot:

      # Both guards are applied here, once, and at the attribute-set level.
      # With impermanence off the persist root is not declared at all. With
      # no managed account the `users` set stays empty, since the
      # impermanence module reads users.users.<name>.home for every entry
      # under it and that account does not exist. A guard on a leaf would
      # still declare the user and fail there.
      #
      # The root is declared once any module has a key in the registry, and
      # the user once any module names a path in the home. A host on which
      # no module persists anything therefore keeps an empty
      # environment.persistence.
      environment.persistence = lib.mkIf (cfg.enable && registry != {}) {
        ${persistRoot} = {
          # Part of the system-critical set, so it follows that switch.
          hideMounts = lib.mkIf persistenceEnabled true;

          directories = collect (entry: entry.directories);
          files = collect (entry: entry.files);

          users = lib.mkIf (usersEnabled && (userDirectories != [] || userFiles != [])) {
            ${username} = {
              directories = userDirectories;
              files = userFiles;
            };
          };
        };
      };

Both guards live there. With impermanence off nothing is declared. With no managed account the paths under user are left out, since the impermanence module reads users.users.<name>.home to place each bind mount and that account does not exist. A host of that shape, with every app and desktop module on, is what the eval-persistence check evaluates. contract-guards rejects any other file that names environment.persistence, and eval-contract reads the writers back from two evaluated hosts.

A host adds paths of its own either way. It writes a key of its own in othrys.internal.persist, or it writes environment.persistence directly, which merges with what the adapter declares.

System Persistence

System-critical directories persisted in persistence.nixos.nix:

    othrys.internal.persist."system.persistence" = {
      directories = [
        {
          directory = "/var/lib/systemd";
          user = "root";
          group = "root";
          mode = "0755";
        }
        {
          directory = "/var/lib/nixos";
          user = "root";
          group = "root";
          mode = "0755";
        }
        {
          directory = "/var/log";
          user = "root";
          group = "root";
          mode = "0755";
        }
        {
          directory = "/var/db/sudo/lectured";
          user = "root";
          group = "root";
          mode = "0700";
        }
      ];

      # /etc/machine-id keys the journal directory, the systemd-networkd DHCP
      # identity and anything else that tracks the host by id. Left on the
      # wiped root it is regenerated on every boot.
      files = [
        "/etc/adjtime"
        "/etc/machine-id"
      ];

/etc/machine-id is in the set because the journal directory and the systemd-networkd DHCP identity are both derived from it. Without it every boot produces a new id.

A host that was already running when it first switches onto this gets its current id kept. impermanence refuses to mount over a machine-id file that already holds an id, so an activation step in the adapter copies the running id into the persist root and bind-mounts it before impermanence looks. A persisted file that is missing, empty or a leftover symlink is replaced, and one holding a different id is kept beside it as machine-id.replaced. At boot the step does nothing.

/nix/var is not in the set. The nix subvolume survives the wipe on its own, so the database, the profiles and the GC roots stay where the installer put them. Releases before v0.9.0 persisted it, and v0.9.0 to v0.16.0 carried an activation step that moved such a host onto the subvolume at its first switch. The step is gone, so a host that still bind-mounts <persistRoot>/nix/var switches to one of those releases first.

The SSH host keys are not bind-mounted. services.openssh.hostKeys points at <persistRoot>/etc/ssh/ directly, which is also where sops-nix reads the ed25519 key. A bind mount over /etc/ssh would cover the sshd_config that activation writes, and sshd on a freshly installed host would not start until the first switch.

User Persistence

Cross-cutting user directories (XDG, SSH, Projects):

      # Bound only on a host where othrys manages the user account. A
      # headless host persists system state without a primary user.
      user = {
        directories =
          (lib.attrNames xdgUserDirs)
          ++ [
            "Projects"
            {
              directory = ".ssh";
              mode = "0700";
            }
            ".cache/nix"
            ".local/state/home-manager"
            ".local/share/applications"
          ];

        files = [
          ".bash_history"
        ];
      };

Every entry under user is bound only when othrys.system.users.enable is on as well as impermanence, here and for each app module. The adapter applies that guard, as described above, and no module spells it.

Directories that hold a token, a key or a session are persisted at mode 0700. A file a program saves by renaming a temporary over it, such as zsh history, is persisted through its directory, since a rename onto a bind-mounted file fails.

App-Specific Persistence

Each module declares its own persistence:

# App-specific persistence lives in each app's module:
# - Steam → modules/apps/gui/gaming/steam.nix
# - Floorp → modules/apps/gui/floorp/floorp.nixos.nix
# - Signal → modules/apps/gui/signal.nix
# - Plexamp → modules/apps/gui/plexamp.nix
# - Audio → modules/hardware/audio.nix
# - Printing → modules/services/printing.nix
# - Tailscale → modules/services/tailscale.nixos.nix
# - Zsh/Zoxide → modules/system/shell/zsh.nixos.nix
# - Direnv → modules/apps/cli/development.nixos.nix
# - Bluetooth → modules/hardware/wireless/bluetooth.nix
# - WiFi → modules/hardware/wireless/wifi.nix
# - GPG/YubiKey → modules/services/security/yubikey.nixos.nix

Recovering files from a previous boot

The wipe archives each replaced root under old_roots for retentionDays. The old-roots tool (installed with this module) browses that archive, since every mount is read-only and restore only copies out:

old-roots list                          # archived snapshots (timestamps)
old-roots restore <snapshot> home/alice/notes.txt ./notes.txt
old-roots mount                         # browse under /run/old-roots/old_roots
old-roots umount

The recovery path is exercised by the impermanence VM test alongside the wipe behavior itself. A second VM test boots the unit itself from a btrfs root across three boots, so the initrd rendering, the device dependency and the stage-1 PATH are covered as well as the script.

Bootloader & Secure Boot

Platforms: NixOS only.

Supports Limine (default), systemd-boot, and GRUB. Secure Boot via sbctl, natively on Limine and through lanzaboote on systemd-boot.

Configuration

  config = lib.mkIf cfg.enable (lib.mkMerge [
    {
      assertions = [
        {
          assertion = !(cfg.secureBoot && cfg.type == "systemd-boot") || hasLanzaboote;
          message = "othrys.system.bootloader: secureBoot with type = \"systemd-boot\" requires lanzaboote. Add lanzaboote as a flake input and import lanzaboote.nixosModules.lanzaboote in the host's modules.";
        }
        {
          assertion = !(cfg.secureBoot && cfg.type == "grub");
          message = "othrys.system.bootloader: GRUB has no Secure Boot support in NixOS. Set type to \"limine\" or \"systemd-boot\", or set secureBoot = false.";
        }
        {
          assertion = !(cfg.secureBoot && cfg.type == "none");
          message = "othrys.system.bootloader: secureBoot does nothing with type = \"none\", since this module manages no bootloader there. Set type to \"limine\" or \"systemd-boot\", or set secureBoot = false.";
        }
      ];

      # Only a loader this module installs needs to write boot entries, and a
      # host can still say otherwise.
      boot.loader.efi.canTouchEfiVariables = lib.mkIf (cfg.type != "none") (lib.mkDefault true);

      boot.loader.limine = lib.mkIf (cfg.type == "limine") (
        {
          enable = true;
          secureBoot.enable = cfg.secureBoot;
          inherit (cfg) extraEntries;
        }
        // limit "maxGenerations"
      );

      # Lanzaboote installs and signs systemd-boot itself, so the stock module
      # goes off whenever lanzaboote takes over. Without the lanzaboote import
      # it stays on. Turning it off there leaves NixOS on its default GRUB,
      # whose own assertion then fails beside the one above.
      #
      # Lanzaboote reads its own limit from this option, so the one write
      # covers both.
      #
      # The menu editor lets anyone at the keyboard append `init=/bin/sh` to
      # the kernel command line, which is a root shell on a disk that is not
      # encrypted and a way around the login on one that is. nixpkgs leaves
      # it on; lanzaboote copies this flag into its own loader.conf. Limine
      # ships with its editor off.
      boot.loader.systemd-boot = lib.mkIf (cfg.type == "systemd-boot") (
        {
          enable = !(cfg.secureBoot && hasLanzaboote);
          editor = lib.mkDefault false;
        }
        // limit "configurationLimit"
      );

      # GRUB has no switch for its editor. Only a menu password keeps a
      # present attacker off the command line, and that is the host's own
      # `boot.loader.grub.users` to set.
      boot.loader.grub = lib.mkIf (cfg.type == "grub") (
        {
          enable = true;
          efiSupport = true;
          device = "nodev";
        }
        // limit "configurationLimit"
      );

      environment.systemPackages = lib.mkIf cfg.secureBoot [
        pkgs.sbctl
      ];

      othrys.internal.persist."system.bootloader" = lib.mkIf cfg.secureBoot {
        directories = [
          {
            directory = "/var/lib/sbctl";
            user = "root";
            group = "root";
            mode = "0700";
          }
        ];
      };
    }

    # The guard sits on the attrset because mkIf does not defer option
    # existence. A conditional write into boot.lanzaboote still fails on a
    # host that never imported the module.
    (lib.optionalAttrs hasLanzaboote {
      boot.lanzaboote = lib.mkIf (cfg.type == "systemd-boot" && cfg.secureBoot) {
        enable = true;
        pkiBundle = "/var/lib/sbctl";
      };
    })
  ]);

Bootloader Selection

Set in host config via othrys.system.bootloader.type:

ValueBootloaderSecure BootNotes
"limine"LimineYes, nativeDefault. Supports extra entries (dual-boot).
"systemd-boot"systemd-bootYes, needs lanzabooteSimple, well-supported.
"grub"GRUBRejectedEFI support, device = "nodev".
"none"NoneRejectedThe module manages no bootloader and the host configures one itself.

systemd-boot lets anyone at the keyboard edit the kernel command line from the menu, and init=/bin/sh there is a root shell. nixpkgs leaves that editor on. This module sets boot.loader.systemd-boot.editor to false as a default, and lanzaboote copies the flag into its own loader.conf, so both paths get the same answer. A host that wants the editor back assigns the option itself. Limine ships with its editor off. GRUB has no such switch; only a menu password, boot.loader.grub.users, keeps a present attacker off the command line, and the module leaves that to the host.

boot.loader.efi.canTouchEfiVariables is a default of true for the three loaders the module installs and is not set for "none".

Generation Limit

maxGenerations is how many of the newest generations the bootloader keeps on the boot partition and lists in its menu. It defaults to 5. Older generations stay in the system profile and only leave the boot menu. The option maps to boot.loader.limine.maxGenerations, or to configurationLimit for systemd-boot and GRUB. Lanzaboote takes its limit from the systemd-boot option. null writes nothing and leaves the bootloader’s own default, which is no limit for Limine and systemd-boot.

The limit exists because every listed generation has its kernel and its initrd copied to the boot partition. With no limit that is every generation in the profile, so the partition fills. Limine removes unused files only at the end of an install that succeeds. Once the partition is full, a switch fails with No space left on device in the bootloader install, and no later switch can free the space.

An install copies the new generation before it removes an old one, so the partition has to hold the limit plus one. One generation costs its kernel plus its initrd, and that varies a great deal between hosts.

Cost of one generation1G partition holdsHighest safe maxGenerations
40M2524
110M98
165M65
220M43

On a running Limine host, the size sudo du -sh /boot/limine/kernels reports, divided by the number of kernel and initrd pairs in that directory, gives the cost. A host with a large initrd, which a GPU driver loaded in the initrd typically causes, sets a lower number than the default.

Recovering a full boot partition

The limit cannot help until one install succeeds, so a partition that is already full needs space freed by hand. The installer names each file after the store directory it came from, such as <hash>-linux-6.18.51-bzImage, which makes the files of kept generations easy to tell apart.

  1. Delete old generations from the profile, keeping the newest three: sudo nix-env -p /nix/var/nix/profiles/system --delete-generations +3

  2. List the boot files that no kept generation, nor the booted or the current system, points at:

    sudo bash -c '
    keep=$(for g in /nix/var/nix/profiles/system-*-link /run/booted-system /run/current-system; do
      for f in kernel initrd; do basename "$(dirname "$(readlink -f "$g/$f")")"; done
    done | sort -u)
    find /boot/limine -type f \( -name "*-bzImage" -o -name "*-initrd" -o -name "*.tmp" \) | while read -r p; do
      b=$(basename "$p"); hit=0
      for k in $keep; do case "$b" in "$k"-*) hit=1 ;; esac; done
      [ "$hit" = 0 ] && du -h "$p"
    done'
    
  3. Read the list. Then run the same command with du -h "$p" replaced by rm -v "$p".

  4. Switch again. A successful install rewrites the boot menu from the kept generations.

Until that switch succeeds, the old boot menu still lists the deleted generations, and those entries do not boot. The newest entries keep every file they need.

Secure Boot

When othrys.system.bootloader.secureBoot = true:

  • sbctl is installed for managing Secure Boot keys
  • Keys in /var/lib/sbctl are persisted across reboots (via impermanence)
  • With "limine", boot.loader.limine.secureBoot.enable is set and Limine signs itself with the sbctl keys
  • With "systemd-boot", boot.lanzaboote is enabled with pkiBundle = "/var/lib/sbctl", and boot.loader.systemd-boot.enable goes to false because lanzaboote installs and signs systemd-boot itself

The Secure Boot guide walks through key creation and enrollment.

systemd-boot needs lanzaboote

nixosModules.default does not import lanzaboote, so a host that never enables Secure Boot on systemd-boot needs no extra input. A host that does adds the input and the module in the consuming flake:

inputs.lanzaboote.url = "github:nix-community/lanzaboote/<release-tag>";
modules = [inputs.lanzaboote.nixosModules.lanzaboote];

Without that import, secureBoot = true on "systemd-boot" fails evaluation with an assertion that names both lines.

What is rejected

  • GRUB has no Secure Boot support in NixOS, so secureBoot = true with type = "grub" fails evaluation instead of silently doing nothing.
  • type = "none" fails the same way, since the module manages no bootloader there.

Limits

  • No option exists for TPM measured boot. Lanzaboote’s boot.lanzaboote.measuredBoot options are left for the host to set directly.
  • The eval-bootloader check evaluates every type with secureBoot off and on, and reads back the loader options each combination sets. No check boots a VM under firmware Secure Boot, so the checks prove evaluation only.

Dual Boot

Add extra entries via othrys.system.bootloader.extraEntries (Limine format):

othrys.system.bootloader.extraEntries = ''
  /Windows 11
      protocol: efi
      path: uuid(...):/.../bootmgfw.efi
'';

Secrets Management

Platforms: NixOS and nix-darwin, through nixosModules.secrets and darwinModules.secrets. See Darwin.

Secrets are managed with sops-nix using age encryption. The identity used for editing can be backed by a YubiKey.

Architecture

This repository holds no secrets. othrys.system.secrets provides the sops-nix plumbing (age decryption, YubiKey identities), and the encrypted material lives in the consuming flake, typically as a private secrets input that its hosts declare and its CI stubs out.

  • Encrypted with age, backed by a YubiKey identity
  • Decrypted at activation time by sops-nix, never stored in the Nix store
  • Modules take runtime file paths, so what provides them is the consumer’s choice

Importing

The plumbing is the separate export nixosModules.secrets, which nixosModules.default does not import. It and its darwin form are the only othrys modules that write into the sops option namespace, so a host that wants it imports the export together with the sops-nix module, and a host that installs its secrets another way imports neither:

# flake inputs
sops-nix.follows = "othrys/sops-nix";

# host modules
inputs.othrys.nixosModules.secrets
inputs.sops-nix.nixosModules.sops

The export without the sops-nix module fails at evaluation, since a write into an undeclared option namespace fails whatever guards it. A host with neither still uses every other module, since each option that takes a secret takes a path and reads the file at run time.

A nix-darwin host imports darwinModules.secrets with the darwinModules.sops of the sops-nix flake, or takes both from darwinModules.full. The options are the same on both platforms.

Options

  options.othrys.system.secrets = {
    enable = lib.mkEnableOption "sops-nix secrets infrastructure";

    # Expose secrets repo paths for host configs to reference
    secretFiles = lib.mkOption {
      # Deliberately lib.types.path. These are ENCRYPTED sops files from the
      # secrets input, read at evaluation, so the store is where they belong.
      type = lib.types.attrsOf lib.types.path;
      default = secretsInput;
      defaultText = lib.literalExpression "inputs.secrets.secretFiles, or {} when no secrets input is declared";
      readOnly = true;
      description = ''
        Encrypted sops files, read from an optional `secrets` flake input in
        the consuming flake. othrys declares no such input itself.

        The contract is that when a consumer declares an input named `secrets`,
        it exposes `secretFiles` as an attrset of names to encrypted files, for
        example `{ common = ./common.yaml; host-atlas = ./atlas.yaml; }`.
        Declaring no `secrets` input is fine and leaves this empty. Declaring
        one that does not match the shape is an evaluation error rather than a
        silently empty attrset.
      '';
    };

    ageIdentityStubs = lib.mkOption {
      type = lib.types.nullOr lib.types.lines;
      default = null;
      example = ''
        #recipient: age1yubikey1qw3na0f9example...
        AGE-PLUGIN-YUBIKEY-1EXAMPLE...
      '';
      description = ''
        Age identity lines for manual sops editing, written to
        `~/.config/sops/age/keys.txt`.

        The content becomes a world-readable Nix store path, so this option is
        safe only for identities that hold no key material on their own. An
        age-plugin-yubikey stub qualifies, since the private key never leaves
        the token and the stub is only a pointer to it. A raw
        `AGE-SECRET-KEY-1...` does not, and an assertion rejects one. Use
        ageIdentityFile for anything secret.
      '';
    };

    ageIdentityFile = lib.mkOption {
      type = lib.types.nullOr othrysTypes.secretPath;
      default = null;
      example = "/run/secrets/sops/age-identity";
      description = ''
        Runtime path to an age identity file, pointed at by SOPS_AGE_KEY_FILE
        for manual sops editing. The required form for an identity that
        contains key material, since the file is read from the secrets provider
        at use time and nothing is copied into the store.
      '';
    };
  };

The manual-editing identity

Editing an encrypted file by hand needs an age identity that sops can find, and there are two options for supplying one. They differ in where the identity ends up, which is the whole of the choice.

ageIdentityStubs takes the identity inline and writes it to ~/.config/sops/age/keys.txt. Home Manager renders that content into the Nix store, where it is world-readable and stays readable for the life of every generation referencing it. That is acceptable for an age-plugin-yubikey stub, which names a token rather than carrying a key, since the private key never leaves the hardware and the stub is useless without it. An assertion rejects content containing AGE-SECRET-KEY, because a raw age identity pasted here would publish the sops master key to every user on the host.

ageIdentityFile takes a runtime path instead and points SOPS_AGE_KEY_FILE straight at it. No file is generated and nothing is copied, so this is the form to use whenever the identity is itself secret.

Host Configuration

Secrets are declared in host configs (not in modules) using othrys.system.secrets for infrastructure and sops.secrets.* for individual secret declarations. See Host Configuration for a real example.

No othrys module declares a sops secret. modules/system/secrets.nixos.nix and modules/system/secrets.darwin.nix write the decryption settings under sops.age, and they are the only files in the module tree that write into the sops namespace.

When a secret is installed

sops-nix installs secrets in two rounds. Secrets declared with neededForUsers = true land under /run/secrets-for-users/ before the users activation step, and every other secret lands under /run/secrets/ after it. The user password is read in that step, so othrys.system.users.passwordFile has to name a secret from the first round. A path under /run/secrets/ does not exist yet when the account is created, which leaves it with no usable password, and the module warns on that prefix.

sops.secrets."users/alice/password".neededForUsers = true;
othrys.system.users.passwordFile = config.sops.secrets."users/alice/password".path;

A secret defaults to root and mode 0400. A service that reads its secret as its own user needs owner set on the secret, which inadyn, headscale and grafana all do. Each of those options says so in its description.

The decryption key

sops-nix decrypts with the host’s ed25519 ssh key, read through sops.age.sshKeyPaths, and falls back to an age key it generates at sops.age.keyFile. On an impermanence host both paths sit under the persist root, where othrys.system.persistence keeps the ssh host keys, so the module asserts that persistence.enable and services.openssh.enable are on whenever impermanence is. Without them the key is regenerated on every boot and nothing decrypts. The three sops.age values are set with mkDefault, so a host that keeps its key elsewhere overrides them directly.

On nix-darwin the adapter sets sops.age.sshKeyPaths and sops.gnupg.sshKeyPaths to empty lists, since a Mac may run no sshd and have no host key. It turns sops.age.generateKey on, as the NixOS adapter does, so sops-nix creates an age key at sops.age.keyFile on the first activation. The host names that path, since sops-nix gives it no default on darwin, and a host with no age key file, ssh key or GnuPG home is refused.

Secret Files

FilePurpose
common.yamlSecrets shared by every host (user passwords, service credentials)
<hostname>.yamlHost-specific secrets (e.g. the boot recovery password)

YubiKey Setup

The othrys.services.security.yubikey module provides age-plugin-yubikey for manual sops editing. The module sets no touch policy. The policy belongs to the identity on the key and is chosen when that identity is generated, and the onboarding script generates it with a touch required for every decryption.

To provision a new YubiKey with an age identity for sops-nix (along with PGP keys and U2F credentials):

# New key generation
just yubikey-onboard

# Rotate keys using existing master key backup
just yubikey-onboard -- --from-backup /mnt/usb/yubikey-backup

The script generates the ageIdentityStubs value and age recipient needed for the host configs and .sops.yaml. When provisioning multiple YubiKeys for redundancy, add all age recipients to .sops.yaml. See the YubiKey Onboarding guide for the full workflow.

Key Rotation

A YubiKey backs four independent credential surfaces. Rotation means updating each one it touches. Redundancy is the backup strategy: enroll several YubiKeys so losing one is a revocation, not a lockout. The boot passphrase (sops security/boot/password) is the break-glass slot.

SurfaceWhere it’s declaredRotated with
age / sops identityothrys.system.secrets.ageIdentityStubs (host) + recipients in .sops.yaml (secrets repo)sops updatekeys
LUKS root unlockothrys.system.disko.luks.fido2.enable (FIDO2 keyslot on the device)just luks-enroll / systemd-cryptenroll --wipe-slot
SSH (GPG auth)othrys.services.security.yubikey.sshKeygrips (host)edit list + rebuild
U2F login/sudoothrys.services.security.yubikey.u2fMappings.<user> (host)edit list + rebuild

The secret files and .sops.yaml live in the private secrets flake input, so rotation spans two repos: this config (host options) and the secrets repo (.sops.yaml + sops updatekeys).

Add a YubiKey (grow redundancy)

  1. Provision the key: just yubikey-onboard (or just yubikey-onboard -- --from-backup <path> to clone an existing identity from its master-key backup). Note the printed age recipient, keygrip, and U2F line.
  2. age: add the new recipient to .sops.yaml in the secrets repo, then re-encrypt every secret so the new key can read it:
    sops updatekeys secrets/*.yaml
    
  3. LUKS: with the root unlocked, add a FIDO2 keyslot for the new key (repeat per host):
    just luks-enroll            # touch the key when it blinks, break-glass passphrase authorizes the new slot
    sudo systemd-cryptenroll /dev/disk/by-id/<root>   # verify the token count
    
  4. SSH / U2F: append the new keygrip to sshKeygrips and the new credential to u2fMappings.<user> in the host config.
  5. just switch <host> to apply, then confirm login/sudo/SSH work with the new key before relying on it.

Revoke a YubiKey (lost or compromised)

Do this from a machine that still has a working key. Order matters. Re-encrypting before removing the compromised recipient’s access is impossible, so revoke everywhere:

  1. age: remove the lost key’s recipient from .sops.yaml, then sops updatekeys all secret files. The old key can no longer decrypt them.
  2. LUKS: wipe its keyslot on every host (list first to find the slot):
    backing=$(sudo cryptsetup status cryptroot | awk '/device:/ {print $2}')
    sudo systemd-cryptenroll "$backing"                 # identify the FIDO2 slot
    sudo systemd-cryptenroll --wipe-slot=<n> "$backing" # or --wipe-slot=fido2 to drop all FIDO2 slots and re-enroll survivors
    
  3. Config: delete the key’s sshKeygrips entry, its u2fMappings.<user> credential, and its ageIdentityStubs block if it was the manual-edit identity. Ensure at least one surviving key remains in each list (the u2fMappings assertion blocks a login lockout).
  4. Rotate exposed secrets: anything the lost key could decrypt is potentially compromised. Regenerate user/boot passwords and any service credentials, re-encrypt, and just switch every host.
  5. Confirm the revoked key is rejected (SSH, sudo, and, after a reboot, LUKS unlock).

WSL

Platforms: NixOS only.

A host that runs as a NixOS-WSL distro on Windows. WSL starts the distro inside a kernel Windows owns, and hands it its disk, its network and its resolver. NixOS-WSL turns off the kernel, the initrd and the bootloader to match.

Importing

The adapter is the separate export nixosModules.wsl, which neither nixosModules.default nor nixosModules.full imports. It is the only othrys module that writes into the wsl option namespace, so a WSL host imports the export together with the NixOS-WSL module:

# flake inputs
nixos-wsl.follows = "othrys/nixos-wsl";

# host modules
inputs.othrys.nixosModules.wsl
inputs.nixos-wsl.nixosModules.default

Options

  options.othrys.system.wsl = {
    enable = lib.mkEnableOption "running the host as a NixOS-WSL distro";

    defaultUser = lib.mkOption {
      type = lib.types.str;
      default = config.othrys.system.user.name;
      defaultText = lib.literalExpression "config.othrys.system.user.name";
      description = "The account WSL logs in as when the distro starts, written to `wsl.defaultUser`.";
    };

    windowsPath = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = ''
        Append the Windows PATH to the PATH of the distro. Off by default, so
        a name such as `git` or `node` resolves to the Nix package and not to
        a Windows binary of the same name. Interop stays on either way, and a
        Windows binary still runs by its full path, as in
        `/mnt/c/Windows/explorer.exe`.
      '';
    };

    usbip = {
      enable = lib.mkEnableOption "attaching Windows USB devices through usbipd-win";

      autoAttach = lib.mkOption {
        type = lib.types.listOf lib.types.str;
        default = [];
        example = ["4-1"];
        description = ''
          Bus IDs to attach at boot, as `usbipd list` prints them on Windows.
          Each device has to be bound once on Windows with
          `usbipd bind --busid <id>`.
        '';
      };

      hostAddress = lib.mkOption {
        type = lib.types.nullOr lib.types.str;
        default = null;
        example = "127.0.0.1";
        description = ''
          The address of the Windows host that runs usbipd-win. null keeps the
          NixOS-WSL default, which reads the gateway of `eth0`. Under
          `networkingMode=mirrored` the distro has no such route, so a
          mirrored host sets `127.0.0.1`.
        '';
      };
    };

    startMenuLaunchers = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = "Add a Windows Start menu shortcut for each GUI application the host installs.";
    };
  };

Usage

othrys.system.wsl = {
  enable = true;
  usbip = {
    enable = true;
    autoAttach = ["4-1"];
    hostAddress = "127.0.0.1";
  };
};

WSL logs in as othrys.system.user.name unless defaultUser names another account.

The Windows PATH stays out of the shell by default, so a name such as git resolves to the Nix package. Interop stays on, and a Windows binary runs by its full path under /mnt/c.

A USB device such as a YubiKey reaches the distro through usbipd-win. Each device is bound once on Windows with usbipd bind --busid <id>, and its bus ID goes in usbip.autoAttach. NixOS-WSL finds the Windows host from the gateway of eth0, which a distro under networkingMode=mirrored does not have, so a mirrored host sets usbip.hostAddress = "127.0.0.1".

Five othrys modules configure what WSL owns, and a WSL host that enables one is refused at evaluation. They are othrys.system.bootloader, othrys.system.disko, othrys.system.impermanence, othrys.system.kernel and othrys.system.networking.

Installing

NixOS-WSL builds an importable tarball from the host’s own configuration. On a Linux machine with the consuming flake:

sudo nix run .#nixosConfigurations.<host>.config.system.build.tarballBuilder

The builder writes nixos.wsl to the working directory. On Windows, the tarball is imported with wsl --import <host> <directory> nixos.wsl, or opened directly where the installed WSL supports it.

System

Platforms: The user, the account, Nix, git, the locale, the persistence registry and the Home Manager, Stylix and secrets adapters run on NixOS and nix-darwin. The bootloader, disko, impermanence, hardening, the kernel, networking and automatic upgrades are NixOS only. See Darwin.

Core system modules under othrys.system.*, located in modules/system/. Each is toggled by its own enable option (except user, which only declares the identity option) and configures a fundamental part of the machine.

The disk, impermanence, bootloader, and secrets modules have dedicated pages under System Infrastructure, and the rest are summarized here.

Available Modules

ModuleOptionDescription
User identityothrys.system.user.namePrimary user account name, required, replaces the legacy username specialArg
Usersothrys.system.usersUser account creation, shell, password wiring
Home Manager adapterothrys.system.users.homeManagerHands every module’s user configuration to Home Manager. Exported as nixosModules.home and not part of default, see Host Configuration
Localeothrys.system.localeTimezone, locale, console font/keymap (defaults are identity-neutral: UTC)
Auto-upgradeothrys.system.autoUpgradeUnattended nixos-rebuild from the fleet flake
Nixothrys.system.nixNix settings, GC/nh, substituters, optional Cachix
Kernelothrys.system.kernelKernel package selection (disabled → NixOS default kernel)
Hardeningothrys.system.hardeningOpt-in kernel and sysctl hardening profile, with the costly switches kept separate
Networkingothrys.system.networkingsystemd-networkd: per-interface DHCP/static + bridges/VLANs (router topology)
Gitothrys.system.gitGit identity and aliases (home-manager)
Persistenceothrys.system.persistenceThe persistence registry, and the system/user state declarations for impermanence
Impermanenceothrys.system.impermanenceRoot wipe on boot and the old-roots recovery tool. The bind mounts come from nixosModules.impermanence, which is not part of default, see Impermanence
Diskoothrys.system.diskoDisk layout with LUKS and BTRFS subvolumes, exported as nixosModules.disko and not part of default, see Disko
Bootloaderothrys.system.bootloaderLimine, systemd-boot or GRUB, with optional Secure Boot, see Bootloader & Secure Boot
Secretsothrys.system.secretssops-nix wiring and the manual-editing age identity, exported as nixosModules.secrets and darwinModules.secrets and not part of default, see Secrets Management
Themeothrys.themeThe palette, fonts, opacity and wallpaper every module reads, see Theming
Stylix adapterothrys.system.stylixStylix configured from othrys.theme, exported as nixosModules.stylix and darwinModules.stylix and not part of default
Shellothrys.system.shell.{bash,zsh,starship}Interactive shells and prompt, see Shell
Default editorothrys.system.defaultEditorThe command behind EDITOR and VISUAL, vim by default

On darwin, othrys.system.users writes only the home directory and the primary user, and the password, group and mutableUsers options have no effect there. othrys.system.users.uid exists only on darwin, where it hands the account to nix-darwin, and the generated reference marks it nix-darwin only. othrys.system.locale sets the timezone and LANG there, and its console options have no effect. See Darwin.

Notes

  • User identity: modules read config.othrys.system.user.name. It is a required option with no default and no username specialArg fallback, so set it per host. See the consumer contract in the repository AGENTS.md. The name starts with a lowercase letter or an underscore and continues with lowercase letters, digits, underscores and hyphens. Any other value, such as Alice, is refused at evaluation.
  • Home directory: the XDG user directories and the persisted home follow users.users.<name>.home, so a host that places the account outside /home sets that option and nothing else.
  • Git identity: othrys.system.git.name and othrys.system.git.email default to null and are required together on a host where Home Manager manages the primary user, since that is where the identity is written. Enabling git without them fails an assertion that names both options. A host without a managed user installs git and needs neither.
  • Bridge and vlan references: othrys.system.networking.interfaces.<name>.bridge and every entry of interfaces.<name>.vlans have to name a netdev the host declares, under bridges or vlans or as a netdev of that kind in systemd.network.netdevs. A name that matches none fails an assertion naming the interface and the missing netdev, where systemd-networkd would leave the port unconfigured without a report.
  • State version: othrys.system.nix.stateVersion is likewise required with no default. It records the release a host was first installed at, so the library cannot supply one on the host’s behalf.
  • Identity-neutral defaults: locale.timezone defaults to UTC and nix.nh.flake defaults to null; set them per host. These are examples of the library’s “sane, non-personal defaults” policy.

Auto-upgrade

Unattended nixos-rebuild from the fleet flake on a schedule (daily 04:00 by default, randomized delay so a fleet doesn’t stampede the repo host). Reboots are opt-in and window-confined, and failures push through othrys-notify when the notify module is enabled.

Signature verification

Verification is off by default. With it off, nixos-rebuild follows whatever flake resolves to and nothing checks a signature, so whoever can push to the repository or answer the fetch decides what the host runs as root.

With verify.enable on, flake stays unset and the host names a git URL instead. A oneshot unit, othrys-auto-upgrade-verify.service, fetches that URL and verifies the target before every upgrade. nixos-upgrade.service requires the unit and is ordered after it, so a failed verification means no rebuild. The unit carries the same othrys-notify failure hook as the upgrade. The rebuild then reads a local checkout of the verified commit and never the network.

othrys.system.autoUpgrade = {
  enable = true;
  verify = {
    enable = true;
    url = "https://example.com/alice/hosts.git";
    publicKeys = [./keys/alice.asc];
  };
};
  • What is verified: in commit mode the tip of verify.ref has to pass git verify-commit. Only the tip is checked, since a signer who signs a commit vouches for the history beneath it. In tag mode the highest tag matching verify.tagPattern by version sort has to pass git verify-tag, and the host upgrades to the commit it points at. A newer tag that is unsigned or lightweight stops upgrades until it is removed, because falling back to an older tag would let anyone with push access hold a host back.
  • Which keys count: only the files in verify.publicKeys, or the entries of verify.allowedSigners for format = "ssh". OpenPGP keys are imported into a keyring that exists for one run, and the unit reads no other git or GnuPG configuration. A signature in the format that is not configured fails. These keys are trust roots, so they belong in the host configuration. The generation a host currently runs fixes them, which means rotating a key takes a commit signed by a key that is still listed. The unit never takes a key from the repository it is verifying.
  • What the signature covers: the commit, which includes flake.lock. The lock file pins every input by hash, so one signature fixes every input along with the repository’s own files. Flags that let the evaluation or the build escape it (--update-input, --recreate-lock-file, --override-input, --override-flake, --option, --impure) fail an assertion when verify is on.
  • Staleness: a source that stops advancing verifies cleanly every night, so verify.maxAge (default 30 days) has the unit log a warning once the verified commit is older than that, and send a notification when the notify module is on. The upgrade still runs, and a notification that cannot be sent is logged as a second warning. Null turns the report off.
  • Rollback rule: the last verified commit id is kept in /var/lib/othrys-auto-upgrade-verify/last-verified. A new target that does not descend from it fails the unit, which stops a validly signed but older commit from being replayed. After a deliberate history rewrite, delete that file and the next run accepts the new history. The directory is persisted when impermanence is on.
  • Failure behaviour: any failure leaves the previous checkout in place, exits non-zero and logs one line naming the reason.

The fetch is anonymous, so the repository has to be readable without credentials. The unit is sandboxed like notify-failure@ but runs as root without capabilities, because Nix refuses to read a git repository owned by another user and the rebuild reads the checkout as root.

Options

  options.othrys.system.autoUpgrade = {
    enable = lib.mkEnableOption "unattended nixos-rebuild from the host configuration flake";

    flake = lib.mkOption {
      type = lib.types.nullOr lib.types.str;
      default = null;
      example = "github:example/hosts";
      description = "Flake URI the host upgrades from (the host configuration flake, not this library). Identity-shaped, set from the consuming host. Private repos need fetch credentials (e.g. a netrc via secrets). Nothing checks a signature on this path. Leave it null and use verify for that.";
    };

    dates = lib.mkOption {
      type = lib.types.str;
      default = "04:00";
      description = "systemd calendar expression for the upgrade timer (daily at 04:00 by default, since servers want security fixes promptly).";
    };

    allowReboot = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = "Reboot when the new generation requires it (kernel/systemd changes). Off by default, so enable deliberately with a rebootWindow.";
    };

    rebootWindow = lib.mkOption {
      type = lib.types.nullOr (lib.types.attrsOf lib.types.str);
      default = null;
      example = {
        lower = "03:00";
        upper = "05:00";
      };
      description = "Time window reboots are confined to (with allowReboot). Null reboots whenever the upgrade lands.";
    };

    randomizedDelaySec = lib.mkOption {
      type = lib.types.str;
      default = "30min";
      description = "Random delay added to the timer so a fleet doesn't hit the flake host simultaneously.";
    };

    flags = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = [];
      description = "Extra flags passed to nixos-rebuild.";
    };

    verify = {
      enable = lib.mkEnableOption "signature verification of the host configuration repository before every upgrade";

      url = lib.mkOption {
        type = lib.types.str;
        example = "https://example.com/alice/hosts.git";
        description = "Git URL the verify unit fetches. The fetch is anonymous, so the repository has to be readable without credentials.";
      };

      ref = lib.mkOption {
        type = lib.types.str;
        default = "main";
        description = "Branch followed in commit mode. Its tip has to carry a good signature.";
      };

      mode = lib.mkOption {
        type = lib.types.enum ["commit" "tag"];
        default = "commit";
        description = "What carries the signature. commit verifies the tip of ref with git verify-commit. tag takes the highest tag matching tagPattern by version sort, verifies it with git verify-tag and upgrades to the commit it points at, so an unsigned newer tag stops upgrades until it is removed.";
      };

      tagPattern = lib.mkOption {
        type = lib.types.str;
        default = "v*";
        description = "Glob selecting the tags considered in tag mode.";
      };

      format = lib.mkOption {
        type = lib.types.enum ["openpgp" "ssh"];
        default = "openpgp";
        description = "Signature format that is accepted. A signature in the other format fails verification.";
      };

      maxAge = lib.mkOption {
        type = lib.types.nullOr lib.types.ints.positive;
        default = 30;
        example = 90;
        description = ''
          Days after which a verified commit counts as stale. A source that
          stops advancing verifies cleanly every night, so once the commit the
          host follows is older than this the unit logs a warning and, with
          the notify module on, sends a notification. The upgrade itself still
          runs. Null turns the report off.
        '';
      };

      publicKeys = lib.mkOption {
        type = lib.types.listOf lib.types.path;
        default = [];
        example = lib.literalExpression "[./keys/alice.asc]";
        description = "ASCII-armoured OpenPGP public key files, used when format is openpgp. These are the only keys whose signatures pass. A path literal is copied into the store, while a string such as \"/run/secrets/signer.asc\" is read at run time.";
      };

      allowedSigners = lib.mkOption {
        type = lib.types.nullOr lib.types.path;
        default = null;
        example = lib.literalExpression "./keys/allowed_signers";
        description = "OpenSSH allowed signers file, used when format is ssh. Path literals and runtime path strings are handled as in publicKeys.";
      };

      attribute = lib.mkOption {
        type = lib.types.str;
        default = config.networking.hostName;
        defaultText = lib.literalExpression "config.networking.hostName";
        description = "The nixosConfigurations attribute of the verified repository that the host builds.";
      };
    };
  };

Hardening

othrys.system.hardening is an opt-in profile. With enable off, which is the default, the module sets nothing. With it on, the host gets the sysctls below, which cost nothing on an ordinary workstation or server.

sysctlValueEffect
kernel.kptr_restrict2Kernel pointers are hidden from every user, root included
kernel.dmesg_restrict1Reading the kernel log needs CAP_SYSLOG
kernel.unprivileged_bpf_disabled1Only privileged processes load BPF programs
net.core.bpf_jit_harden2The BPF JIT blinds constants for all users
kernel.yama.ptrace_scope1A process attaches only to its own descendants
kernel.kexec_load_disabled1No new kernel can be loaded with kexec until reboot
net.ipv4.conf.{all,default}.rp_filter2Loose reverse path filtering
net.ipv4.conf.{all,default}.accept_redirects0ICMP redirects are ignored
net.ipv4.conf.{all,default}.secure_redirects0Redirects from listed gateways are ignored as well
net.ipv4.conf.{all,default}.send_redirects0The host sends no ICMP redirects
net.ipv6.conf.{all,default}.accept_redirects0IPv6 redirects are ignored
net.ipv4.conf.{all,default}.accept_source_route0Source-routed IPv4 packets are dropped
net.ipv6.conf.{all,default}.accept_source_route0Source-routed IPv6 packets are dropped
net.ipv4.tcp_syncookies1SYN cookies are used when the SYN queue overflows
net.ipv4.icmp_echo_ignore_broadcasts1Broadcast pings are ignored
net.ipv4.tcp_rfc13371A reset does not end a connection in TIME-WAIT
fs.suid_dumpable0A setuid process writes no core dump
fs.protected_fifos, fs.protected_regular2A FIFO or file in a sticky world-writable directory is not opened across owners
vm.unprivileged_userfaultfd0Only root uses userfaultfd
dev.tty.ldisc_autoload0Opening a tty loads no line discipline module
dev.tty.legacy_tiocsti0A process cannot push input into its terminal
kernel.perf_event_paranoid2Unprivileged perf sees user space only

The profile also adds three kernel parameters through othrys.system.hardening.kernelParams, which are slab_nomerge, page_alloc.shuffle=1 and vsyscall=none. A list option merges every definition, so a host changes them by setting that option and not by assigning boot.kernelParams. init_on_free=1 and debugfs=off are left out, since the first costs on every free and the second breaks tooling.

Reverse path filtering

rp_filter is loose (2) rather than strict (1). Strict mode drops a packet when the route back to its sender leaves through a different interface, which is the normal state of a Tailscale exit node client and of a multi-homed router. The kernel applies this check regardless of the firewall, so a strict sysctl would also undo the loose networking.firewall.checkReversePath that NixOS selects when othrys.services.tailscale is on. Loose mode still drops packets whose source is unreachable through any interface.

othrys.services.router assigns its own values, and they win over the profile. The kernel validates a packet with the higher of conf.all and the interface’s own value, so the router sets all to 0, its WAN interface to strict and everything else to loose. A router with the profile on keeps strict filtering on its WAN.

Overriding one value

Every sysctl is written at priority 900. That is above the mkDefault definitions NixOS ships for kernel.kptr_restrict and, under security.protectKernelImage, for kernel.kexec_load_disabled. It is below a plain assignment, so a host changes one value by assigning it, with no mkForce.

{
  othrys.system.hardening.enable = true;

  # A debugger has to attach to processes it did not start.
  boot.kernel.sysctl."kernel.yama.ptrace_scope" = 0;
}

The costly switches

Two further options stay off unless the host asks for them, because each one breaks something.

  • lockKernelModules sets security.lockKernelModules. No module loads after boot, so hardware plugged in later, and VPN or filesystem modules that were not loaded at boot, stop working until the next reboot. List the modules the host needs later in boot.kernelModules.
  • protectKernelImage sets security.protectKernelImage. Hibernation and kexec are disabled. Evaluation fails when the host sets boot.resumeDevice or passes resume= in boot.kernelParams.

The profile has no switch for unprivileged user namespaces. nixpkgs removed security.unprivilegedUsernsClone together with the hardened kernels that carried the sysctl. The remaining upstream switch, security.allowUserNamespaces, turns user namespaces off for every user and conflicts with the Nix build sandbox, so a host that wants it sets it directly.

Options

  options.othrys.system.hardening = {
    enable =
      lib.mkEnableOption "the kernel and sysctl hardening profile"
      // {
        description = ''
          Apply the low-cost kernel and network sysctl hardening profile. The
          profile is opt-in, and nothing is set while this is off.

          Every sysctl is written below the priority of a plain assignment, so a
          host overrides any single value by setting the same key under
          `boot.kernel.sysctl`. The values restrict kernel pointer and dmesg
          exposure, unprivileged BPF, ptrace and kexec, and turn off ICMP
          redirects and source routing.

          `rp_filter` is set to loose mode (2) rather than strict (1). Strict
          mode drops replies that arrive on a different interface from the
          route back to the sender, which breaks Tailscale exit nodes and
          multi-homed routers. It also overrides the loose
          `networking.firewall.checkReversePath` that the Tailscale module
          selects, since the kernel check runs regardless of the firewall.
          `othrys.services.router` assigns loose mode to `all` and `default`
          as well, and strict mode to its WAN interface alone.

          `lockKernelModules` and `protectKernelImage` are separate options
          because each one breaks something, and neither is implied by
          `enable`.
        '';
      };

    kernelParams = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = ["slab_nomerge" "page_alloc.shuffle=1" "vsyscall=none"];
      description = ''
        Kernel command-line parameters the profile adds. The defaults cost
        nothing measurable: slab_nomerge keeps caches apart so an overflow in
        one stays in it, page_alloc.shuffle randomises the page allocator's
        free lists, and vsyscall=none removes the fixed-address legacy
        syscall page. init_on_free and debugfs=off are not here, since the
        first costs on every free and the second breaks tooling, and a host
        that wants them adds them. Set the list to change it, since a list
        option merges rather than overrides.
      '';
    };

    lockKernelModules = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = ''
        Set `security.lockKernelModules`, which disables kernel module loading
        once the system has booted.

        No module can load after boot. Hardware plugged in later, and VPN or
        filesystem modules that were not loaded at boot, stop working until
        the next reboot. List every module the host needs later in
        `boot.kernelModules` so it is loaded before the lock.
      '';
    };

    protectKernelImage = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = ''
        Set `security.protectKernelImage`, which prevents the running kernel
        image from being replaced.

        Hibernation and kexec are disabled. Evaluation fails on a host that
        sets `boot.resumeDevice` or passes `resume=` in `boot.kernelParams`,
        since such a host would lose the ability to resume.
      '';
    };
  };

Applications

Platforms: gh, senpai, tmux, yazi, comma, nixvim, the language registry, Ghostty, kitty, mpv, VSCodium, IntelliJ IDEA and Signal run on NixOS and nix-darwin. The rest are NixOS only. See Darwin.

Application modules under othrys.apps.*, split into CLI and GUI categories.

Application modules curate each app’s integration (persistence, theming, sane settings). Personal choices (search engines, wordmarks, tokens) are options the consuming fleet sets.

CLI Applications (modules/apps/cli/)

No desktop environment required, so these are usable on servers and headless systems.

ModuleOptionDescription
Nixvimothrys.apps.nixvimNeovim configured via Nix (sub-modules for plugins/languages)
Languagesothrys.apps.languages.<name>Per-language toolchains shared by the PATH and both editors
Developmentothrys.apps.developmentDevelopment tools bundle, direnv with its allow database persisted
GitHub CLIothrys.apps.ghgh with its settings, the git credential helper, a token file for a headless host and read-only commands pre-approved for Claude Code and Codex
senpaiothrys.apps.senpaiTerminal IRC client for a bouncer, with the password read from a file at connect time
tmuxothrys.apps.tmuxTerminal multiplexer
Yaziothrys.apps.yaziTerminal file manager
Commaothrys.apps.commaRun uninstalled programs with nix-index, whose command-not-found handler names the package for a missing command

The assistant modules under modules/apps/cli/ai/ are listed on the AI Assistants page.

Nixvim and Comma each import a Home Manager module from a flake this library locks, nixvim and nix-index-database. A consuming flake declares neither input. There is no package option for either, since the module builds what it installs, so a consumer who wants another revision makes this library’s input follow their own.

inputs = {
  nixvim.url = "github:nix-community/nixvim";
  othrys.inputs.nixvim.follows = "nixvim";
};

Nixvim builds its plugins from the nixpkgs the host’s own package set was built from, whichever revision of the module is in use.

GUI Applications (modules/apps/gui/)

Require a desktop environment.

ModuleOptionDescription
Ghosttyothrys.apps.ghosttyTerminal emulator with rich options
Kittyothrys.apps.kittyAlternative terminal emulator
Floorpothrys.apps.floorpFirefox-based browser
Chromiumothrys.apps.chromiumUngoogled Chromium with extensions from pinned CRX files
VSCodiumothrys.apps.vscodeVSCodium editor, wired to the shared language toolchains
Vesktopothrys.apps.vesktopDiscord client with Wayland support
Discordothrys.apps.discordOfficial Discord client, with ~/.config/discord persisted at mode 0700
IDEAothrys.apps.ideaIntelliJ IDEA with a curated plugin catalogue. Requires othrys.apps.languages.java
Signalothrys.apps.signalSignal messenger
OBSothrys.apps.obsScreen recording/streaming. Enables othrys.services.virtualcamera, and builds with CUDA when othrys.hardware.nvidia is on
Picardothrys.apps.picardMusicBrainz tagger. NixOS only, since its pyqt6 fails to build on darwin
Plexampothrys.apps.plexampPlex music player
RustDeskothrys.apps.rustdeskRemote desktop client. Persists ~/.config/rustdesk, and forceX11 starts the launcher through XWayland
Remminaothrys.apps.remminaRemote desktop client for VNC, RDP, SPICE and SSH. Persists ~/.config/remmina and ~/.local/share/remmina at mode 0700, and starts nothing at login
LocalSendothrys.apps.localsendLocal file sharing
MPVothrys.apps.mpvMedia player

The modules under modules/apps/gui/gaming/ are listed on the Gaming page.

GitHub CLI

othrys.apps.gh installs gh and writes its config.yml. gitProtocol, editor and aliases cover the common keys, and settings takes any other key and is merged over them, so a key set there wins. editor follows othrys.system.defaultEditor. extensions takes a list of packages.

othrys.apps.gh = {
  enable = true;
  aliases.co = "pr checkout";
  settings.pager = "less -FRX";
};

The module does not log in. On a desktop, run gh auth login once. It runs GitHub’s OAuth device flow, which shows a code to enter in a browser, and it stores the resulting token in the Secret Service keyring when one is running. othrys.desktop.keyring provides that keyring on a graphical host. Without one gh falls back to a plain file, ~/.config/gh/hosts.yml. Under impermanence ~/.config/gh is persisted at mode 0700 for the primary user, which keeps the account name in both cases and the token in the second.

With credentialHelper.enable, which is on by default, git asks gh for credentials on the URLs in credentialHelper.hosts. A clone, fetch or push over HTTPS then uses the gh login, and no second credential is stored for git. A remote reached over SSH is not affected.

A headless host has no browser for the device flow and no keyring to hold the result. tokenFile names a runtime path that a secrets provider writes, and the file has to be readable by the primary user.

othrys.apps.gh = {
  enable = true;
  gitProtocol = "https";
  tokenFile = "/run/secrets/gh-token";
};

gh reads a token only from the GH_TOKEN environment variable, so with tokenFile set the gh on the PATH is a wrapper around the real program. The wrapper reads the file, sets GH_TOKEN in its own process and replaces that process with gh. It guarantees three things:

  • The Nix store holds the path of the file and never its content, since the option refuses a path literal and a store path.
  • The shell never has the variable, so no other program started from it inherits the token.
  • No process argument carries the token, so it does not appear in the process list.

The token is in the environment of the running gh and of the programs gh starts, such as git, the editor and an extension. The completions and the man pages are the ones gh ships. The git credential helper runs the wrapper as well, so git over HTTPS works on such a host without a login. A GH_TOKEN that is already set is kept. When the file is missing or unreadable the wrapper says so on stderr and runs gh without it, so gh auth status reports the login the host really has.

When othrys.apps.ai.claude-code is enabled as well, the module adds the read-only gh commands to the Claude Code allow-list, and an agent reads GitHub without a prompt. The entries are gh issue view, gh issue list, gh pr view, gh pr list, gh pr diff, gh pr checks, gh run view, gh run list, gh repo view, gh release view, gh release list and gh search, each in the Bash(gh pr view:*) form. A command that creates, edits, merges, closes or comments stays prompted, and so do gh auth and gh api, since gh api sends any request. claudeCode.allowReadOnly = false leaves the entries out. The lists are a convenience and not a boundary, as AI Assistants explains.

When othrys.apps.ai.codex is enabled, the same twelve commands become allow rules in Codex’s othrys-gh.rules. Codex runs an allowed command outside its sandbox, which has no network, so this is what lets Codex read GitHub without asking. codex.allowReadOnly = false leaves the rules out.

tmux

othrys.apps.tmux turns on Home Manager’s programs.tmux for the primary user, so it takes effect only on a host that imports the home export. It sets the terminal to tmux-256color, which carries italics, the escape time to 10 ms in place of tmux’s half second, which stalls modal editors after Escape, and the history limit to 50000 lines. All three are defaults, so a host sets its own under programs.tmux without lib.mkForce.

othrys.apps.tmux.enable = true;

The status line, the current window, the active pane border and the message line are coloured from othrys.theme.palette. On a host with no palette the backgrounds and the text keep the terminal’s default colours and the current window and the active border are blue. The Stylix adapter turns its own tmux target off while this module is on, so the two themes never mix, and a host that wants the Stylix theme sets stylix.targets.tmux.enable = lib.mkForce true.

On nix-darwin the module also installs the tmux-256color terminfo entry, since the database macOS ships has none and Apple’s own programs inside tmux would not know the terminal.

The module sets no key bindings, no prefix and no mouse mode, so tmux’s defaults apply. A host sets those under programs.tmux in its own Home Manager configuration.

Options

  options.othrys.apps.tmux = {
    enable = lib.mkEnableOption "tmux terminal multiplexer";
  };

senpai

othrys.apps.senpai configures senpai, a terminal IRC client built for a bouncer, through Home Manager’s programs.senpai for the primary user. It runs on NixOS and nix-darwin, and on darwin Home Manager writes the configuration to ~/Library/Application Support/senpai. soju is the bouncer module, and IRC with soju and senpai sets up both.

othrys.apps.senpai = {
  enable = true;
  address = "irc.example.com";
  nickname = "alice";
  passwordFile = "/run/secrets/senpai-password";
};

address defaults to soju’s loopback listener, irc+insecure://127.0.0.1:<port>, when othrys.services.soju is on the same host, and has no default otherwise. A bare host name connects with TLS on port 6697. nickname never has a default. The module refuses either one unset and names the option in its message.

passwordFile becomes password-cmd, a cat of the file. senpai runs the command without a shell and reads its first line each time it connects, so the password stays out of the Nix store and the configuration file, and the file has to be readable by the primary user. settings.password and settings.password-cmd are refused.

senpai uses nickname as the SASL user name unless settings.username is set. On a soju bouncer that user name is the soju account, so a nickname that differs from the account name needs settings.username. settings takes any other senpai.scfg directive and is merged over what the module writes.

~/.cache/senpai is persisted, since it holds the last open buffer and the read marker, lastbuffer-*.txt and laststamp-*.txt. The configuration is a Home Manager link and is not persisted.

Options

  options.othrys.apps.senpai = {
    enable = lib.mkEnableOption "the senpai IRC client";

    address = lib.mkOption {
      type = lib.types.nullOr lib.types.str;
      default =
        if soju.enable
        then "irc+insecure://127.0.0.1:${toString soju.port}"
        else null;
      defaultText = lib.literalExpression ''"irc+insecure://127.0.0.1:''${port}" when othrys.services.soju.enable is on, null otherwise'';
      example = "irc.example.com:6697";
      description = ''
        Server senpai connects to, as `host[:port]` or an `ircs://`,
        `irc://` or `irc+insecure://` URL. A bare host uses TLS on port
        6697. With `othrys.services.soju` on the same host, the default is
        soju's plaintext listener on loopback.
      '';
    };

    nickname = lib.mkOption {
      type = lib.types.nullOr lib.types.str;
      default = null;
      example = "alice";
      description = ''
        Nickname senpai registers with. senpai also uses it as the SASL
        user name unless `settings.username` is set, which is the soju
        account name when the server is a soju bouncer.
      '';
    };

    passwordFile = lib.mkOption {
      type = lib.types.nullOr othrysTypes.secretPath;
      default = null;
      example = "/run/secrets/senpai-password";
      description = ''
        Runtime path to a file holding the SASL password, readable by the
        primary user. senpai reads its first line through `password-cmd`
        each time it connects, so the password stays out of the Nix store
        and the configuration file.
      '';
    };

    settings = lib.mkOption {
      type = lib.types.attrsOf lib.types.anything;
      default = {};
      example = {
        username = "alice";
        channel = ["#nixos"];
        highlight = ["alice"];
      };
      description = ''
        Further `senpai.scfg` directives, merged over the ones this module
        writes. See {manpage}`senpai(5)`. `password` and `password-cmd` are
        refused here, since `passwordFile` covers both without writing the
        secret into the store.
      '';
    };
  };

Kitty

Remote control is accepted on a unix socket only. Each kitty process listens on $XDG_RUNTIME_DIR/kitty-<pid>.sock, a directory other users cannot read, and kitty @ inside the terminal finds it through KITTY_LISTEN_ON. Control sequences written to the terminal itself are ignored, so the output of a program, or of a remote host over SSH, cannot drive the windows. macOS sets no XDG_RUNTIME_DIR, so on darwin the socket is in $TMPDIR, which is private to the user there. Ghostty takes ghostty-bin on darwin, and yazi installs no wl-clipboard there.

extraSettings takes kitty.conf keys and is merged over the defaults the module writes, so a key set there wins.

othrys.apps.kitty = {
  enable = true;
  extraSettings = {
    scrollback_lines = "50000";
    tab_bar_style = "fade";
  };
};

Ghostty

Ghostty measures its scrollback in bytes and not in lines. scrollbackLimit is that byte count for each terminal surface, and it defaults to Ghostty’s own 10 MB. It replaces scrollbackLines, whose default of 10000 was written as 10000 bytes, about a hundred lines of plain text. Setting the old option now fails with a message naming the new one.

othrys.apps.ghostty = {
  enable = true;
  scrollbackLimit = 50000000;
};

extraSettings takes Ghostty config keys and is merged over what the module writes. A value is a string, a number, a boolean, or a list of those for a key that repeats, such as keybind. A nested attribute set is refused, since the config file is flat.

Vesktop

settings is written to Vesktop’s settings.json over the module defaults and accepts any JSON value.

Remmina

othrys.apps.remmina installs Remmina for the primary user through Home Manager’s services.remmina. Remmina connects to VNC, RDP, SPICE and SSH servers. The darwin export does not include it yet, since it has not been run there. macOS ships Screen Sharing.app, which covers VNC alone.

othrys.apps.remmina.enable = true;

Home Manager would start remmina --icon as a user service at every login, which keeps a tray icon and a process running. The module sets systemdService.enable to false with mkDefault, so Remmina runs only when it is opened. A host that wants the login service back sets it for the user.

home-manager.users.alice.services.remmina.systemdService.enable = true;

Connection profiles live in ~/.local/share/remmina and the preferences in ~/.config/remmina/remmina.pref. Where a saved password goes depends on the host. With a Secret Service running, which othrys.desktop.keyring provides on a graphical host, Remmina stores each password in the keyring and the profile keeps a placeholder. Without one it encrypts the password into the profile file with 3DES, keyed by the secret in remmina.pref. Losing that file makes every saved password unreadable, and anyone who can read both directories can decrypt them. Under impermanence both directories are persisted at mode 0700 for that reason.

Remmina’s VNC client can connect to macOS Screen Sharing. It answers Apple’s authentication, security type 30, with the macOS account’s username and password, so the Mac needs no separate VNC password. Classic VNC is not encrypted. Connect over a private network, or turn on the SSH tunnel in the connection’s SSH settings.

Options

  options.othrys.apps.remmina = {
    enable = lib.mkEnableOption "Remmina remote desktop client";
  };

Floorp

The browser force-installs a curated extension set, Sidebery, Bitwarden and uBlock Origin, through othrys.apps.floorp.extensions. Each entry names a versioned download URL and its hash, so the file is fetched at build time and installed from the Nix store rather than pulled from the add-on site at first start. Replace the set to drop one. A definition replaces the whole default, so a host that wants one more extension merges it over options.othrys.apps.floorp.extensions.default. The option’s example does that for Violentmonkey, which is not in the default set because a userscript manager runs whatever scripts it is given with page access on the sites they match. The built-in password manager is off beside Bitwarden (builtinPasswordManager), tracking protection exempts nothing until a host lists sites in trackingProtectionExemptions, and the theme follows othrys.theme.polarity. The browser chrome is styled from othrys.theme.palette, and on a host with no palette no stylesheet is written.

search.extraEngines adds search engines over the curated set. Each engine is an attribute set of JSON values in the shape Home Manager documents for programs.firefox.profiles.<name>.search.engines.

Chromium

othrys.apps.chromium installs Ungoogled Chromium for the primary user through Home Manager, and persists ~/.config/chromium at mode 0700. Nothing is installed system-wide, so a host whose user Home Manager does not manage gets no browser.

othrys.apps.chromium.enable = true;

commandLineArgs passes launch arguments through Home Manager’s wrapper, and package replaces the browser with another Chromium build.

Ungoogled Chromium has no Web Store and does not update extensions, so extensions installs each one from a CRX file fetched at build time. An entry is keyed by the extension’s 32-letter ID and names the file’s url, its hash and the version in its manifest. Home Manager writes an external extension manifest pointing at the file in the store, and Chromium installs it at the next start. The list is empty by default.

othrys.apps.chromium.extensions.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = {
  url = "https://example.com/extensions/example-1.0.crx";
  hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
  version = "1.0";
};

The URL has to keep serving that exact file, or a build without a cached copy fails. A release asset or a versioned path does. A Web Store download link does not, since Google replaces the file with each new upload. An extension’s settings and logins live in the persisted profile and are not managed here.

With othrys.apps.floorp off, enabling Chromium also makes chromium the browser the compositors’ browser shortcut runs, as Desktop describes.

Options

  options.othrys.apps.chromium = {
    enable = lib.mkEnableOption "Ungoogled Chromium browser";

    package = lib.mkPackageOption pkgs "ungoogled-chromium" {
      extraDescription = "A replacement must support Home Manager's Chromium wrapper and use Chromium's profile directory layout.";
    };

    commandLineArgs = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = [];
      example = ["--ozone-platform=wayland"];
      description = "Launch arguments passed through Home Manager's Chromium package wrapper. Empty leaves browser and GPU detection unchanged.";
    };

    extensions = lib.mkOption {
      type = lib.types.attrsOf extensionType;
      default = {};
      example = lib.literalExpression ''
        {
          aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = {
            url = "https://example.com/extensions/example-1.0.crx";
            hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
            version = "1.0";
          };
        }
      '';
      description = ''
        Extensions installed from local signed CRX files, keyed by their
        32-character IDs using the letters a through p. Each is fetched at
        build time from `url` and checked against `hash`, so the URL must keep
        serving that exact file. A release asset or a versioned path does, and
        a content delivery link that the publisher replaces on each upload
        does not.
      '';
    };
  };

VSCodium

othrys.apps.vscode.mutableExtensionsDir decides whether the editor can install extensions itself. With true, the default and Home Manager’s own, ~/.vscode-oss/extensions is a real directory. The extensions the configuration names are linked into it, and one installed by hand from Open VSX sits beside them, persists with .vscode-oss and updates itself. With false the directory is a link into the Nix store, so the editor runs exactly the set the configuration names and an install from the editor fails. A host that switches to false removes the existing directory first, since Home Manager does not replace a directory it did not create.

Language Toolchains (modules/apps/languages/)

othrys.apps.languages.<name>.enable is the one signal that a host develops in a language. Each entry holds a server, a formatter and a list of extraTools, and enabling it installs all three on the primary user’s PATH. Nixvim and VSCodium read the same entry, so neither editor carries a toolchain of its own.

LanguageServerFormatterExtra tools
bashbash-language-servershfmtshellcheck
gogoplsgofmt from go
javanonegoogle-java-formatjdk21, maven, gradle
jsonvscode-langservers-extractedprettier
lualua-language-serverstylua
nixnilalejandra
pythonbasedpyrightruff
rustrust-analyzerrustfmt
typescripttypescript-language-serverprettiertypescript
yamlyaml-language-serverprettier

JSON and YAML are entries of their own. A host that edits YAML without writing TypeScript enables yaml alone, and enabling typescript configures neither of them.

Overriding a tool

Both editors name the registry package by its store path, so an override reaches them and the PATH together.

othrys.apps.languages.nix = {
  enable = true;
  formatter = pkgs.nixfmt;
};

Nixvim formats through conform.nvim, which keeps a definition with the right arguments for each formatter it knows. The module selects that definition by the executable name of the package and sets its command to the store path. The override above therefore runs under conform’s nixfmt definition and not under the alejandra one with a different binary behind it. A tool conform has no definition for is run with no arguments and the buffer on stdin. Two languages whose formatters share an executable name share one definition, so typescript, json and yaml must hold the same prettier package or evaluation reports the conflicting commands.

VSCodium takes a binary only where an extension has a setting for one. The table shows what each extension reads from the registry.

LanguageFrom the registryBundled by the extension or the editor
bashshfmt, shellcheckbash-language-server
gogopls, the formatter
javajdtls
jsonprettierthe JSON language service
lualua-language-serverformatting, done by the server
nixnil, the formatter
pythonruffbasedpyright
rustrust-analyzer
typescriptprettierthe TypeScript language service
yamlprettieryaml-language-server

The bash extensions read shellcheck out of extraTools, found by its executable name. A host that removes it from the list gets no shellcheck path in either extension. The prettier and ruff settings apply only while the formatter is still that tool, since each extension can drive nothing else. A host that replaces one of them also chooses its own editor.defaultFormatter through othrys.apps.vscode.userSettings.

A language with no server

server accepts null, and java ships that way. An editor then configures no external server for the language. Nixvim enables no LSP client for it, while VSCodium omits the server path and the extension runs whatever it bundles. For Nix the extension has no bundled server, so the language server is switched off and formatting continues to work.

See also: Gaming, AI Assistants

For the anatomy of a fully-featured module, see the login manager example in Module System.

Desktop

Platforms: NixOS only, apart from othrys.desktop.graphical, which defaults to true on nix-darwin, and othrys.theme. See Darwin.

Desktop environment modules under othrys.desktop.*. Handles compositors, status bar, and session management.

Colours and fonts come from othrys.theme, see Theming.

Available Modules

ModuleOptionDescription
Ashellothrys.desktop.ashellGPU-accelerated status bar, coloured from othrys.theme
Hyprlandothrys.desktop.compositors.hyprlandWayland compositor (dynamic tiling)
Niriothrys.desktop.compositors.niriWayland compositor (scrollable tiling)
Idleothrys.desktop.idleStaged idle management (dim, lock, screen off, suspend)
Keyringothrys.desktop.keyringSecret Service provider (gnome-keyring or pass), on by default on a graphical host
Loginothrys.desktop.logingreetd login manager (tuigreet or cosmic-greeter)
Night lightothrys.desktop.nightLightColor temperature shifting (gammastep)
UWSMothrys.desktop.uwsmSystemd session management for Wayland
Vicinaeothrys.desktop.vicinaeLauncher in the style of Raycast, run as a user server and opened from the launcher chord
Wallpaperothrys.desktop.wallpaperDraws othrys.theme.wallpaper with wpaperd, on by default where a compositor runs and a wallpaper is declared

Ashell

Status bar for Hyprland or Niri. Either compositor satisfies its assertion, and the lock and logout commands follow the session that is running, as described under Sessions. Installed from the ashell flake this library locks, or from othrys.desktop.ashell.package when a host sets it, and configured via a generated ~/.config/ashell/config.toml with the colours of othrys.theme.palette and the font of othrys.theme.fonts.sansSerif written in at build time. A null palette or font leaves the matching keys out, and ashell uses its own defaults. Hot-reloads on config changes.

The bar runs as a user unit tied to the graphical session, and it starts without DISPLAY. It draws through layer-shell and needs no X server, and with DISPLAY set it would hold a connection to the session’s Xwayland server, which aborts the bar whenever that server restarts.

renderer sets the graphics API the bar draws with, through WGPU_BACKEND on the unit. It is "vulkan", ashell’s own default, unless othrys.hardware.nvidia.enable is set, and then "gl". On the NVIDIA driver Vulkan presents frames late, so menus, toasts and resizing modules stutter, while OpenGL draws them smoothly. animations = true turns those animations on, and ashell leaves them off by default.

The lock button runs othrys.desktop.lockCommand, whose locker every compositor host already has. The launcher chord and the launcher button run othrys.desktop.launcherCommand, which is wofi unless another module or the host names a launcher, as Vicinae does. The pickers beside it come from four more signals in othrys.desktop, set the same way.

SignalChordDefault
emojiCommandMod + Erofimoji through wofi, typing with wtype
dmenuCommandMod + Shift + V and the clipboard buttonwofi --dmenu
runCommandMod + Shift + Dwofi --show run
fileSearchCommandMod + Shift + Fnull

A null signal leaves its chord unbound. The clipboard chord and button pipe the cliphist history through dmenuCommand, so the history stays cliphist’s whichever menu shows it. wofi, rofimoji and wtype are installed only while one of these commands or the launcher names them, and hyprpicker is installed on Hyprland. The audio buttons open pavucontrol, which othrys.hardware.audio installs on a graphical host.

The bar uses two unit settings. region is the locale ashell takes its unit system from, and the weather follows it. The default en_US is imperial, so the weather is in °F and the wind in mph. systemTemperatureUnit is the unit of the sensor reading in the system information module, and its default is "Celsius", since hardware temperatures are quoted that way. ashell warns at 60 °C and alerts at 80 °C. A metric host sets region = "de_DE" or another locale, and region = null follows LC_MEASUREMENT and the login locale.

The clock shows no weather until weatherLocation is set. With the default of null the key is left out of the config and the bar makes no forecast request. The value is a city name or a pair of coordinates, and it is identity-shaped, so the host sets it. The module renders either form as the weather_location table ashell reads. A string holding a brace or an equals sign is refused, which catches the raw TOML fragment the option used to take.

othrys.desktop.ashell.weatherLocation = {
  latitude = 40.7128;
  longitude = -74.006;
};

othrys.desktop.ashell.weatherLocation = "New York";

The clipboard button reads a history that cliphist keeps, fed by a Home Manager user service on Hyprland and on Niri alike. The history is a plain file under ~/.cache/cliphist and holds everything copied, apart from entries a password manager marks as sensitive. It keeps clipboard.maxItems entries, 100 by default, and the default lock command wipes it each time the session locks. A host that replaces othrys.desktop.lockCommand takes over that wipe. A second user unit, cliphist-wipe, wipes the history when the graphical session ends, at logout, reboot or shutdown, whatever the lock command is. A session that dies without stopping its units, as on a power cut, leaves the file in place until the next lock or logout. clipboard.enable = false removes the service, the button and the wipe. A Hyprland host without ashell no longer records a clipboard history at all.

The settings group at the right of the bar follows the host. A desktop shows the idle inhibitor, peripheral batteries, audio and the microphone. A host with othrys.hardware.laptop.enable also shows its own battery, the screen brightness and the network, shows Bluetooth when hardware.bluetooth.enable holds, and shows the power profile when services.power-profiles-daemon.enable holds, which leaves it out on a host that uses TLP. On a laptop the settings menu keeps its airplane mode button, and the clock drops its seconds so the bar does not redraw once a second on battery. indicators, airplaneButton and clockFormat override each of these.

The battery indicator reads UPower, which the laptop module enables.

Options

  options.othrys.desktop.ashell = {
    enable = lib.mkEnableOption "Ashell status bar";

    package = lib.mkOption {
      type = lib.types.package;
      # The ashell flake this library locks, handed in by flake/modules.nix.
      default = othrysInputs.ashell.packages.${pkgs.stdenv.hostPlatform.system}.default;
      defaultText = lib.literalMD "the default package of the ashell flake this library locks";
      example = lib.literalExpression "pkgs.ashell";
      description = "The ashell package the bar's unit starts and the user's profile installs.";
    };

    weatherLocation = lib.mkOption {
      type = lib.types.nullOr (lib.types.either
        # A city name holds neither a brace nor an equals sign, and the raw
        # TOML table this option once took holds both, so that form is
        # refused here instead of being looked up as a city.
        (lib.types.strMatching "[^{}=]+")
        (lib.types.submodule {
          options = {
            latitude = lib.mkOption {
              type = lib.types.numbers.between (-90) 90;
              example = 40.7128;
              description = "Latitude in decimal degrees, north positive.";
            };
            longitude = lib.mkOption {
              type = lib.types.numbers.between (-180) 180;
              example = -74.006;
              description = "Longitude in decimal degrees, east positive.";
            };
          };
        }));
      default = null;
      example = lib.literalExpression ''
        {
          latitude = 40.7128;
          longitude = -74.006;
        }
      '';
      description = ''
        Where the clock's weather is for. A string is a city name, which
        ashell looks up, and an attribute set of `latitude` and `longitude`
        is a point. The module renders either as the `weather_location` value
        ashell reads. The bar fetches the forecast over the network. With
        `null` the key is left out, the bar shows no weather and makes no
        request. The location is identity-shaped, so the consuming host sets
        it.
      '';
    };

    region = lib.mkOption {
      type = lib.types.nullOr (lib.types.strMatching "[a-z]{2,3}_[A-Z]{2}");
      default = "en_US";
      example = "de_DE";
      description = ''
        The locale ashell takes its unit system from, which decides the
        weather's temperature and wind speed. `en_US` is imperial, so °F and
        mph, and nearly every other locale is metric. With `null` the key is
        left out and ashell follows `LC_MEASUREMENT` and then the login
        locale.
      '';
    };

    systemTemperatureUnit = lib.mkOption {
      type = lib.types.nullOr (lib.types.enum ["Celsius" "Fahrenheit"]);
      default = "Celsius";
      description = ''
        The unit of the sensor temperature in the system information module,
        which is set apart from `region`. Hardware temperatures are quoted
        in °C, so that is the default while the weather follows the region.
        With `null` the reading follows the region as well.
      '';
    };

    clipboard = {
      enable = lib.mkOption {
        type = lib.types.bool;
        default = true;
        description = ''
          Keep a clipboard history with cliphist, and show the bar button and
          bind the `Mod+Shift+V` chord that pick from it through
          `othrys.desktop.dmenuCommand`. The history is a plain file under `~/.cache/cliphist`
          holding everything copied, apart from entries a password manager
          marks as sensitive. It is capped at `maxItems`, wiped each time
          the session locks through `othrys.desktop.lockCommand` and wiped
          again when the graphical session ends.
        '';
      };
      maxItems = lib.mkOption {
        type = lib.types.ints.positive;
        default = 100;
        description = "Entries the clipboard history keeps before the oldest is dropped.";
      };
    };

    indicators = lib.mkOption {
      type = lib.types.listOf (lib.types.enum [
        "IdleInhibitor"
        "PowerProfile"
        "Audio"
        "Microphone"
        "Network"
        "Vpn"
        "Bluetooth"
        "Battery"
        "PeripheralBattery"
        "Brightness"
      ]);
      default = defaultIndicators;
      defaultText = lib.literalExpression ''
        ["IdleInhibitor" "PeripheralBattery" "Audio" "Microphone"], and with
        othrys.hardware.laptop.enable also "Brightness", "Network" and
        "Battery", plus "Bluetooth" and "PowerProfile" when the host runs
        bluetooth and power-profiles-daemon
      '';
      example = ["Audio" "Network" "Battery"];
      description = ''
        The indicators in the settings group at the right of the bar, in the
        order given. The default follows the host. A desktop gets the idle
        inhibitor, audio, the microphone and peripheral batteries. A host with
        `othrys.hardware.laptop.enable` also gets its own battery, the screen
        brightness and the network, and Bluetooth and the power profile when it
        runs those services.

        `Battery` reads UPower, which the laptop module enables. `Network` reads
        NetworkManager or iwd. `PowerProfile` reads power-profiles-daemon, so
        it is left out on a host that uses TLP.
      '';
    };

    airplaneButton = lib.mkOption {
      type = lib.types.bool;
      default = laptop;
      defaultText = lib.literalExpression "config.othrys.hardware.laptop.enable";
      description = "Show the airplane mode button in the settings menu.";
    };

    clockFormat = lib.mkOption {
      type = lib.types.str;
      default =
        if laptop
        then "%a %b %d  %I:%M %p"
        else "%a %b %d  %I:%M:%S %p";
      defaultText = lib.literalExpression ''
        "%a %b %d  %I:%M:%S %p", and without the seconds when
        othrys.hardware.laptop.enable is set
      '';
      description = ''
        `strftime` format of the clock. A format with seconds makes the bar
        redraw once a second, which a laptop on battery pays for, so the
        default leaves them out there.
      '';
    };

    bar = {
      surface = lib.mkOption {
        type = lib.types.enum ["transparent" "solid"];
        default = "transparent";
        example = "solid";
        description = ''
          Where ashell paints the bar background. `transparent` leaves the bar
          see-through and paints each module group instead, giving the
          "islands" look; `solid` paints the whole bar as one continuous
          surface. Defaults to ashell's own default rather than a preference.
        '';
      };

      opacity = lib.mkOption {
        type = lib.types.float;
        default = 1.0;
        example = 0.92;
        description = ''
          Opacity of the bar surface. Below 1.0 ashell also asks the
          compositor to blur what is behind the bar, since its `blur` setting
          defaults to `auto`. The request needs `ext-background-effect-v1`,
          and a compositor without it draws no blur.
        '';
      };
    };

    animations = lib.mkOption {
      type = lib.types.bool;
      default = false;
      example = true;
      description = ''
        Animate the bar. ashell then slides menus and toasts in and out and
        resizes modules and workspace buttons gradually. Each animation lasts
        100 ms and draws a frame per refresh of the output, so it shows
        stutter on a renderer that misses frames, as Vulkan does on NVIDIA
        (see `renderer`). The default is ashell's own, which is off.
      '';
    };

    renderer = lib.mkOption {
      type = lib.types.enum ["vulkan" "gl"];
      default =
        if config.othrys.hardware.nvidia.enable
        then "gl"
        else "vulkan";
      defaultText = lib.literalMD ''
        `"gl"` when `othrys.hardware.nvidia.enable` is set, and `"vulkan"`
        otherwise
      '';
      description = ''
        The graphics API ashell draws with, written to `WGPU_BACKEND` on the
        unit. Vulkan is ashell's default. On the NVIDIA driver it presents
        frames late, and animations stutter while OpenGL draws them smoothly,
        so an NVIDIA host gets `"gl"`.
      '';
    };
  };

Keybindings (via Hyprland)

BindingAction
Super + DLauncher (othrys.desktop.launcherCommand, wofi drun by default)
Super + Shift + DCommand runner (runCommand, wofi run by default)
Super + EEmoji picker (emojiCommand, rofimoji by default)
Super + Shift + VClipboard history (cliphist through dmenuCommand)
Super + Shift + FFile search (fileSearchCommand, unbound by default)
Super + Shift + CColor picker to clipboard (hyprpicker)

Vicinae

A launcher in the style of Raycast. The module installs it for the primary user through Home Manager’s programs.vicinae and runs vicinae server as a user unit of the graphical session. The server reloads its settings and theme files when they change.

othrys.desktop.compositors.niri.enable = true;
othrys.desktop.ashell.enable = true;
othrys.desktop.vicinae.enable = true;

A host without a graphical session is refused, and the message names othrys.desktop.graphical. The unit starts only where WAYLAND_DISPLAY is set and restarts only on failure, so “Quit Vicinae” in the tray menu stops the server until the next session.

launcher sets othrys.desktop.launcherCommand to vicinae toggle. The chord that runs it is ashell’s Super + D on Hyprland and on Niri, beside the bar’s launcher button, so a host without the bar binds vicinae toggle through the compositor’s extraBinds. Vicinae’s own global_shortcuts setting needs a hotkey protocol of Vicinae’s on Wayland, and the module does not rely on it.

The module also sets the picker signals at mkDefault, whatever launcher holds. Super + E opens Vicinae’s emoji search and Super + Shift + F its file search, and pressing either chord again closes the window. The clipboard chord and button show the cliphist history in vicinae dmenu. Vicinae has no prompt that runs a typed command, so runCommand is null and Super + Shift + D is unbound. A host that sets none of the signals itself installs none of wofi, rofimoji and wtype. The emoji search copies the emoji and pastes it only with inputServer.enable.

The calculator fetches currency exchange rates from api.vicinae.com once when the server starts and then every hour. The module stops the hourly requests, and exchangeRates.hourlyRefresh brings them back. No setting stops the request at start. Vicinae’s update check never runs on Linux, and the extension stores reach api.vicinae.com only when they are opened.

keybinding picks Vicinae’s navigation preset, "default", "vim" or "emacs", and is written to the keybinding setting.

settings is merged over the curated keys one key at a time. Telemetry is off, pop_to_root_on_close is true and input_server.enabled follows inputServer.enable. favicon_service is "none", so links show a placeholder icon and no third party learns their host names. The declared settings go to ~/.config/vicinae/home-manager.json, which the server reads through VICINAE_OVERRIDES. settings.json stays writable for the settings window, and a key declared here wins over the window’s value for that key.

With a palette the module writes the theme othrys and selects it for light and dark alike, with the variant of othrys.theme.polarity. The theme colours list rows as well, hovered rows in base01 and the selected row in base02. With othrys.theme.opacity set the launcher window takes the opacity of popups.

On a host with Hyprland, launcher_window.layer_shell.keyboard_interactivity is "on_demand". Vicinae’s "exclusive" default leaves popups inside the window without mouse input on Hyprland. A host with both compositors writes one settings file, so its Niri session gets "on_demand" as well. Stylix’s own Vicinae target is off while the module is on. Without a palette or a sans-serif font Vicinae keeps its own.

While ashell keeps its cliphist history, Vicinae’s own clipboard monitoring is off. Vicinae’s history would otherwise hold every entry past the bar’s wipe at lock and logout, which does not reach it. A host without the bar’s history keeps Vicinae’s, and it is wiped by nothing.

~/.config/vicinae is persisted, and so are ~/.local/share/vicinae and ~/.local/state/vicinae at mode 0700. The first of those holds the clipboard history, snippets and extension data, and the second the onboarding state, without which the onboarding screen returns after every boot. The file index in ~/.cache/vicinae is rebuilt by Vicinae and is not persisted. inputServer.enable installs the input helper as a security wrapper with cap_dac_override, which any local account can run. Without it Vicinae copies where it would paste, and snippets do not expand.

Options

  options.othrys.desktop.vicinae = {
    enable = lib.mkEnableOption "the Vicinae launcher";

    package = lib.mkPackageOption pkgs "vicinae" {};

    settings = lib.mkOption {
      # The type of programs.vicinae.settings in Home Manager, which renders
      # it as JSON.
      inherit (pkgs.formats.json {}) type;
      default = {};
      example = lib.literalExpression ''
        {
          favicon_service = "twenty";
          search_files_in_root = true;
          launcher_window.layer_shell.keyboard_interactivity = "on_demand";
        }
      '';
      description = ''
        Vicinae settings, merged over the curated defaults. Those are
        written at mkDefault, so a key set here replaces that key alone and
        its siblings stay. The shape is that of
        `~/.config/vicinae/settings.json`, and `vicinae config default`
        prints every key with its upstream value.

        The curated defaults turn telemetry off, set `favicon_service` to
        `"none"`, set `pop_to_root_on_close` to true and set
        `input_server.enabled` from `inputServer.enable`. With a palette in
        `othrys.theme` both theme names are `"othrys"`, and with
        `othrys.theme.fonts.sansSerif` set the interface font is that font.
        With `othrys.theme.opacity` set, the launcher window takes the
        opacity of popups. On a host with Hyprland the layer-shell keyboard
        mode is `"on_demand"`, since the exclusive default leaves popups
        inside the window without mouse input there.
        While ashell keeps its cliphist history,
        `providers.clipboard.preferences.monitoring` is false, so Vicinae
        records no second history that the wipe at lock would miss. On a
        host without that history Vicinae records the clipboard itself.

        The declared settings are merged over the file Vicinae writes from
        its settings window, key by key, each time the server loads them. A
        change made in the window to a key declared here has no effect.
      '';
    };

    extensions = lib.mkOption {
      type = lib.types.listOf lib.types.package;
      default = [];
      example = lib.literalExpression ''
        [
          (config.lib.vicinae.mkRayCastExtension {
            name = "gif-search";
            rev = "4d417c2dfd86a5b2bea202d4a7b48d8eb3dbaeb1";
            sha256 = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
          })
        ]
      '';
      description = ''
        Extensions to install, passed to Home Manager's
        `programs.vicinae.extensions`. Home Manager's `config.lib.vicinae`
        builds them, and that attribute exists only inside the user's Home
        Manager configuration.
      '';
    };

    keybinding = lib.mkOption {
      type = lib.types.enum ["default" "vim" "emacs"];
      default = "default";
      example = "vim";
      description = ''
        The keybinding preset Vicinae navigates with, one of the three it
        ships. It is written to the `keybinding` setting at mkDefault, so
        `settings.keybinding` still wins.
      '';
    };

    exchangeRates.hourlyRefresh = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = ''
        Let the calculator fetch currency exchange rates from
        `api.vicinae.com` every hour. With false the server still fetches
        them once when it starts, which no setting of Vicinae prevents, and
        currency conversions use those rates for the rest of the session.
      '';
    };

    launcher = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = ''
        Make `vicinae toggle` the desktop launcher by setting
        `othrys.desktop.launcherCommand`. The chord that runs it, `Mod+D` on
        Niri and `$mainMod + D` on Hyprland, and the launcher button of the
        bar both belong to `othrys.desktop.ashell`, so a host without the bar
        binds the command itself. With false the launcher stays wofi. The
        emoji, clipboard menu, file search and run signals beside it follow
        Vicinae either way, and a host sets any of them to keep its own.
      '';
    };

    inputServer.enable = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = ''
        Run Vicinae's input helper, which pastes into the focused window and
        expands snippets. The helper reads every keyboard of the host and
        injects keys through uinput, so it is installed as a security
        wrapper with `cap_dac_override`, which any local account can run,
        and the `uinput` kernel module is loaded. With false Vicinae copies
        to the clipboard where it would paste, and snippets do not expand.
      '';
    };
  };

Sessions

A host can enable both compositors and let the greeter choose between them, so an enabled module does not say which compositor is running. The commands that talk to a compositor are therefore chosen at run time on such a host. The screen-off and screen-on stages of the idle module, ashell’s logout button and the default lock command each become a small script that reads XDG_CURRENT_DESKTOP and calls niri msg and swaylock in a Niri session or hyprctl and hyprlock in a Hyprland one. A host with one compositor gets the plain command with no script in between. modules/desktop/session.nix holds the test, and a module that adds a compositor command builds it there.

Both lockers and both PAM services are installed on a host with both compositors, since each session runs its own.

Enabling either compositor installs Nautilus as the file manager, in the primary user’s packages.

Compositors

See Compositors (Hyprland) for the full Hyprland reference.

Hyprland no longer exports TERM to the session, and each terminal sets its own.

othrys.desktop.compositors.hyprland = {
  enable = true;
  monitors = [
    {output = "eDP-1";}
  ];
};

Browser selection

othrys.desktop.defaultBrowser is the command the browser shortcut runs, Super + F in Hyprland and Mod+F in Niri. It follows the browser module that is enabled, floorp before chromium, and names firefox when neither is. No othrys module installs Firefox, so a host with another browser sets the option. It selects a command only and sets no default application for links.

Each compositor’s browser option defaults to the shared one, and setting it changes that compositor alone.

othrys.desktop.defaultBrowser = "chromium";
othrys.desktop.compositors.niri.browser = "floorp";

Options

  options.othrys.desktop.defaultBrowser = lib.mkOption {
    type = lib.types.nonEmptyStr;
    default =
      if config.othrys.apps.floorp.enable
      then "floorp"
      else if config.othrys.apps.chromium.enable
      then "chromium"
      else "firefox";
    defaultText = lib.literalMD ''
      `"floorp"` when `othrys.apps.floorp` is enabled, `"chromium"` when
      `othrys.apps.chromium` is, and `"firefox"` otherwise
    '';
    example = "chromium";
    description = ''
      Browser command the browser shortcut of Hyprland and Niri runs, unless a
      compositor's own `browser` option is set. The default follows the
      browser module that is enabled. `firefox` is installed by no othrys
      module, so a host with another browser names it here. This selects a
      command only and sets no default application for links.
    '';
  };

Niri

Scrollable-tiling compositor via niri-flake (typed, build-time-validated config, self-contained, with no extra upstream import for consumers). The option surface mirrors hyprland where concepts map (chords, terminal/browser, outputs, touchpad, screenshots) and is niri-native where they do not (columns scroll, and Mod+S opens the overview). Niri manages its own systemd session, and the login module starts niri-session by default on a host where niri is the only compositor. The window border takes the accent of othrys.theme.palette in place of niri’s focus ring. On a host with the Stylix adapter, niri-flake’s Stylix target themes the cursor as well.

outputs takes JSON values only, which is everything an output is made of. extraBinds and settings stay free-form, since an action written with niri-flake’s config.lib.niri.actions helpers is an attribute set carrying a function, and niri-flake validates both once they reach programs.niri.settings.

othrys.desktop.compositors.niri = {
  enable = true;
  outputs."DP-1".mode = {
    width = 1920;
    height = 1080;
    refresh = 144.0;
  };
};

Options

  options.othrys.desktop.compositors.niri = {
    enable = lib.mkEnableOption "Niri scrollable-tiling Wayland compositor";

    outputs = lib.mkOption {
      # An output is plain data all the way down, a mode, a position, a scale
      # and a transform, so each one is held to JSON values. niri-flake then
      # checks the keys against its own schema.
      type = lib.types.attrsOf (lib.types.attrsOf (pkgs.formats.json {}).type);
      default = {};
      example = lib.literalExpression ''
        {
          "DP-1" = {
            mode = {
              width = 1920;
              height = 1080;
              refresh = 144.0;
            };
            position = {
              x = 0;
              y = 0;
            };
          };
        }
      '';
      description = "Monitor configuration (programs.niri.settings.outputs). Empty lets niri auto-configure.";
    };

    terminal = lib.mkOption {
      type = lib.types.str;
      default = "kitty";
      description = "Terminal emulator the terminal bind spawns.";
    };

    browser = lib.mkOption {
      type = lib.types.str;
      default = config.othrys.desktop.defaultBrowser;
      defaultText = lib.literalExpression "config.othrys.desktop.defaultBrowser";
      description = ''
        Browser the browser bind spawns. Defaults to the shared
        `othrys.desktop.defaultBrowser`. Set this for a Niri-specific override
        without changing Hyprland's browser shortcut.
      '';
    };

    screenshots.directory = lib.mkOption {
      type = lib.types.str;
      default = "~/Pictures/Screenshots";
      description = "Directory niri's built-in screenshot UI saves into.";
    };

    # Curated actions with configurable chords, the hyprland pattern. Same
    # chords where the concept maps (muscle-memory parity), and niri-native
    # actions (columns, overview) where it doesn't.
    binds = {
      focusLeft = bindOpt "Mod+H" "focus column left";
      focusRight = bindOpt "Mod+L" "focus column right";
      focusDown = bindOpt "Mod+J" "focus window down";
      focusUp = bindOpt "Mod+K" "focus window up";

      moveLeft = bindOpt "Mod+Shift+H" "move column left";
      moveRight = bindOpt "Mod+Shift+L" "move column right";
      moveDown = bindOpt "Mod+Shift+J" "move window down";
      moveUp = bindOpt "Mod+Shift+K" "move window up";

      killActive = bindOpt "Mod+Q" "close the active window";
      terminal = bindOpt "Mod+Return" "launch the terminal";
      browser = bindOpt "Mod+F" "launch the browser";

      fullscreen = bindOpt "Mod+M" "toggle fullscreen";
      maximizeColumn = bindOpt "Mod+P" "maximize the column";
      toggleFloating = bindOpt "Mod+V" "toggle floating";
      overview = bindOpt "Mod+S" "toggle the overview";
      exit = bindOpt "Mod+Shift+E" "quit niri";

      workspacePrev = bindOpt "Mod+Ctrl+Left" "previous workspace";
      workspaceNext = bindOpt "Mod+Ctrl+Right" "next workspace";

      screenshot = bindOpt "Print" "open the interactive screenshot UI";
      screenshotScreen = bindOpt "Mod+Print" "screenshot the full screen";
      screenshotWindow = bindOpt "Mod+Shift+Print" "screenshot the focused window";
    };

    numberedWorkspaceBinds = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = "Generate Mod+1..9 workspace focus and Mod+Shift+1..9 move binds.";
    };

    extraBinds = lib.mkOption {
      # Left at `anything` on purpose. niri-flake's action helpers under
      # config.lib.niri.actions return attribute sets that carry a
      # `__functor`, so an action is not always plain data, and a JSON type
      # would refuse the form niri-flake documents for writing binds.
      type = lib.types.attrsOf (lib.types.attrsOf lib.types.anything);
      default = {};
      example = lib.literalExpression ''
        {
          "Mod+T".action.spawn = "thunderbird";
        }
      '';
      description = "Additional binds in programs.niri.settings.binds format, merged over the generated set.";
    };

    touchpad = {
      enable = lib.mkEnableOption "touchpad tuning (tap-to-click, natural scroll) for laptops";
    };

    xwayland = {
      enable = lib.mkOption {
        type = lib.types.bool;
        default = true;
        description = "Install xwayland-satellite so X11 applications run (niri detects and manages it automatically).";
      };
    };

    settings = lib.mkOption {
      # Left at `anything` for the same reason as extraBinds, since `binds`
      # and `switch-events` under it take the same action values. niri-flake
      # types the whole tree once it arrives at programs.niri.settings.
      type = lib.types.attrsOf lib.types.anything;
      default = {};
      description = "Extra programs.niri.settings, merged over the generated config (use lib.mkForce to override an already-set leaf).";
    };
  };

UWSM

Universal Wayland Session Manager. When enabled, Hyprland registers as a UWSM-managed compositor for proper systemd session integration.

othrys.desktop.uwsm.enable = true;

Idle

Staged idle policy via hypridle (ext-idle-notify, which works on Hyprland and Niri): optional backlight dim, lock (via the shared othrys.desktop.lockCommand signal), screen off (DPMS through the running compositor), and optional suspend. The stages must increase in that order, and the module refuses a configuration where a later stage fires first.

lockBeforeSleep, on by default, locks the session before the host sleeps. With the module enabled it is hypridle’s before-sleep command. A Hyprland or Niri host that does not enable this module still gets hypridle for that one job, configured with the lock command and no idle stage. Such a host therefore locks on suspend and on loginctl lock-session and never on idle time. Setting othrys.desktop.idle.lockBeforeSleep = false removes the before-sleep lock in both cases.

The locker comes with the lock command rather than with this module or ashell. Every Hyprland or Niri host, and a host with an unmanaged compositor that enables this module, gets the locker othrys.desktop.lockCommand names together with its PAM service, hyprlock for Hyprland and swaylock for Niri or an unmanaged compositor. That holds on a host where nothing locks the session, so a lock command run by hand or by a keybinding finds its locker. A locker whose PAM service is missing rejects the correct password, and the only way out is a VT switch.

Options

  options.othrys.desktop.idle = {
    enable = lib.mkEnableOption "staged idle management (dim, lock, screen off, suspend) via hypridle";

    lockCommand = lib.mkOption {
      type = lib.types.str;
      default = config.othrys.desktop.lockCommand;
      defaultText = lib.literalExpression "config.othrys.desktop.lockCommand";
      description = "Command the lock stage runs (and before-sleep lock).";
    };

    lockBeforeSleep = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = ''
        Lock the session before the host sleeps, so it does not resume into
        an open session. With `enable` set this is the idle daemon's
        before-sleep command. Without it, a host that runs one of the othrys
        compositors still starts hypridle for this alone, with no idle stage,
        and gets the locker and its PAM service. Set it to `false` on a host
        that should resume unlocked, such as one with no keyboard.
      '';
    };

    timeouts = {
      dim = lib.mkOption {
        type = lib.types.nullOr lib.types.ints.positive;
        default = null;
        example = 240;
        description = "Seconds of idle before dimming the backlight (brightnessctl); null disables the stage.";
      };
      lock = lib.mkOption {
        type = lib.types.nullOr lib.types.ints.positive;
        default = 300;
        description = "Seconds of idle before locking; null disables the stage.";
      };
      screenOff = lib.mkOption {
        type = lib.types.nullOr lib.types.ints.positive;
        default = 330;
        description = "Seconds of idle before turning displays off; null disables the stage.";
      };
      suspend = lib.mkOption {
        type = lib.types.nullOr lib.types.ints.positive;
        default = null;
        example = 1800;
        description = "Seconds of idle before suspending; null disables the stage (desktops usually want null, laptops a value).";
      };
    };
  };

Keyring

Browsers, mail clients and tray applications store credentials in the Secret Service, and a session without a provider leaves each of them to fall back to a plain file or to ask again on every start. othrys.desktop.keyring.enable runs one provider, which othrys.desktop.keyring.provider selects. Its default is othrys.desktop.graphical, so a Hyprland host, a niri host and a host with an unmanaged desktop all get one, while a headless host does not.

A host that runs another provider, such as KeePassXC or KWallet, turns the option off, since two providers compete for the same D-Bus name. niri-flake enables gnome-keyring on every niri host by itself, and the module overrides that whenever gnome-keyring is not the provider it was asked for.

othrys.desktop.keyring.enable = false;

gnome-keyring

The default provider encrypts its store with a password. With othrys.desktop.login the greeter passes the login password to the keyring, which is unlocked when the session starts. This holds while the keyring password and the login password are the same. Under impermanence ~/.local/share/keyrings is persisted at mode 0700 for the primary user.

A login that passes no password leaves the store locked, and the keyring then asks for its own the first time an application reads a secret. An autologin session is one such login. A login with a hardware key alone is another, since a U2F touch yields a signature and no secret, and a signature cannot unlock anything. The two settings below are the ways out.

A store without a password

othrys.desktop.keyring.passwordless creates the gnome-keyring store with no password, so nothing ever asks. gnome-keyring has no setting for this. The module writes the keyring file before the daemon first runs, at Home Manager activation, and only when neither login.keyring nor Default_keyring.keyring exists. A keyring that already exists is never replaced, so a host that had one with a password keeps it until its owner removes the file.

othrys.desktop.keyring.passwordless = true;

The store is then plain files under ~/.local/share/keyrings. File permissions keep other accounts out, and disk encryption keeps out whoever holds the powered-off machine. Any program running as the user reads every secret, and so does anyone who reaches the mounted disk, which includes a backup of the home directory. The greeter is no longer told to unlock the keyring, since there is nothing to unlock.

The module refuses the option on a host that declares no LUKS device in boot.initrd.luks.devices, which othrys.system.disko fills in and a host that set LUKS up by hand fills in as well. A host that accepts plain secrets on a plain disk sets othrys.desktop.keyring.allowUnencryptedDisk.

pass

provider = "pass" runs pass-secret-service for the primary user. It serves the same D-Bus API from a pass password store, where each secret is a file encrypted to the OpenPGP key named in othrys.desktop.keyring.pass.gpgKey. gnome-keyring is turned off, on a niri host as well.

othrys.desktop.keyring = {
  provider = "pass";
  pass.gpgKey = "<fingerprint>";
};

With the key on a hardware token, reading a secret needs the token, its PIN once for each gpg-agent session, and a touch on each read when the token’s touch policy for decryption is set to always. A copy of the disk or of a backup holds ciphertext only. A program running as the user can still ask the service for a secret while the token is present and the PIN is cached, and the touch policy is what stands between that program and the secret. The label of an entry and the attributes applications search by are stored beside it unencrypted, so the store shows which services have a secret.

The store lives in ~/.local/share/password-store unless othrys.desktop.keyring.pass.directory says otherwise, and it is persisted at mode 0700 under impermanence. A new store is initialised by writing its .gpg-id file, and a store that already has one is left as it is. The module does not import the public key or configure gpg-agent. othrys.services.security.yubikey provides the agent and a pinentry. Home Manager has to manage the primary user, and the module refuses the provider without it and without a key.

Which to pick

LoginSettingWhat unlocks the secrets
A password, typed at the greeterThe defaultsThe login password, passed on by the greeter
A hardware key alone, on an encrypted diskpasswordless = trueNothing, since the store has no password and the disk encryption protects it at rest
A hardware key alone, with secrets bound to the tokenprovider = "pass"The OpenPGP key on the token, with its PIN and its touch policy

Options

  options.othrys.desktop.keyring = {
    enable = lib.mkOption {
      type = lib.types.bool;
      default = config.othrys.desktop.graphical;
      defaultText = lib.literalExpression "config.othrys.desktop.graphical";
      example = false;
      description = ''
        Whether to run a Secret Service provider in the graphical session,
        which `provider` selects. Browsers, mail clients and tray
        applications store credentials in the Secret Service, and without a
        provider they fall back to a plain file or ask again on every start.
        It is on by default on a graphical host. A host that runs another
        provider, such as KeePassXC or KWallet, turns it off, since two
        providers compete for the same D-Bus name.
      '';
    };

    provider = lib.mkOption {
      type = lib.types.enum ["gnome-keyring" "pass"];
      default = "gnome-keyring";
      example = "pass";
      description = ''
        Which program serves the Secret Service.

        `gnome-keyring` encrypts its store with a password and unlocks it
        from the login password through PAM. It asks for that password the
        first time a secret is read unless the login passed one that
        matches, or `passwordless` created the store without one. A login
        with a hardware key alone passes no password, and a touch yields a
        signature and no secret, so nothing can unlock the store there.

        `pass` runs `pass-secret-service` for the primary user over a `pass`
        password store, where each secret is a file encrypted to the OpenPGP
        key named in `pass.gpgKey`. With that key on a hardware token,
        reading a secret needs the token, its PIN once for each agent
        session, and a touch on each read when the token's touch policy for
        decryption is set to always. gnome-keyring is turned off, since only
        one provider can own the D-Bus name. Home Manager has to manage the
        primary user, and the host needs a gpg-agent with a pinentry, which
        `othrys.services.security.yubikey` sets up.
      '';
    };

    passwordless = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = ''
        Whether to create the gnome-keyring store with no password, so that
        nothing ever asks to unlock it. It applies to the `gnome-keyring`
        provider only.

        The store is then plain files under `~/.local/share/keyrings`. File
        permissions protect it from other accounts, and disk encryption
        protects it from someone holding the powered-off machine. Nothing
        else does, so any program running as the user and anyone who can
        read the mounted disk reads every secret. The module refuses the
        option on a host with no encrypted disk unless
        `allowUnencryptedDisk` is set.

        The keyring file is written when Home Manager activates and neither
        `login.keyring` nor `Default_keyring.keyring` exists. A keyring that
        already exists is never replaced, so a host that had a keyring with
        a password keeps it until its owner removes it.
      '';
    };

    allowUnencryptedDisk = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = ''
        Accept `passwordless` on a host that declares no LUKS device in
        `boot.initrd.luks.devices`. Every stored secret then sits on the
        disk in plain files, readable by whoever holds the disk.
      '';
    };

    pass = {
      gpgKey = lib.mkOption {
        type = lib.types.nullOr (lib.types.strMatching "(0x)?[0-9A-Fa-f]{8,64}");
        default = null;
        example = "0123456789ABCDEF0123456789ABCDEF01234567";
        description = ''
          Key id or fingerprint of the OpenPGP key the password store is
          encrypted to. Required with `provider = "pass"`. A new store is
          initialised for it by writing its `.gpg-id` file, and a store that
          already has one is left alone. The public key has to be in the
          user's GnuPG keyring and trusted, which the module does not
          arrange.
        '';
      };

      directory = lib.mkOption {
        type = lib.types.strMatching "[A-Za-z0-9._-]+(/[A-Za-z0-9._-]+)*";
        default = ".local/share/password-store";
        example = ".password-store";
        description = ''
          The password store, relative to the primary user's home
          directory. `pass` and `pass-secret-service` are both pointed at
          it, and it is persisted at mode 0700 under impermanence.
        '';
      };
    };
  };

Night light

Color temperature shifting via gammastep. The schedule needs a location, and the module refuses to evaluate without one. Provide latitude and longitude from the host, or set geoclue.enable to have the location resolved.

geoclue.enable is off by default because it turns on services.geoclue2 for the whole host. With the nixpkgs defaults geoclue scans for nearby Wi-Fi networks, sends their hardware addresses to an online location service on every query, and answers any application that asks for the location. A host with fixed coordinates needs none of that.

othrys.desktop.nightLight = {
  enable = true;
  latitude = 40.7;
  longitude = -74.0;
};

Options

  options.othrys.desktop.nightLight = {
    enable = lib.mkEnableOption "night light (color temperature shifting) via gammastep";

    temperature = {
      day = lib.mkOption {
        type = lib.types.ints.positive;
        default = 6500;
        description = "Daytime color temperature in Kelvin.";
      };
      night = lib.mkOption {
        type = lib.types.ints.positive;
        default = 4000;
        description = "Nighttime color temperature in Kelvin.";
      };
    };

    latitude = lib.mkOption {
      type = lib.types.nullOr lib.types.float;
      default = null;
      example = 43.7;
      description = "Latitude for sunrise/sunset calculation. Identity-shaped, set from the consuming host together with longitude.";
    };

    longitude = lib.mkOption {
      type = lib.types.nullOr lib.types.float;
      default = null;
      example = -79.4;
      description = "Longitude for sunrise/sunset calculation, set together with latitude.";
    };

    geoclue.enable = lib.mkOption {
      type = lib.types.bool;
      default = false;
      example = true;
      description = ''
        Resolve the location through geoclue when no coordinates are set.
        This enables `services.geoclue2` for the whole host. With the nixpkgs
        defaults geoclue scans for nearby Wi-Fi networks, sends their
        hardware addresses to an online location service on every query, and
        answers any application that asks for the location. It is off by
        default for that reason, and a host with fixed coordinates does not
        need it.
      '';
    };
  };

Wallpaper

othrys.theme.wallpaper says what the wallpaper is, and this module draws it. It runs wpaperd as a user service of the graphical session and renders the daemon’s configuration from the theme. The same daemon serves Hyprland and niri, so a host draws the same wallpaper under either. The forms source takes, rotation and per-monitor settings are described in the theming guide.

othrys.desktop.wallpaper.enable is on by default when three things hold. The host is graphical, an othrys compositor module is enabled, and a wallpaper is declared, either in othrys.theme.wallpaper.source or for a monitor in othrys.theme.wallpaper.outputs. A host with no wallpaper therefore runs no daemon. Turning the option on by hand with no wallpaper declared fails an assertion, since the daemon would have nothing to draw.

The unit is wanted by graphical-session.target and stops with it. A host that draws its wallpaper with another program turns the option off, and a host that used to enable services.wpaperd for the primary user itself drops that setting, since both would write the same configuration file.

othrys.desktop.wallpaper.enable = false;

On a host with the Stylix export, Stylix would start hyprpaper under Hyprland and write a wpaperd section of its own. The adapter switches those targets off while this module is on, so one program draws.

Options

  options.othrys.desktop.wallpaper = {
    enable = lib.mkOption {
      type = lib.types.bool;
      default = config.othrys.desktop.graphical && compositorEnabled && declared;
      defaultText = lib.literalMD "true on a graphical host with an othrys compositor module enabled and a wallpaper declared, in `othrys.theme.wallpaper.source` or for a monitor in `othrys.theme.wallpaper.outputs`";
      example = false;
      description = ''
        Whether to draw `othrys.theme.wallpaper` with wpaperd, as a user
        service of the graphical session. It is on by default wherever an
        othrys compositor runs and a wallpaper is declared. A host that draws
        its wallpaper with another program turns it off, since two programs
        would draw over each other.
      '';
    };
  };

Compositors (Hyprland)

Platforms: NixOS only.

Hyprland Wayland compositor with automatic workspace generation, window rules, and UWSM integration.

Config format

Hyprland 0.5x reads Lua (~/.config/hypr/hyprland.lua); hyprlang is the legacy provider. The module pins configType = "lua" and expresses every setting as an hl.* call, so option values are structured attrsets rather than the comma-separated hyprlang strings they used to be. Monitors, workspace rules and window rules all take the shape of the hl.* function that consumes them. Key chords use Hyprland’s +-separated syntax ($mainMod + SHIFT + H), where $mainMod expands to a Lua local carrying the mainMod option.

Two knock-on effects worth knowing:

  • hyprctl dispatch is a shorthand for hl.dispatch(...) under the Lua provider, so its argument is a Lua expression: hyprctl dispatch 'hl.dsp.exit()', not hyprctl dispatch exit.
  • Home Manager also writes ~/.config/hypr/.luarc.json, pointing the Lua language server at the compositor’s own hl.* stubs for editor completion.

Package

The compositor and its portal come from the Hyprland flake this library locks, and a consuming flake declares no hyprland input. Upstream builds those packages against its own nixpkgs, which is what hyprland.cachix.org serves, and the module adds that cache to the host’s substituters.

package and portalPackage take another build. Set both from one source, since the portal is built against the compositor it ships with.

{pkgs, ...}: {
  othrys.desktop.compositors.hyprland = {
    package = pkgs.hyprland;
    portalPackage = pkgs.xdg-desktop-portal-hyprland;
  };
}

A consumer who tracks the Hyprland flake at another revision makes this library’s input follow theirs, with inputs.othrys.inputs.hyprland.follows = "hyprland", and leaves the options at their defaults.

Options

  options.othrys.desktop.compositors.hyprland = {
    enable = lib.mkEnableOption "Hyprland window manager";

    package = lib.mkOption {
      type = lib.types.package;
      default = locked.hyprland;
      defaultText = lib.literalMD "the `hyprland` package of the Hyprland flake this library locks";
      example = lib.literalExpression "pkgs.hyprland";
      description = ''
        The Hyprland package, used by the NixOS module and by the Home Manager
        module alike. The default is built by upstream against its own
        nixpkgs, which is what hyprland.cachix.org serves. Set `portalPackage`
        from the same source, since the portal is built against the
        compositor it ships with.
      '';
    };

    portalPackage = lib.mkOption {
      type = lib.types.package;
      default = locked.xdg-desktop-portal-hyprland;
      defaultText = lib.literalMD "the `xdg-desktop-portal-hyprland` package of the Hyprland flake this library locks";
      example = lib.literalExpression "pkgs.xdg-desktop-portal-hyprland";
      description = "The desktop portal for Hyprland, passed to `programs.hyprland.portalPackage`.";
    };

    monitors = lib.mkOption {
      type = lib.types.listOf (lib.types.submodule {
        freeformType = lib.types.attrsOf luaValue;
        options = {
          output = lib.mkOption {
            type = lib.types.str;
            description = "Connector name, or \"\" for the catch-all rule covering every unnamed output.";
            example = "DP-1";
          };
          mode = lib.mkOption {
            type = lib.types.str;
            default = "preferred";
            description = "Resolution and refresh rate.";
            example = "1920x1080@360";
          };
          position = lib.mkOption {
            type = lib.types.str;
            default = "auto";
            description = "Position in the monitor layout.";
            example = "0x0";
          };
          scale = lib.mkOption {
            type = lib.types.str;
            default = "auto";
            description = "Scale factor.";
            example = "1";
          };
        };
      });
      default = [{output = "";}];
      description = "hl.monitor() specs. Freeform keys (vrr, transform, mirror, disabled, ...) pass through.";
      example = [
        {
          output = "DP-1";
          mode = "1920x1080@360";
          position = "0x0";
          scale = "1";
        }
        {
          output = "HDMI-A-1";
          mode = "1920x1080@144";
          position = "-1920x0";
          scale = "1";
        }
      ];
    };

    workspaces = lib.mkOption {
      type = lib.types.listOf (lib.types.submodule {
        freeformType = lib.types.attrsOf luaValue;
        options.workspace = lib.mkOption {
          type = lib.types.str;
          description = "Workspace the rule applies to; Hyprland requires a string selector.";
          example = "1";
        };
      });
      default = [];
      description = "hl.workspace_rule() specs (auto-generated from `monitors` if empty).";
      example = [
        {
          workspace = "1";
          monitor = "DP-1";
          default = true;
        }
      ];
    };

    mainMod = lib.mkOption {
      type = lib.types.str;
      default = "SUPER";
      description = "Modifier bound to the `mainMod` Lua local used by all default keybindings.";
    };

    terminal = lib.mkOption {
      type = lib.types.str;
      default = "kitty";
      description = "Terminal emulator command bound to the `terminal` Lua local.";
    };

    browser = lib.mkOption {
      type = lib.types.str;
      default = config.othrys.desktop.defaultBrowser;
      defaultText = lib.literalExpression "config.othrys.desktop.defaultBrowser";
      description = ''
        Browser command bound to the `browser` Lua local. Defaults to the
        shared `othrys.desktop.defaultBrowser`. Set this for a
        Hyprland-specific override without changing Niri's browser shortcut.
      '';
    };

    input.keyboardLayout = lib.mkOption {
      type = lib.types.str;
      default = "us";
      description = "XKB keyboard layout.";
    };

    screenshots.directory = lib.mkOption {
      type = lib.types.str;
      default = "~/Pictures/Screenshots";
      description = "Directory the screenshot binds save into.";
    };

    # Curated actions with configurable chords. The module knows how to focus,
    # swap, screenshot, etc. Consumers only decide which keys trigger them.
    # Chords use Hyprland's `+`-separated syntax; `$mainMod` expands to the
    # `mainMod` option.
    binds = {
      focusLeft = bindOpt "$mainMod + H" "focus window left";
      focusRight = bindOpt "$mainMod + L" "focus window right";
      focusDown = bindOpt "$mainMod + J" "focus window down";
      focusUp = bindOpt "$mainMod + K" "focus window up";

      swapLeft = bindOpt "$mainMod + SHIFT + H" "swap window left";
      swapRight = bindOpt "$mainMod + SHIFT + L" "swap window right";
      swapDown = bindOpt "$mainMod + SHIFT + J" "swap window down";
      swapUp = bindOpt "$mainMod + SHIFT + K" "swap window up";

      killActive = bindOpt "$mainMod + Q" "close the active window";
      terminal = bindOpt "$mainMod + Return" "launch the terminal";
      browser = bindOpt "$mainMod + F" "launch the browser";

      fullscreen = bindOpt "$mainMod + M" "toggle fullscreen";
      toggleFloating = bindOpt "$mainMod + V" "toggle floating";
      pseudo = bindOpt "$mainMod + P" "toggle pseudotiling";
      pin = bindOpt "$mainMod + Y" "pin window";
      exit = bindOpt "$mainMod + SHIFT + E" "exit Hyprland";

      specialWorkspace = bindOpt "$mainMod + S" "toggle the special workspace";
      moveToSpecialWorkspace = bindOpt "$mainMod + SHIFT + S" "move window to the special workspace";
      workspacePrev = bindOpt "$mainMod + CTRL + left" "previous workspace";
      workspaceNext = bindOpt "$mainMod + CTRL + right" "next workspace";

      screenshot = bindOpt "Print" "screenshot the full screen";
      screenshotRegion = bindOpt "$mainMod + Print" "screenshot a region";
      screenshotRegionToClipboard = bindOpt "$mainMod + SHIFT + Print" "screenshot a region to the clipboard";
    };

    numberedWorkspaceBinds = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = "Generate $mainMod+1..0 workspace switch and $mainMod+SHIFT+1..0 move binds.";
    };

    extraBinds = lib.mkOption {
      type = lib.types.listOf (lib.types.submodule {
        options = {
          key = lib.mkOption {
            type = lib.types.str;
            description = "Key chord; `$mainMod` expands to the mainMod option.";
            example = "$mainMod + CTRL + 1";
          };
          dispatcher = lib.mkOption {
            type = lib.types.str;
            description = "Raw Lua dispatcher expression handed to hl.bind().";
            example = "hl.dsp.focus({ monitor = \"DP-1\" })";
          };
          opts = lib.mkOption {
            type = lib.types.attrsOf luaValue;
            default = {};
            description = "hl.bind() option table (locked, repeating, mouse, description, ...).";
          };
        };
      });
      default = [];
      description = "Extra keybindings (e.g., monitor focus for multi-monitor).";
    };

    windowRules = {
      workspaceAssignments = lib.mkOption {
        type = lib.types.listOf (lib.types.attrsOf luaValue);
        default = [];
        description = "hl.window_rule() specs pinning applications to workspaces, a per-fleet workflow choice, so no defaults.";
        example = [
          {
            match.class = "^(code-url-handler)$";
            workspace = "3 silent";
          }
          {
            match.class = "^(discord)$";
            workspace = "6 silent";
          }
        ];
      };

      presets = {
        steam = lib.mkOption {
          type = lib.types.bool;
          default = true;
          description = "Float Steam dialogs (Friends List, Settings, Steam Guard, ...) and tile the main window.";
        };
        jetbrains = lib.mkOption {
          type = lib.types.bool;
          default = true;
          description = "Focus/centering fixes for JetBrains IDE popup windows.";
        };
        floatCommonDialogs = lib.mkOption {
          type = lib.types.bool;
          default = true;
          description = "Float utility dialogs (pavucontrol, nm-connection-editor, calculator).";
        };
        pictureInPicture = lib.mkOption {
          type = lib.types.bool;
          default = true;
          description = "Float, pin, and corner-position Picture-in-Picture windows.";
        };
      };

      extra = lib.mkOption {
        type = lib.types.listOf (lib.types.attrsOf luaValue);
        default = [];
        description = "Additional hl.window_rule() specs appended after presets.";
      };
    };

    touchpad = {
      enable = lib.mkEnableOption "Touchpad support (for laptops)";
    };
  };

Keybindings

          bind = let
            b = cfg.binds;
          in
            lib.optionals cfg.numberedWorkspaceBinds (
              map (n:
                hlLua.mkBind {
                  key = "$mainMod + ${toString (lib.mod n 10)}";
                  dispatcher = "hl.dsp.focus({ workspace = ${toString n} })";
                }) (lib.range 1 10)
              ++ map (n:
                hlLua.mkBind {
                  key = "$mainMod + SHIFT + ${toString (lib.mod n 10)}";
                  dispatcher = "hl.dsp.window.move({ workspace = ${toString n} })";
                }) (lib.range 1 10)
            )
            ++ mkBind b.focusLeft ''hl.dsp.focus({ direction = "left" })''
            ++ mkBind b.focusRight ''hl.dsp.focus({ direction = "right" })''
            ++ mkBind b.focusDown ''hl.dsp.focus({ direction = "down" })''
            ++ mkBind b.focusUp ''hl.dsp.focus({ direction = "up" })''
            ++ mkBind b.swapLeft ''hl.dsp.window.swap({ direction = "left" })''
            ++ mkBind b.swapRight ''hl.dsp.window.swap({ direction = "right" })''
            ++ mkBind b.swapDown ''hl.dsp.window.swap({ direction = "down" })''
            ++ mkBind b.swapUp ''hl.dsp.window.swap({ direction = "up" })''
            ++ mkBind b.killActive "hl.dsp.window.close()"
            ++ mkBind b.terminal "hl.dsp.exec_cmd(terminal)"
            ++ mkBind b.browser "hl.dsp.exec_cmd(browser)"
            ++ mkBind b.fullscreen "hl.dsp.window.fullscreen()"
            ++ mkBind b.toggleFloating "hl.dsp.window.float()"
            ++ mkBind b.pseudo "hl.dsp.window.pseudo()"
            ++ mkBind b.pin "hl.dsp.window.pin()"
            ++ mkBind b.exit "hl.dsp.exit()"
            ++ mkBind b.specialWorkspace ''hl.dsp.workspace.toggle_special("magic")''
            ++ mkBind b.moveToSpecialWorkspace ''hl.dsp.window.move({ workspace = "special:magic" })''
            ++ mkBind b.workspacePrev ''hl.dsp.focus({ workspace = "e-1" })''
            ++ mkBind b.workspaceNext ''hl.dsp.focus({ workspace = "e+1" })''
            ++ mkBind b.screenshot (execCmd "grim ${screenshotFile}")
            ++ mkBind b.screenshotRegion (execCmd ''grim -g "$(slurp)" ${screenshotFile}'')
            ++ mkBind b.screenshotRegionToClipboard (execCmd ''grim -g "$(slurp)" - | wl-copy'')
            # Drag binds, where `mouse` is exclusive with locked/repeating.
            ++ [
              (hlLua.mkBind {
                key = "$mainMod + mouse:272";
                dispatcher = "hl.dsp.window.drag()";
                opts.mouse = true;
              })
              (hlLua.mkBind {
                key = "$mainMod + mouse:273";
                dispatcher = "hl.dsp.window.resize()";
                opts.mouse = true;
              })
              (hlLua.mkBind {
                key = "$mainMod + mouse_down";
                dispatcher = ''hl.dsp.focus({ workspace = "e+1" })'';
              })
              (hlLua.mkBind {
                key = "$mainMod + mouse_up";
                dispatcher = ''hl.dsp.focus({ workspace = "e-1" })'';
              })
            ]
            # Media and brightness keys stay live on the lock screen and
            # repeat while held.
            ++ map (spec:
              hlLua.mkBind {
                inherit (spec) key dispatcher;
                opts = {
                  locked = true;
                  repeating = true;
                };
              }) [
              {
                key = "XF86AudioRaiseVolume";
                dispatcher = execCmd "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+";
              }
              {
                key = "XF86AudioLowerVolume";
                dispatcher = execCmd "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-";
              }
              {
                key = "XF86AudioMute";
                dispatcher = execCmd "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
              }
              {
                key = "XF86AudioMicMute";
                dispatcher = execCmd "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle";
              }
              {
                key = "XF86MonBrightnessUp";
                dispatcher = execCmd "brightnessctl s 10%+";
              }
              {
                key = "XF86MonBrightnessDown";
                dispatcher = execCmd "brightnessctl s 10%-";
              }
            ]
            ++ map (spec:
              hlLua.mkBind {
                inherit (spec) key dispatcher;
                opts.locked = true;
              }) [
              {
                key = "XF86AudioNext";
                dispatcher = execCmd "playerctl next";
              }
              {
                key = "XF86AudioPrev";
                dispatcher = execCmd "playerctl previous";
              }
              {
                key = "XF86AudioPlay";
                dispatcher = execCmd "playerctl play-pause";
              }
              {
                key = "XF86AudioPause";
                dispatcher = execCmd "playerctl play-pause";
              }
            ]
            ++ map hlLua.mkBind cfg.extraBinds;

Quick Reference

BindingAction
Super + 1-0Switch workspace
Super + Shift + 1-0Move window to workspace
Super + H/J/K/LFocus left/down/up/right
Super + Shift + H/J/K/LSwap window
Super + QKill window
Super + ReturnTerminal
Super + FBrowser
Super + MFullscreen
Super + VToggle floating
Super + SScratchpad
PrintScreenshot (full)
Super + PrintScreenshot (region)

Window Rules

          window_rule =
            cfg.windowRules.workspaceAssignments
            ++ lib.optionals cfg.windowRules.presets.steam [
              {
                match = {
                  class = "^(steam)$";
                  title = "^(Steam)$";
                };
                tile = true;
              }
              {
                match = {
                  class = "^(steam)$";
                  title = "^(Friends List).*$";
                };
                float = true;
              }
              {
                match = {
                  class = "^(steam)$";
                  title = "^(.*Settings)$";
                };
                float = true;
              }
              {
                match = {
                  class = "^(steam)$";
                  title = "^(Steam Guard.*)$";
                };
                float = true;
              }
              {
                match = {
                  class = "^(steam)$";
                  title = "^(Steam - News.*)$";
                };
                float = true;
              }
              {
                match = {
                  class = "^(steam)$";
                  title = "^(Install.*)$";
                };
                float = true;
              }
            ]
            ++ lib.optionals cfg.windowRules.presets.jetbrains [
              {
                match = {
                  class = "^(jetbrains-toolbox)$";
                  float = false;
                };
                no_initial_focus = true;
              }
              {
                match = {
                  class = "^(jetbrains-.*)$";
                  float = false;
                };
                no_initial_focus = true;
              }
              {
                match = {
                  class = "^(jetbrains-.*)$";
                  title = "^$";
                  initial_title = "^$";
                  float = false;
                };
                no_initial_focus = true;
              }
              {
                match = {
                  class = "^(jetbrains-.*)$";
                  initial_title = "(.+)";
                  float = false;
                };
                center = true;
              }
              {
                match = {
                  class = "^(jetbrains-.*)$";
                  title = "^$";
                  initial_title = "^$";
                  float = false;
                };
                center = true;
              }
              {
                match = {
                  class = "^(jetbrains-.*)$";
                  title = "^win(.*)$";
                  initial_title = "^win.*$";
                  float = false;
                };
                no_initial_focus = true;
              }
            ]
            ++ lib.optionals cfg.windowRules.presets.floatCommonDialogs [
              {
                match.class = "^(pavucontrol)$";
                float = true;
              }
              {
                match.class = "^(nm-connection-editor)$";
                float = true;
              }
              {
                match.title = "^(Volume Control)$";
                float = true;
              }
              {
                match.class = "^(org.gnome.Calculator)$";
                float = true;
              }
            ]
            # One rule now that effects share a spec, instead of the four
            # separate hyprlang lines this replaces.
            ++ lib.optional cfg.windowRules.presets.pictureInPicture {
              match.title = "^(Picture-in-Picture)$";
              float = true;
              pin = true;
              size = "640 360";
              move = "100%-660 100%-380";
            }
            ++ cfg.windowRules.extra;

Monitor Configuration

Monitors are configured per-host as hl.monitor() specs. output is required; mode, position, and scale default to preferred/auto/auto, and any other hl.monitor() field (vrr, transform, mirror, disabled, …) passes through:

othrys.desktop.compositors.hyprland.monitors = [
  {
    output = "DP-1";
    mode = "1920x1080@360";
    position = "0x0";
    scale = "1";
  }
  {output = "HDMI-A-1";} # preferred mode, auto position/scale
];

An empty output is the catch-all rule matching every unnamed connector, so it is the module default ([{output = "";}]) and the usual external-display fallback.

Workspaces auto-generate based on monitor count:

  • Single monitor: all 10 workspaces on it
  • Dual monitor: workspaces 1-5 on primary, 6-10 on secondary

Named monitors get a monitor: binding in the generated hl.workspace_rule() calls, while the catch-all rule does not, since pinning workspaces to it is meaningless. Set workspaces to override the generated rules wholesale.

Gaming

Platforms: NixOS only.

Gaming modules under othrys.apps.gaming.*. Located in modules/apps/gui/gaming/.

Available Modules

ModuleOptionDescription
Steamothrys.apps.gaming.steamSteam with FHS environment, Proton-GE, essential libraries
GameModeothrys.apps.gaming.gamemodePerformance optimizer, with the GPU setting for the host’s card
MangoHudothrys.apps.gaming.mangohudVulkan and OpenGL overlay for FPS, temperatures and CPU/GPU usage
PrismLauncherothrys.apps.gaming.prismlauncherMinecraft launcher with persistent instances
osu!othrys.apps.gaming.osuosu!lazer with low-latency audio, and GameMode and a pen tablet on by default
r2modmanothrys.apps.gaming.r2modmanMod manager for Thunderstore games

Steam

  • FHS environment with essential X11, audio, and system libraries
  • Proton-GE for compatibility
  • Three firewall options, each off until a host turns it on
  • Gamescope session support
  • The ntsync driver, on by default from kernel 6.14

Steam turns on othrys.hardware.ntsync at mkDefault wherever the kernel ships the driver. Proton 10 and later use /dev/ntsync for Windows synchronization primitives when they can open it. Hardware describes the driver and the device access.

The module opens no port by default. Each option below opens its ports on every interface, so a host turns on the ones it uses.

OptionOpensFor
remotePlay.openFirewallTCP 27036 and 27037, UDP 10400, 10401 and 27031 to 27036streaming a game from this host to another device
localNetworkGameTransfers.openFirewallTCP 27040, UDP 27036copying an installed game from another Steam client on the network
dedicatedServer.openFirewallTCP and UDP 27015a Source Dedicated Server

Remote Play and local transfers still work outward with the ports closed. The options matter on the host that serves the stream or the game files.

Steam’s per-app shader caches persist with the Steam tree, but the DRIVER shader caches they depend on live in ~/.cache and NVIDIA’s is capped at 1 GiB, so pair Steam with othrys.hardware.graphics.shaderCache (see Hardware) or large Vulkan titles recompile shaders every launch on impermanence hosts.

Steam deletes every game’s compiled shader cache when the GPU driver version changes, so each driver update is followed by one full recompile per game. Two passes do that work. The background pass drains the queue while Steam is idle, and only runs once “Allow background processing of Vulkan shaders” is enabled in Steam under Settings, Downloads. The pre-launch pass covers whatever is left and blocks the game behind the “Processing Vulkan shaders” dialog. With nothing set, the pre-launch pass was measured at about 16 pipelines per second on a 32-thread desktop, where the same replay reaches 223 per second at 28 threads. shaderPrecache.backgroundThreads and shaderPrecache.highPriorityThreads pin the thread count of each pass. Both render into ~/.local/share/Steam/steam_dev.cfg, which the client reads as a console script at start, and devConfig writes any other console variable into the same file.

GameMode

Enables programs.gamemode with renice support and writes these defaults into gamemode.ini:

  • renice = 15
  • Screensaver inhibit
  • GPU optimisations on device 0, for the host’s GPU only. An othrys.hardware.nvidia host gets PowerMizer performance mode (nv_powermizer_mode = 1), and any other host gets amd_performance_level = "high"
  • Desktop notifications on start and stop

settings is merged over those defaults and has the shape of gamemode.ini, a section name over keys whose values are a string, a number, a boolean or a list of those. Each default is written with mkDefault, so setting one key leaves the others in place.

What GameMode needs from the host

  • The gamemode group. GameMode sets the CPU governor, the split-lock mitigation and the GPU settings through root helpers, and NixOS’s polkit rule runs them only for members of gamemode. The module adds the primary user when othrys.system.users.enable is on. Another account needs the group in its own extraGroups, and a session started before the change needs a fresh login. Without the group each helper is refused and the governor stays where it was.

  • A game that asks for it. The daemon acts only for a process started through gamemoderun or a client that requests it. The osu! wrapper on this page does so, and a Steam title needs gamemoderun %command% in its launch options.

  • GPU index 0. gpu.gpu_device defaults to 0. A host whose gaming GPU has another index sets settings.gpu.gpu_device.

  • Consent to GPU changes. The module writes apply_gpu_optimisations = "accept-responsibility", the literal value GameMode requires before it changes the GPU power state. With it set, GameMode switches the PowerMizer mode or the AMD performance level each time a game starts, as root and with no password prompt for a member of gamemode. The NVIDIA switch goes through nvidia-settings, which needs an X display, so under a Wayland compositor such as niri or Hyprland it does nothing. GameMode documents these GPU settings as able to damage hardware, which is why the value is spelled as an acceptance. A host that does not want that sets settings.gpu.apply_gpu_optimisations = 0, which leaves the GPU alone and keeps the CPU and scheduling changes.

  • A notification daemon. The start and end hooks call notify-send, and the module installs libnotify for it. Nothing is shown on a session with no notification daemon running.

MangoHud

The overlay package is installed system-wide, since it loads into the graphics stack of every Vulkan and OpenGL application, while its configuration goes through Home Manager. The overlay colours come from othrys.theme.palette, and on a host with no palette the overlay keeps MangoHud’s own colours.

enableSessionWide, off by default, sets MANGOHUD=1 for the session so every Vulkan application shows the overlay. With it off, a game is started through mangohud to show it. settings is merged over the module defaults. ~/.config/MangoHud and ~/.local/share/MangoHud are persisted under impermanence, the second of which holds the logs that F2 starts and stops.

osu!

  • Low-latency wrapper: Injects PIPEWIRE_LATENCY=64/48000 (1.3ms target), and launches through gamemoderun when GameMode is enabled
  • GameMode: Turns on othrys.apps.gaming.gamemode at mkDefault, since gamemoderun needs its daemon. A host that sets othrys.apps.gaming.gamemode.enable = false starts osu! directly
  • Tablet: Turns on othrys.hardware.tablet at mkDefault, which runs OpenTabletDriver, as Hardware describes
  • Persistence: Auto-persists ~/.local/share/osu (songs, skins, replays)

PrismLauncher

Automatically persists ~/.local/share/PrismLauncher (instances, mods, accounts, settings).

Hardware

Platforms: NixOS only.

Hardware modules under othrys.hardware.*.

Available Modules

ModuleOptionDescription
Audioothrys.hardware.audioPipeWire audio with persistence
CPUothrys.hardware.cpuMicrocode, firmware and KVM for the processor’s vendor
NVIDIAothrys.hardware.nvidiaNVIDIA GPU drivers
NVIDIA PRIMEothrys.hardware.nvidia.primeIntel + NVIDIA hybrid offload (laptop)
Shader cacheothrys.hardware.graphics.shaderCachePersistent, size-tuned GPU shader disk caches
Laptopothrys.hardware.laptopPower management, TLP
PowerSpec 1710othrys.hardware.laptop.powerspec-1710Laptop-specific hardware quirks
ntsyncothrys.hardware.ntsyncThe ntsync driver for Wine and Proton, opened to the active session’s user
Scannerothrys.hardware.scannerSANE scanning (network discovery via airscan)
SMARTothrys.hardware.smartDisk health monitoring (smartd + notify hook)
Tabletothrys.hardware.tabletPen tablets through OpenTabletDriver
UPSothrys.hardware.upsUPS monitoring and clean shutdown (NUT)
Webcamothrys.hardware.webcamV4L2 utilities (v4l-utils)
USBothrys.hardware.usbUSB utilities (usbutils)
Bluetoothothrys.hardware.wireless.bluetoothBluetooth, with /var/lib/bluetooth persisted at 0700 since it holds the link keys
WiFiothrys.hardware.wireless.wifiWiFi via NetworkManager, persisting system-connections and /var/lib/NetworkManager only

Audio

PipeWire with its ALSA, PulseAudio and JACK front ends, and rtkit for real-time scheduling. Two options change what PipeWire does out of the box.

lowLatency, on by default, sets the graph quantum to 512 frames. PipeWire ships 1024, which is 21.3 ms of buffering per cycle at 48 kHz, and 512 halves that to 10.7 ms. The sample rate and the quantum bounds stay at the PipeWire values, so a client that asks for a smaller buffer still gets one.

usbDuplexProfile, off by default, pins every USB audio device to the output:analog-stereo+input:mono-fallback profile. It suits a headset that WirePlumber brings up output-only. A device without that profile, such as a multichannel interface, ends up with no profile at all and stays silent, which is why a host has to ask for it.

CPU

othrys.hardware.cpu.vendor names the processor’s vendor, "intel" or "amd", on a host that runs on its own hardware. With it set, the module turns on that vendor’s microcode updates, hardware.enableRedistributableFirmware and the vendor’s KVM module.

othrys.hardware.cpu.vendor = "amd";

nixos-generate-config writes the same three settings into hardware.nix. A host installed another way, as with disko, has no such file, and NixOS defaults all three to off, so the host runs whatever microcode its board shipped. The default is null, which writes nothing and suits a virtual machine, since the hypervisor owns the microcode there. The firmware setting is written at mkDefault, so a host can keep the microcode and leave the firmware off. othrys.hardware.laptop.powerspec-1710 sets the vendor to "intel".

Options

  options.othrys.hardware.cpu = {
    vendor = lib.mkOption {
      type = lib.types.nullOr (lib.types.enum ["intel" "amd"]);
      default = null;
      example = "intel";
      description = ''
        The processor's vendor, on a host that runs on its own hardware. It
        turns on microcode updates for that vendor, the redistributable
        firmware the microcode and most devices load, and the vendor's KVM
        module. `null` writes nothing, which suits a virtual machine, where
        the hypervisor owns the microcode.
      '';
    };
  };

NVIDIA (Dedicated)

  config = lib.mkMerge [
    {
      assertions = [
        {
          assertion = cfg.containerToolkit.enable -> cfg.enable;
          message = "othrys.hardware.nvidia: containerToolkit needs the NVIDIA driver, so set othrys.hardware.nvidia.enable = true.";
        }
      ];
    }
    (lib.mkIf cfg.enable {
      assertions = [
        {
          assertion = !(cfg.blacklistIntel && primeEnabled);
          message = "othrys.hardware.nvidia: blacklistIntel removes the i915 driver that PRIME offload renders the display with. Turn one of the two off.";
        }
      ];

      hardware.nvidia-container-toolkit.enable = cfg.containerToolkit.enable;

      hardware.graphics = {
        enable = true;
        enable32Bit = true;

        extraPackages = with pkgs;
          [
            libva-vdpau-driver
            libvdpau-va-gl
            nvidia-vaapi-driver
          ]
          ++ lib.optionals primeEnabled [
            intel-media-driver
          ];

        extraPackages32 = with pkgs.pkgsi686Linux; [
          libva-vdpau-driver
          libvdpau-va-gl
        ];
      };

      services.xserver.videoDrivers =
        if primeEnabled
        then ["modesetting" "nvidia"]
        else ["nvidia"];

      hardware.nvidia = {
        inherit (cfg) package;
        modesetting.enable = true;
        open = cfg.openModules;
        nvidiaSettings = true;

        powerManagement.enable = lib.mkDefault primeEnabled;
        powerManagement.finegrained = lib.mkDefault false;
      };
      # GPU compute servers enable nvidia with no primary user, so this is the
      # only nvidia setting that needs one.

      othrys.internal.homeConfig."hardware.nvidia".home.sessionVariables =
        if primeEnabled
        then {
          LIBVA_DRIVER_NAME = "iHD";
          VDPAU_DRIVER = "va_gl";
        }
        else {
          __GLX_VENDOR_LIBRARY_NAME = "nvidia";
        };

      boot.initrd.kernelModules =
        lib.optionals cfg.earlyLoad nvidiaModules
        ++ lib.optionals primeEnabled [
          "i915"
        ];

      # nixpkgs loads `nvidia`, `nvidia_modeset` and `nvidia_drm` only on a host
      # with `services.xserver.enable`, and `nvidia_uvm` only with the open
      # modules. A Wayland host sets neither, so without early loading the four
      # are named here and systemd-modules-load reads them from the root
      # filesystem.
      boot.kernelModules = lib.optionals (!cfg.earlyLoad) nvidiaModules;

      boot.blacklistedKernelModules =
        ["nouveau"]
        ++ lib.optionals cfg.blacklistIntel [
          "i915"
        ];
    })
  ];

Key features:

  • Modesetting enabled (required for Wayland)
  • Open kernel modules by default, which suit Turing and newer (GTX 16, RTX 20 onward)
  • The driver is an option, package, defaulting to the stable branch
  • VA-API and VDPAU drivers for hardware video decode
  • 32-bit support for Steam/gaming
  • Kernel modules loaded in the initrd on a host without PRIME, which earlyLoad decides
  • Blacklists nouveau, and i915 as well when blacklistIntel is set

blacklistIntel is off by default. On a desktop whose CPU has an iGPU, the Intel driver is harmless beside the NVIDIA one, and blacklisting it takes away the motherboard outputs and Quick Sync. Set it on a host where the iGPU must never bind. PRIME renders the display on the iGPU, so blacklistIntel together with prime.enable fails evaluation.

earlyLoad decides whether the four NVIDIA kernel modules go into the initrd. With it on, the NVIDIA card can draw the disk-unlock prompt and the boot splash, and every initrd carries the driver and its firmware. With it off, the modules are listed in boot.kernelModules and loaded from the root filesystem once it is mounted. The default is on for a desktop and off with prime.enable, since the Intel GPU drives a PRIME laptop’s panel during boot and i915 stays in the initrd either way. On a PRIME host with the 580 legacy driver the initrd measures 207M with early loading and 50M without. With a 1G boot partition and a 12M kernel that is four generations against sixteen.

Container toolkit

containerToolkit.enable runs the NVIDIA container toolkit, which writes a CDI specification for the card at boot. Every container runtime reads the same specification, so Podman takes the card with --device nvidia.com/gpu=all, and Docker, rootful or rootless, with --gpus all. The option needs enable, and a host that sets it without the driver fails evaluation.

Older cards

The stable driver and the open kernel modules both leave older cards behind, and nothing at evaluation can tell which card a host has. With either one wrong, the kernel module never binds to the card. The symptom is NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver, and sudo dmesg | grep -i nvrm names the branch the card needs.

Card generationopenModulespackage
Turing and newer (GTX 16, RTX 20 onward)true, the defaultthe default
Maxwell, Pascal, Volta (GTX 900, GTX 10, Titan V)falsenvidiaPackages.legacy_580
Kepler (GTX 600 and 700)falsenvidiaPackages.legacy_470
{config, ...}: {
  othrys.hardware.nvidia = {
    enable = true;
    openModules = false;
    package = config.boot.kernelPackages.nvidiaPackages.legacy_580;
  };
}

Take the package from config.boot.kernelPackages, so its kernel modules are built for the kernel the host runs. A switch does not replace a kernel module that is already loaded, so reboot after changing either option.

NVIDIA PRIME (Hybrid Offload)

For laptops with Intel iGPU + NVIDIA dGPU. Uses PRIME offload, so Intel handles display and NVIDIA is available on demand.

intelBusId and nvidiaBusId have no default and PRIME fails evaluation until both are set. The addresses differ between boards, and a wrong pair boots to a black screen with nothing in the evaluation to point at it. lspci prints them in hexadecimal as bus:device.function and the options take decimal, so 01:00.0 becomes PCI:1:0:0 and 0a:00.0 becomes PCI:10:0:0.

othrys.hardware.nvidia = {
  enable = true;
  prime = {
    enable = true;
    intelBusId = "PCI:0:2:0";
    nvidiaBusId = "PCI:1:0:0";
  };
};

prime.enable on a host without othrys.hardware.nvidia.enable also fails evaluation, since PRIME configures nothing without the driver.

The module sets no kernel parameter. nixpkgs turns nvidia-drm.modeset on for an offload host and sets NVreg_PreserveVideoMemoryAllocations together with the suspend services whenever hardware.nvidia.powerManagement.enable is on, which it is by default with PRIME. A host that turns power management off therefore loses the parameter and the services together.

Options

  options.othrys.hardware.nvidia.prime = {
    enable = lib.mkEnableOption "PRIME offload (hybrid GPU)";

    intelBusId = lib.mkOption {
      type = lib.types.nullOr lib.types.str;
      default = null;
      defaultText = lib.literalMD "none, and PRIME refuses to evaluate until it is set";
      example = "PCI:0:2:0";
      description = ''
        PCI bus ID of the Intel iGPU. `lspci | grep VGA` prints the address
        in hexadecimal as `00:02.0`, and the option takes it in decimal as
        `PCI:0:2:0`. The address differs between boards, and a wrong one
        boots to a black screen, which is why there is no default.
      '';
    };

    nvidiaBusId = lib.mkOption {
      type = lib.types.nullOr lib.types.str;
      default = null;
      defaultText = lib.literalMD "none, and PRIME refuses to evaluate until it is set";
      example = "PCI:1:0:0";
      description = "PCI bus ID of the NVIDIA GPU, read from `lspci | grep NVIDIA` and written the same way as `intelBusId`.";
    };

    finegrainedPowerManagement = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = "Enable fine-grained power management (experimental).";
    };
  };

Shader Cache

Driver-level shader disk caches (~/.cache/nvidia, ~/.cache/mesa_shader_cache*) are wiped by impermanence and, on NVIDIA, evicted past a 1 GiB default cap, which together undo Steam’s shader pre-caching and force per-launch recompiles in large Vulkan titles. This module persists the cache directories and raises the NVIDIA cap session-wide. Steam’s own per-app caches live inside the persisted Steam tree already (see Gaming).

Options

  options.othrys.hardware.graphics.shaderCache = {
    enable = lib.mkEnableOption "persistent, size-tuned GPU shader disk caches";

    nvidiaSizeGiB = lib.mkOption {
      type = lib.types.ints.positive;
      default = 12;
      description = ''
        NVIDIA shader disk cache cap (`__GL_SHADER_DISK_CACHE_SIZE`). The
        driver default is 1 GiB, under which it evicts previously compiled
        shaders, undoing Steam's shader pre-caching and forcing per-launch
        recompiles in large Vulkan titles. Size for the shader footprint of
        the games actually played; eviction is also disabled outright via
        `__GL_SHADER_DISK_CACHE_SKIP_CLEANUP`, so a host that stops playing
        a title reclaims its space by deleting `~/.cache/nvidia`.
      '';
    };
  };

ntsync

othrys.hardware.ntsync.enable loads the ntsync driver and tags /dev/ntsync uaccess, which gives the device to whoever holds the active seat. The kernel ships the driver from 6.14 as a module that nothing loads, and no udev rule lets a user open the device. Proton 10 and later use it when they can open it, for Windows synchronization primitives that otherwise cost CPU time in the game’s own process. A Wine build with ntsync support uses it the same way, so a host that runs games through Lutris, Heroic or Bottles turns it on without Steam. A kernel older than 6.14 is refused.

othrys.apps.gaming.steam turns it on at mkDefault on a kernel from 6.14, so a Steam host that does not want it sets othrys.hardware.ntsync.enable = false. The option was othrys.apps.gaming.steam.ntsync before, and that name still works with a warning.

Options

  options.othrys.hardware.ntsync = {
    enable = lib.mkOption {
      type = lib.types.bool;
      default = false;
      example = true;
      description = ''
        Load the ntsync driver and give the active session's user access to
        `/dev/ntsync`. Proton 10 and later use it for Windows synchronization
        primitives when the device is present and writable, which lowers the
        CPU cost of games that wait on many objects. Any Wine build with
        ntsync support uses it the same way, so it serves Lutris, Heroic or
        Bottles as well as Steam. The kernel ships the driver from 6.14 as a
        module that nothing loads, and no udev rule grants access to it.
        `othrys.apps.gaming.steam` turns it on by default on such a kernel.
      '';
    };
  };

Scanner

SANE with network-scanner discovery (sane-airscan covers most modern eSCL/WSD devices), and vendor drivers go in extraBackends. The simple-scan GUI follows the graphical signal, and headless scan servers use scanimage.

Discovery runs over mDNS, so the module turns on services.avahi with nssmdns4, both at mkDefault. A host that sets services.avahi.enable = false keeps the scanners it names by hand in airscan.conf and finds no others.

Options

  options.othrys.hardware.scanner = {
    enable = lib.mkEnableOption "scanner support (SANE + network scanner discovery)";

    extraBackends = lib.mkOption {
      type = lib.types.listOf lib.types.package;
      default = [];
      example = lib.literalExpression "[pkgs.hplipWithPlugin]";
      description = "Additional SANE backends (vendor drivers) beyond the airscan default.";
    };
  };

SMART

Disk health monitoring via smartd over auto-detected devices. Warnings hit the wall by default. With othrys.services.notify enabled they are also pushed through othrys-notify.

Options

  options.othrys.hardware.smart = {
    enable = lib.mkEnableOption "disk health monitoring (smartd, auto-detected devices)";

    extraOptions = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = [];
      description = "Extra options passed to smartd.";
    };
  };

Tablet

othrys.hardware.tablet.enable runs OpenTabletDriver for a pen tablet, for drawing or for games. The daemon starts as a user unit in each graphical session, and the configuration GUI, opentabletdriver, is installed system-wide. The tablet area, bindings and filters it saves under ~/.config/OpenTabletDriver are persisted. The daemon exits with code 143 when systemd stops it, and the unit counts that as a clean stop.

othrys.apps.gaming.osu turns the tablet on at mkDefault, so a host with osu! and no tablet sets othrys.hardware.tablet.enable = false. In osu!, turn off “High Precision Mouse/Tablet” so the driver handles input.

Options

  options.othrys.hardware.tablet = {
    enable = lib.mkEnableOption "pen tablet support through OpenTabletDriver";
  };

UPS

NUT in standalone mode: the attached UPS is monitored, low battery triggers a clean shutdown, and power events push through othrys-notify when the notify module is enabled. The monitor password is a secrets-provider path.

upsmon runs its notify command as the unprivileged nutmon user, which cannot read a root-only othrys.services.notify.tokenFile. The module loads the token into upsmon.service as a systemd credential and copies it before start to /run/nut/othrys-notify/token, owned by that user, so the token file itself keeps its root:0400 ownership and the event still arrives authenticated.

Options

  options.othrys.hardware.ups = {
    enable = lib.mkEnableOption "UPS monitoring and clean shutdown (NUT, standalone)";

    driver = lib.mkOption {
      type = lib.types.str;
      default = "usbhid-ups";
      description = "NUT driver for the attached UPS (usbhid-ups covers most USB models).";
    };

    port = lib.mkOption {
      type = lib.types.str;
      default = "auto";
      description = "Driver port ('auto' scans USB).";
    };

    passwordFile = lib.mkOption {
      type = othrysTypes.secretPath;
      example = lib.literalExpression ''config.sops.secrets."ups/password".path'';
      description = "Path to a runtime file holding the NUT monitor password (a secrets-provider path). Mandatory, with no default.";
    };
  };

Webcam

Installs v4l-utils and adds no group. logind gives the user at the seat access to camera nodes through a udev ACL. The video group is not needed for that, and membership would open the DRM, framebuffer and backlight nodes to the user from every session, an SSH login included.

Bluetooth

BlueZ with pairings persisted under /var/lib/bluetooth and the Blueman applet on graphical hosts. A2DP needs no key in main.conf, since PipeWire registers the audio endpoints with BlueZ when othrys.hardware.audio is on. experimental turns on the BlueZ experimental interfaces, which battery reporting uses.

The persisted directory is mode 0700. The tree holds the link keys of every paired device under a directory per adapter, and bluetoothd creates it 0700 itself, so it keeps the mode the daemon would have chosen.

WiFi

NetworkManager, with declarative networks under networks and their passphrases read from environmentFile. The variable for a network is WIFI_PSK_ followed by its key under networks in upper case, with every character other than a letter, a digit or an underscore replaced by an underscore. The key guest-5g.lan reads WIFI_PSK_GUEST_5G_LAN. Two keys that map to one variable fail evaluation.

NetworkManager persists /etc/NetworkManager/system-connections, which holds the saved connections and their secrets, and /var/lib/NetworkManager, which holds the leases, the seen BSSIDs and the timestamps autoconnect ranks by. /etc/NetworkManager itself is left on the ephemeral root. NixOS writes NetworkManager.conf and the conf.d fragments there as store symlinks at activation, and a bind mount over the whole directory would hide every one of them, so the daemon would start with its stock defaults and none of the settings the host declares.

Services

Platforms: SSH, Tailscale and Mosh run on NixOS and nix-darwin. Every other service is NixOS only. See Darwin.

Service modules under othrys.services.*.

Available Modules

ModuleOptionDescription
Docsothrys.services.docsMdBook documentation server (darkhttpd)
SSHothrys.services.sshOpenSSH server, client defaults and known hosts
Tailscaleothrys.services.tailscaleVPN mesh network
Moshothrys.services.moshMobile shell server and client
WireGuardothrys.services.wireguardRaw WireGuard interfaces (site-to-site, exit nodes)
DDNSothrys.services.ddnsDynamic DNS updates (inadyn)
Headscaleothrys.services.headscaleSelf-hosted Tailscale control server
Monitoringothrys.services.monitoringPrometheus server and node exporter
VictoriaMetricsothrys.services.victoriametricsTime-series database (Prometheus-compatible)
VictoriaLogsothrys.services.victorialogsLog database (LogsQL, journald ingestion)
Grafanaothrys.services.grafanaDashboards (datasources auto-provisioned)
Scrutinyothrys.services.scrutinyS.M.A.R.T. disk health with history (web UI, InfluxDB, collector)
Alertingothrys.services.alertingvmalert rule evaluation with ntfy delivery
Ntfyothrys.services.ntfySelf-hosted push-notification server
Notifyothrys.services.notifyHost notification dispatch + failure hooks
Automountothrys.services.automountUSB automounting through udiskie
Firewallothrys.services.firewallTurns on the NixOS firewall and sets nothing else
Routerothrys.services.routerL3 router firewall + NAT (nftables), optional NFQUEUE hook
Suricataothrys.services.suricataIDS/IPS (NFQUEUE or AF_PACKET inline)
Keaothrys.services.keaKea DHCPv4/DHCPv6 server
Unboundothrys.services.unboundRecursive DNS (DoT upstream, RPZ blocklists)
Traefikothrys.services.traefikReverse proxy with DNS-01 ACME, a TLS floor, security headers and TCP routers
sojuothrys.services.sojuIRC bouncer on loopback, reached over its own TLS or through Traefik
Resticothrys.services.resticScheduled restic backups (secrets via file paths)
Virtual Cameraothrys.services.virtualcamerav4l2loopback devices, numbered from videoNr, enabled by othrys.apps.obs
Printingothrys.services.printingCUPS printing
Mounts (Disks)othrys.services.mounts.disksAdditional disk mounts (NTFS, ext4, btrfs)
Mounts (CIFS)othrys.services.mounts.cifsCIFS/SMB network share mounts

See also: Security, Containerization

Documentation Server

Builds the MdBook documentation at Nix evaluation time and serves it via darkhttpd.

Options

  options.othrys.services.docs = {
    enable = lib.mkEnableOption "MdBook documentation server";

    package = lib.mkOption {
      type = lib.types.package;
      default = docsPackage;
      defaultText = lib.literalMD "the MdBook built from `docs/` of the flake source that `nixosModules.default` injects";
      description = "The built documentation package to serve. Required when this module is imported on its own through `nixosModules.docs`, where no flake source is injected to build the default from.";
    };

    port = lib.mkOption {
      type = lib.types.port;
      default = 3000;
      description = "Port to serve documentation on.";
    };

    interface = lib.mkOption {
      type = lib.types.str;
      default = "127.0.0.1";
      description = "Interface to bind to (use 0.0.0.0 for all interfaces).";
    };

    openFirewall = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = "Open firewall port for documentation server.";
    };

    desktopEntry = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = "Create a desktop entry to open docs in the default browser.";
    };
  };

Usage

othrys.services.docs = {
  enable = true;
  port = 3000;             # default
  interface = "127.0.0.1"; # default, use "0.0.0.0" for all interfaces
  openFirewall = false;    # default
  desktopEntry = false;    # default, creates XDG desktop entry to open in browser
};

The docs are built from the flake source as a derivation, with no runtime build step. The built package is also accessible as config.othrys.services.docs.package.

When desktopEntry is enabled, an “othrys.nix Docs” entry appears in application launchers, opening the docs in the default browser via xdg-open.

SSH

othrys.services.ssh configures the client for the primary user and, with server.enable, the OpenSSH server with password login off.

server.ports sets the ports the server listens on, [22] by default, and server.openFirewall opens them, which it does by default. Both are written to services.openssh as defaults, so a host that sets the upstream options directly gets the same result. The firewall and the fail2ban sshd jail read services.openssh.ports, so a server moved to another port has that port opened and watched while 22 stays closed.

The server settings are all written with lib.mkDefault, and a plain assignment under services.openssh.settings replaces any one of them.

DirectiveDefault here
PermitRootLoginno
PasswordAuthentication, KbdInteractiveAuthenticationno
X11Forwardingno
AllowTcpForwarding, AllowAgentForwardingno
MaxAuthTries3
LoginGraceTime30
MaxSessions4
ClientAliveInterval, ClientAliveCountMax300, 2
UsePAMyes
LogLevelVERBOSE
KexAlgorithmssntrup761x25519-sha512@openssh.com, mlkem768x25519-sha256, curve25519-sha256, curve25519-sha256@libssh.org
Cipherschacha20-poly1305@openssh.com, aes256-gcm@openssh.com, aes128-gcm@openssh.com, aes256-ctr
Macshmac-sha2-512-etm@openssh.com, hmac-sha2-256-etm@openssh.com

Four of these change what a working host does. With forwarding off, ssh -L, ssh -R, ssh -J through the host and remote editors that tunnel over the connection are refused, and so is ssh -A. A jump host or a development machine turns AllowTcpForwarding back on. MaxAuthTries 3 counts every key the client offers, so a client whose agent holds more than three keys is disconnected before it reaches the right one unless it names the key with IdentityFile and IdentitiesOnly yes. The algorithm lists are narrower than the set nixpkgs recommends, and a client older than OpenSSH 6.5 negotiates nothing from them. UsePAM stays on because sshd opens the login session and applies limits through the PAM account and session stacks, and with password and keyboard-interactive login off it authenticates nobody.

othrys.services.ssh.server = {
  enable = true;
  ports = [2222];
};
services.openssh.settings.AllowTcpForwarding = "yes";

knownHosts passes host keys to programs.ssh.knownHosts, which writes /etc/ssh/ssh_known_hosts for every user. A listed host is verified against its listed key on the first connection, so nobody accepts it on trust. An entry takes publicKey or publicKeyFile, and optionally hostNames, extraHostNames and certAuthority, and any other key is rejected. includeForgeKeys is on by default and adds the published ed25519 keys of github.com, gitlab.com, codeberg.org and git.sr.ht. An entry in knownHosts with the same name replaces a forge entry.

The client defaults under "*" are StrictHostKeyChecking ask, HashKnownHosts yes and UpdateHostKeys ask, so an unknown host prompts and is never accepted silently. A directive set through settings replaces that one default and leaves the rest. Once knownHosts covers every host the machine connects to, this ends trust on first use. The client does not ask for compression, which slows transfers on a fast link. A host reached over a slow one sets Compression for that host through settings.

othrys.services.ssh = {
  knownHosts."nas.example.com".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA...";
  settings."*".StrictHostKeyChecking = "yes";
};

There is no host certificate authority option. A CA needs a signing key whose custody belongs with the host configuration and not with a module library.

On nix-darwin

darwinModules.default carries the module, and the known hosts and the client configuration are the same as on NixOS. server.enable turns on the macOS Remote Login service through nix-darwin’s services.openssh, which takes sshd_config text in place of settings. The directives above are rendered into /etc/ssh/sshd_config.d/100-nix-darwin.conf, and sshd keeps the first value it reads, so they win over the defaults macOS ships. mlkem768x25519-sha256 is left out of KexAlgorithms there, since Apple’s OpenSSH build follows the macOS release and one older than 9.9 refuses the whole line over a name it does not know.

nix-darwin declares no services.openssh.settings, so a darwin host loosens a directive with a line in services.openssh.extraConfig placed ahead of the othrys lines. A line at normal priority comes after them and loses.

services.openssh.extraConfig = lib.mkBefore "AllowTcpForwarding yes";

launchd starts that sshd on port 22, so a server.ports other than [22] is refused. The firewall nix-darwin manages filters by application and takes no port list, so server.openFirewall has nothing to open on a Mac.

A login from Ghostty or kitty sets TERM to xterm-ghostty or xterm-kitty, and the terminfo database macOS ships has neither entry, so the server also puts the terminfo output of ghostty-bin and kitty on the system path. nix-darwin adds that to TERMINFO_DIRS, so clear, backspace and full-screen programs work in the session. Another terminal’s entry goes in environment.systemPackages the same way, or environment.enableAllTerminfo installs eleven of them at once.

Router

An L3 router firewall + NAT built on networking.nftables. It generates a default-drop inet filter (input/forward) and an ip masquerade from the WAN and LAN interface options. LAN interfaces are trusted (input accepted, forwarded to the WAN), while the WAN is default-drop except established/related. Interface names and subnets are identity and come from the fleet host. Port forwards are declared through portForwards, which renders the dnat rule in the NAT prerouting chain and the forward accept the rewritten connection needs. Anything else the generated ruleset doesn’t cover goes through extraInputRules / extraForwardRules / extraPrerouting / extraNat.

extraNat is the postrouting chain, after the masquerade, and a dnat verb is invalid there. nft --check accepts it, so the build passes, and the kernel refuses the whole ruleset at load, so the router comes up forwarding with no filter table at all. A dnat or redirect rule goes in extraPrerouting.

With suricata.enable, forwarded traffic is handed to Suricata via NFQUEUE (queue num 0-<N-1> bypass) instead of plain accept. Pair it with othrys.services.suricata (mode = "nfqueue", matching nfqueue.queues). Suricata inspects forwarded traffic only. The queue verdict is written in the forward chain and nowhere else, so connections to the router itself, which the input chain decides, and connections the router opens are never queued.

The router disables networking.firewall (and asserts othrys.services.firewall is off), and still reads the firewall’s port lists. A port a module opens through openFirewall lands in networking.firewall.allowedTCPPorts or the UDP list, and the input chain accepts it on every interface but the WAN, so SSH, headscale, WireGuard and the rest work on a router as on any host without reaching the internet. A port that must reach the WAN is opened by naming the interface, networking.firewall.interfaces.<wan>.allowedTCPPorts, which the chain renders for that interface alone; the tailscale module does this for its own UDP port so direct paths work from outside. Reverse-path filtering is strict on the WAN interface and loose on the LAN interfaces and on any interface created later, so routes that Tailscale installs and multi-homed replies are not dropped. conf.all stays at 0, since the kernel applies the higher of that value and the interface’s own.

Two separate mechanisms decide what happens when inspection stops, and they are easy to confuse. The bypass flag above accepts packets when no process is bound to the queue, so a dead or stopped Suricata does not take the link down, and it is set unconditionally. othrys.services.suricata.nfqueue.failOpen covers the other case, a running Suricata whose queue is full. Setting failOpen = false therefore does not make a dead Suricata block traffic.

The unit’s pre-check, suricata -T, treats any rule that fails to load as fatal, so a ruleset with one bad rule keeps the engine from starting. Because of bypass the network shows no sign of that, so watch the unit and not the link.

A start that keeps failing does not loop for ever. The unit retries thirty seconds apart, and after five starts within fifteen minutes it stays in failed, where systemctl --failed and monitoring can see it. With othrys.services.notify enabled, that failure is sent through notify-failure@. suricata-recover.service runs after every successful suricata-update, which is at least daily, and starts the engine again if it was left in failed. When the cause is still there, the unit fails and reports again, once per rule update.

The module states modbus and dnp3 as enabled = "no", which is Suricata’s own default, so that suricata-update drops the rules naming them. Set either to "yes" through settings to get the parser and its rules back. A running engine reloads its rules after every suricata-update run, through upstream’s blocking reload, so a fetched ruleset is live without a restart. dropRules lists the rules suricata-update turns from alert into drop. With the router’s NFQUEUE hook on, the module refuses an af-packet Suricata and a queue count that differs from the router’s, since a queue nobody listens on accepts its packets uninspected.

On this NFQUEUE path a stopped Suricata always fails open, since bypass is unconditional. An overloaded one fails open by default and drops what does not fit its queue once nfqueue.failOpen is false. The default is deliberate, since an IPS crash on a router should not sever the network it protects. While Suricata is down, forwarded traffic is uninspected rather than blocked, so the link stays up with no IPS behind it.

An af-packet IPS fails the other way. With mode = "af-packet" and posture = "ips" Suricata copies frames between the two interfaces itself, and the module sets up no other path between them, so the link is down whenever the engine is.

IPv6 is forwarded and filtered when ipv6 is on, and the WAN interface accepts router advertisements so it keeps its default route. The module does no more for IPv6 than that. There is no NATv6, so the LAN needs a routed prefix, and requesting a delegated prefix from the uplink and sending router advertisements on the LAN are the host’s job. systemd-networkd does both through DHCPPrefixDelegation and IPv6SendRA, and dhcpcd with radvd is the other common pair.

Options

  options.othrys.services.router = {
    enable = lib.mkEnableOption "L3 router firewall + NAT (nftables)";

    wan.interface = lib.mkOption {
      type = lib.types.str;
      example = "enp1s0f0";
      description = "Uplink (WAN) interface. Input is default-drop except established/related; LAN is masqueraded out this interface.";
    };

    lan.interfaces = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = [];
      example = ["br-lan"];
      description = "Trusted (LAN) interfaces: their input is accepted and they are forwarded to the WAN.";
    };

    nat.enable = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = "IPv4 masquerade (SNAT) for traffic leaving the WAN interface.";
    };

    forwarding = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = "Enable IP forwarding and rp_filter anti-spoofing sysctls.";
    };

    ipv6 = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = ''
        Forward IPv6 as well. There is no NATv6, so the LAN needs a routed
        prefix of its own. This module forwards and filters IPv6 and
        configures no addressing. Requesting a delegated prefix from the
        uplink and sending router advertisements on the LAN are the host's
        job, through systemd-networkd's `DHCPPrefixDelegation` and
        `IPv6SendRA`, or through dhcpcd and radvd.
      '';
    };

    suricata = {
      enable = lib.mkOption {
        type = lib.types.bool;
        default = false;
        description = "Send forwarded traffic to Suricata via NFQUEUE. Pair with othrys.services.suricata (mode = \"nfqueue\").";
      };

      queues = lib.mkOption {
        type = lib.types.ints.positive;
        default = 1;
        description = "NFQUEUE count; must match othrys.services.suricata.nfqueue.queues.";
      };
    };

    logDrops = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = ''
        Log every packet the input and forward chains drop, through the
        kernel log with a `router input drop:` or `router forward drop:`
        prefix. The counters on those rules are always on; this adds the
        packets themselves, which is useful while bringing a host up and
        noisy on a WAN link afterwards.
      '';
    };

    extraInputRules = lib.mkOption {
      type = lib.types.lines;
      default = "";
      description = ''
        Raw nftables rules appended to the filter input chain. A port that a
        module opens through `openFirewall` needs nothing here, since the
        firewall's port lists are rendered into this chain for every interface
        but the WAN. A port that must reach the WAN is opened with
        `networking.firewall.interfaces.<wan>.allowedTCPPorts` or the UDP
        list, which this chain renders for that interface alone.
      '';
    };

    extraForwardRules = lib.mkOption {
      type = lib.types.lines;
      default = "";
      description = "Raw nftables rules appended to the filter forward chain (e.g. port forwards, inter-VLAN policy).";
    };

    portForwards = lib.mkOption {
      type = lib.types.listOf (lib.types.submodule {
        options = {
          protocol = lib.mkOption {
            type = lib.types.enum ["tcp" "udp"];
            default = "tcp";
            description = "Transport protocol of the forwarded connections.";
          };
          port = lib.mkOption {
            type = lib.types.port;
            description = "Port on the WAN interface the connections arrive on.";
          };
          destination = lib.mkOption {
            type = lib.types.str;
            example = "10.0.0.42";
            description = "LAN address the connections are sent to.";
          };
          destinationPort = lib.mkOption {
            type = lib.types.nullOr lib.types.port;
            default = null;
            description = "Port on the destination. The WAN port when null.";
          };
        };
      });
      default = [];
      example = lib.literalExpression ''
        [
          {
            port = 25565;
            destination = "10.0.0.42";
          }
        ]
      '';
      description = ''
        Connections arriving on the WAN interface that are sent on to a LAN
        host. Each entry renders the dnat rule in the NAT prerouting chain and
        the accept in the forward chain that the rewritten connection needs,
        through Suricata when the IPS hook is on.
      '';
    };

    extraPrerouting = lib.mkOption {
      type = lib.types.lines;
      default = "";
      description = ''
        Raw nftables rules appended to the NAT prerouting chain, where a
        `dnat` or `redirect` verb belongs. A connection rewritten here still
        needs its accept in `extraForwardRules` unless `portForwards` made
        it.
      '';
    };

    extraNat = lib.mkOption {
      type = lib.types.lines;
      default = "";
      description = ''
        Raw nftables rules appended to the NAT postrouting chain, after the
        masquerade, for source rewrites such as an exception to it. A `dnat`
        verb is invalid in this chain: `nft --check` accepts it, the kernel
        refuses the whole ruleset at load, and the router comes up with no
        firewall at all. Port forwards go in `portForwards` or
        `extraPrerouting`.
      '';
      example = ''oifname "enp1s0f0" ip saddr 10.0.0.42 snat to 203.0.113.42'';
    };
  };

Usage

othrys.services.router = {
  enable = true;
  wan.interface = "enp1s0f0";
  lan.interfaces = ["br-lan"];
  nat.enable = true;          # IPv4 masquerade
  # Inline IPS: feed forwarded traffic to Suricata's NFQUEUE
  suricata = { enable = true; queues = 4; };
  # A port forward: the dnat rule and the forward accept it needs, through
  # the IPS like any other forwarded traffic.
  portForwards = [{ port = 25565; destination = "10.0.0.42"; }];
  # Raw escape hatches for policy the options do not express:
  extraForwardRules = "iifname \"br-lan\" oifname \"br-iot\" drop";
};

Suricata

Suricata IDS/IPS, wrapping the upstream services.suricata. Two inline deliveries via mode:

  • nfqueue (default) keeps the box an L3 router/NAT, since an nftables queue rule (the router/firewall module’s job) hands packets to Suricata, which the module runs in NFQUEUE runmode. nfqueue.queues sets -q 0 … -q N-1, and nfqueue.failOpen accepts packets when a running Suricata’s queue is full.
  • af-packet captures on an interface; posture = "ips" builds a transparent L2 bridge across afPacket.interface + afPacket.copyInterface.

posture (ids/ips) selects alert-only against drop. Start in IDS, tune, then flip. offloadInterfaces disables GRO/GSO/TSO/LRO (required for inline correctness). Rules come from enabledSources (default et/open) via suricata-update; deep tuning (threading/CPU-affinity, mpm-algo = "hs", outputs) goes through settings. Host-specific values (interface names, isolcpus, core sets) stay in the fleet.

The fetched sources and the compiled suricata.rules live under /var/lib/suricata, which the module persists under impermanence for the suricata account. Without that entry a rebooted host runs with no rules until the first update after boot succeeds.

Options

  options.othrys.services.suricata = {
    enable = lib.mkEnableOption "Suricata IDS/IPS";

    package = lib.mkOption {
      type = lib.types.nullOr lib.types.package;
      default = null;
      defaultText = lib.literalExpression "pkgs.suricata";
      description = "Suricata package to use.";
    };

    mode = lib.mkOption {
      type = lib.types.enum ["nfqueue" "af-packet"];
      default = "nfqueue";
      description = ''
        Inline delivery. `nfqueue` keeps the box an L3 router/NAT (packets are
        queued to Suricata by an nftables `queue` rule). `af-packet` captures on
        an interface (a transparent L2 bridge when posture = ips).
      '';
    };

    posture = lib.mkOption {
      type = lib.types.enum ["ids" "ips"];
      default = "ids";
      description = "IDS alerts only; IPS can drop. Start in IDS, tune, then flip to IPS.";
    };

    enabledSources = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = ["et/open"];
      description = "suricata-update rule sources to enable (sources needing a secret code are unsupported upstream).";
    };

    disabledRules = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = [];
      description = "Rule SIDs/patterns to disable (noisy signatures).";
      example = ["2013504" "2100498"];
    };

    offloadInterfaces = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = [];
      description = ''
        Interfaces on which to disable NIC offloads (GRO/GSO/TSO/LRO) before
        Suricata starts. Required for inline correctness, since offloads create
        super-sized datagrams the inspection path drops.
      '';
      example = ["enp1s0f0" "enp1s0f1"];
    };

    nfqueue = {
      queues = lib.mkOption {
        type = lib.types.ints.positive;
        default = 1;
        description = "Number of NFQUEUE queues (Suricata runs `-q 0 .. -q N-1`); pair with `queue num 0-<N-1>` in nftables and one worker per queue.";
      };

      failOpen = lib.mkOption {
        type = lib.types.bool;
        default = true;
        description = ''
          Suricata's `nfq.fail-open`. Lets the kernel accept packets when the
          queue is full, which is the overloaded case, instead of dropping them.

          This does not govern what happens when Suricata is not running. That
          is the `bypass` flag on the nftables `queue` verdict, which
          `othrys.services.router` sets unconditionally, so a dead IPS passes
          traffic regardless of this option. Setting it to false does not make a
          dead Suricata block the link.

          Either way the failure mode is uninspected traffic rather than blocked
          traffic, which is deliberate for a router in the forwarding path.
        '';
      };
    };

    afPacket = {
      interface = lib.mkOption {
        type = lib.types.nullOr lib.types.str;
        default = null;
        example = "enp1s0f0";
        description = "Capture interface for af-packet mode.";
      };

      copyInterface = lib.mkOption {
        type = lib.types.nullOr lib.types.str;
        default = null;
        example = "enp1s0f1";
        description = "Peer interface for the af-packet IPS bridge (posture = ips).";
      };

      clusterId = lib.mkOption {
        type = lib.types.ints.positive;
        default = 99;
        description = "af-packet cluster-id (must be unique per Suricata instance on the host).";
      };

      clusterType = lib.mkOption {
        type = lib.types.enum ["cluster_flow" "cluster_cpu" "cluster_qm" "cluster_ebpf"];
        default = "cluster_flow";
        description = "af-packet cluster-type, which decides how packets are spread over the capture threads.";
      };
    };

    dropRules = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = [];
      example = ["re:trojan" "2019401"];
      description = ''
        Rules that `suricata-update` turns from alert into drop, one
        `drop.conf` line each: a signature id, or a `re:` regular expression
        over the rule text. Only an IPS posture drops; in IDS they stay
        alerts.
      '';
    };

    settings = lib.mkOption {
      type = lib.types.attrsOf lib.types.anything;
      default = {};
      description = "Extra suricata.yaml settings, deep-merged over (and overriding) the generated config, e.g. threading/affinity, outputs, mpm-algo.";
      example = lib.literalExpression ''
        {
          mpm-algo = "hs";
          threading.set-cpu-affinity = true;
        }
      '';
    };
  };

Usage

# Router (NFQUEUE), start in IDS and feed it from nftables (`… queue num 0-3`)
othrys.services.suricata = {
  enable = true;
  mode = "nfqueue";          # default
  posture = "ids";           # alert-only until tuned
  nfqueue.queues = 4;
  offloadInterfaces = ["enp1s0f0" "enp1s0f1"];
  enabledSources = ["et/open"];
};

# Transparent bridge IPS (AF_PACKET)
othrys.services.suricata = {
  enable = true;
  mode = "af-packet";
  posture = "ips";
  afPacket = { interface = "enp1s0f0"; copyInterface = "enp1s0f1"; };
  offloadInterfaces = ["enp1s0f0" "enp1s0f1"];
};

Kea

Kea DHCPv4/DHCPv6, a thin wrapper over services.kea with sane defaults (bound interfaces + a persistent memfile lease database). Subnets, reservations, and options are identity and come from the fleet through settings, which is deep-merged over the defaults.

Gotcha (Kea 2.6+): every subnet needs a unique mandatory id.

The lease database is persisted at /var/lib/private/kea, where a DynamicUser service keeps it. /var/lib/kea, which the default leasesFile paths go through, is systemd’s symlink to it. A host that moves leasesFile elsewhere persists that path itself.

Options

  options.othrys.services.kea = {
    enable = lib.mkEnableOption "Kea DHCP server";

    dhcp4 = mkPool "4";
    dhcp6 = mkPool "6";
  };

Usage

othrys.services.kea = {
  enable = true;
  dhcp4 = {
    interfaces = ["br-lan"];
    settings.subnet4 = [{
      id = 1;
      subnet = "10.0.0.0/24";
      pools = [{ pool = "10.0.0.100 - 10.0.0.240"; }];
      option-data = [
        { name = "routers"; data = "10.0.0.1"; }
        { name = "domain-name-servers"; data = "10.0.0.1"; }
      ];
    }];
  };
};

Unbound

Unbound recursive DNS, a thin wrapper over services.unbound with helpers for listen interfaces, per-subnet access control, DNS-over-TLS upstream forwarding, and RPZ blocklists. Anything else goes through settings (freeform unbound.conf), deep-merged over the generated config.

Each rpz zone is given a zonefile in the state directory, so the fetched blocklist is written to disk and loaded from there at the next start rather than transferred again. The state directory, /var/lib/unbound by default, holds those zonefiles and the root trust anchor and is persisted under impermanence for the unbound account.

accessControl defaults to loopback plus the subnet of every address in interfaces, a /24 for IPv4 and a /64 for IPv6, so a resolver bound to a LAN address answers that LAN without a second option. Upstream’s own default allows loopback alone. A wildcard address or an interface name derives nothing, and a host that listens on one sets accessControl itself.

Every rpz source must use https://, and an assertion refuses any other scheme, since the zone rewrites answers for every client of the resolver. A non-empty rpz also sets server.module-config to respip validator iterator, because Unbound serves a response policy zone through the respip module and unbound-checkconf rejects the configuration without it. The value is set with mkDefault, so a host’s own module-config wins.

Options

  options.othrys.services.unbound = {
    enable = lib.mkEnableOption "Unbound recursive DNS";

    interfaces = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = [];
      example = ["10.0.0.1" "127.0.0.1"];
      description = "Addresses Unbound listens on (server.interface). Replaces upstream's loopback default, so list loopback when it should stay.";
    };

    accessControl = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = derivedAccessControl;
      defaultText = lib.literalMD "loopback, then the /24 of each IPv4 address and the /64 of each IPv6 address in `interfaces`";
      example = ["10.0.0.0/24 allow"];
      description = ''
        server.access-control entries (subnet + action). The default is
        derived from `interfaces`, so a host that listens on `10.0.0.1`
        answers `10.0.0.0/24` without further setup. A wildcard address or an
        interface name in `interfaces` derives nothing, so a host using one
        sets this itself.
      '';
    };

    forwardTls = {
      enable = lib.mkOption {
        type = lib.types.bool;
        default = false;
        description = "Forward all queries to the DoT upstreams over TLS (port 853), instead of recursing.";
      };

      upstreams = lib.mkOption {
        type = lib.types.listOf lib.types.str;
        default = [
          "1.1.1.1@853#cloudflare-dns.com"
          "1.0.0.1@853#cloudflare-dns.com"
          "9.9.9.9@853#dns.quad9.net"
        ];
        description = "DoT upstream resolvers (addr@853#hostname).";
      };
    };

    rpz = lib.mkOption {
      type = lib.types.listOf rpzType;
      default = [];
      description = "RPZ blocklist zones (ad/malware blocking). Each `url` must use `https://`, and the respip module is added to server.module-config when the list is non-empty.";
      example = lib.literalExpression ''
        [{ name = "hagezi"; url = "https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/rpz/pro.txt"; }]
      '';
    };

    settings = lib.mkOption {
      type = lib.types.attrsOf lib.types.anything;
      default = {};
      description = "Extra unbound.conf settings, deep-merged over (and overriding) the generated config.";
    };
  };

Usage

othrys.services.unbound = {
  enable = true;
  interfaces = ["10.0.0.1" "127.0.0.1"];
  accessControl = ["10.0.0.0/24 allow"];
  forwardTls.enable = true;   # DoT to Cloudflare + Quad9 by default
  rpz = [{
    name = "hagezi";
    url = "https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/rpz/pro.txt";
  }];
};

Restic

Scheduled restic backups, one entry per named backup (maps to services.restic.backups.<name>). Every credential-bearing field is a runtime file path sourced from a secrets provider (e.g. sops), never an inline value or a /nix/store path. Use passwordFile, repositoryFile, environmentFile, and rcloneConfigFile. Use plain repository only for non-sensitive locations (a local disk path). The value is written to the unit file in the store, so an assertion refuses a repository URL that carries a credential. That is user:password@ under any scheme, anything before the @ of an http or https URL, where a lone token is a credential too, and a query parameter named for a token, a key, a secret, a password or a signature. An sftp://user@host URL names a login and no secret, and is accepted.

initialize is on by default and creates the repository on the first run when none exists. Where several hosts share one repository, one host keeps it on and the rest set initialize = false. Two first runs can otherwise both initialise the repository, and a host pointed at the wrong location creates an empty repository there instead of failing.

Options

  options.othrys.services.restic = {
    enable = lib.mkEnableOption "Restic backups";

    backups = lib.mkOption {
      type = lib.types.attrsOf backupType;
      default = {};
      description = "Named restic backups (maps to services.restic.backups.<name>).";
    };
  };

Usage

othrys.services.restic.enable = true;
othrys.services.restic.backups.headscale = {
  paths = ["/var/lib/headscale"];
  # Repository URL and password come from sops (runtime files, not the store):
  repositoryFile = config.sops.secrets."backup/repo-url".path;
  passwordFile   = config.sops.secrets."backup/repo-password".path;
  # Backend credentials (S3/B2/SFTP key, etc.):
  environmentFile = config.sops.secrets."backup/env".path;

  timerConfig = { OnCalendar = "daily"; RandomizedDelaySec = "1h"; Persistent = true; };
  pruneOpts = ["--keep-daily 7" "--keep-weekly 4" "--keep-monthly 6"];

  # Application-consistent snapshot (quiesce before, resume after):
  backupPrepareCommand = "systemctl stop myservice";
  backupCleanupCommand = "systemctl start myservice";
};

Secrets themselves are declared by the consuming fleet (via othrys.system.secrets and sops), and this module only accepts the resulting file paths.

Integrity checking

runCheck is on by default, so every backup ends with restic check and a damaged repository fails the backup unit. The default checkOpts is --read-data-subset=5%, which reads a random twentieth of the pack data on each run. That read is billed by remote backends, so set runCheck = false or change checkOpts where it costs too much.

Plain restic check, which is what an empty checkOpts runs, verifies repository structure, meaning index consistency and pack existence and size, but never reads pack contents, so in-place bit corruption of backed-up data passes it silently. Content verification requires --read-data, which downloads and cryptographically verifies every pack. For repositories where a full read per run is too expensive (remote backends, large repos), --read-data-subset verifies a rotating fraction each run and still covers the whole repository over time:

othrys.services.restic.backups.headscale = {
  # ...
  # Verify a random 10% of pack data on each run, at a tenth of the
  # download cost of a full read:
  checkOpts = ["--read-data-subset=10%"];
};

On a fast local repository, checkOpts = ["--read-data"] buys full content verification on every run.

With Notify on, a failed unit is reported through restic-notify-failure@, and the message says which part failed. A failed check after a completed backup is reported as a failed repository check, which means the new snapshot exists. Anything earlier is reported as a failed backup. The module runs the check as a step of its own to tell the two apart, and that step exits with status 90 when restic check fails.

Tailscale

The Tailscale client, wrapping services.tailscale, with a persisted state directory under impermanence and the UDP port open by default so peers reach the host directly. Two of upstream’s hooks carry the options.

baseURL is the control server, passed as --login-server to tailscale up by the automatic registration that authKeyFile turns on. A host registered by hand passes the same URL to tailscale up itself, and the module warns when baseURL is set with no key file so that step is not forgotten. The key file is a secrets-provider path holding a pre-auth key from the control server.

acceptRoutes, acceptDns, ssh and operator are passed to tailscale set by a unit that runs on every host after the daemon is up, so they apply however the host was registered. acceptRoutes is off by default, since installing routes advertised by other nodes trusts those nodes with this host’s traffic.

On a router host the module also opens its port on the WAN interface by name, since the router accepts the global firewall lists on every interface but the WAN.

On nix-darwin

darwinModules.default carries the module, and it runs tailscaled through nix-darwin’s services.tailscale. nix-darwin has no unit that runs tailscale up with a key or tailscale set after the daemon starts, so a darwin host refuses authKeyFile, baseURL, ssh, acceptRoutes, operator, ephemeral and acceptDns = false. tailscaled keeps the settings in its state, so the host passes the matching flags to tailscale up once by hand. The firewall nix-darwin manages takes no port list, so openFirewall has nothing to open, and there is no impermanence to persist the state through.

Options

  options.othrys.services.tailscale = {
    enable = lib.mkEnableOption "Tailscale VPN mesh networking";

    authKeyFile = lib.mkOption {
      type = lib.types.nullOr othrysTypes.secretPath;
      default = null;
      description = "Path to auth key file for automatic registration.";
    };

    baseURL = lib.mkOption {
      type = lib.types.nullOr lib.types.str;
      default = null;
      description = ''
        Control server the node registers with, passed as `--login-server`
        to `tailscale up` by the automatic registration, which `authKeyFile`
        turns on. A host registered by hand passes the same URL to
        `tailscale up` itself, and the module warns when this is set with no
        key file so that is not forgotten.
      '';
      example = "https://headscale.example.com";
    };

    ssh = lib.mkEnableOption "Tailscale SSH server (note: bypasses OpenSSH hardening and fail2ban)";

    acceptRoutes = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = ''
        Pass --accept-routes: install subnet routes advertised by OTHER
        tailnet nodes. A trust decision, since a compromised or misconfigured
        peer can redirect this host's traffic, which is why it is off until a
        host that needs advertised subnets turns it on.
      '';
    };

    operator = lib.mkOption {
      type = lib.types.nullOr lib.types.str;
      default = null;
      example = "alice";
      description = ''
        User allowed to drive `tailscale` without root, passed as
        `--operator`. Null leaves the CLI to root.
      '';
    };

    acceptDns = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = ''
        Pass --accept-dns=true: let the tailnet control the host's DNS
        configuration (MagicDNS). Set to false on hosts running their own
        resolver (unbound, the router module) or needing split-horizon DNS, since
        tailnet DNS would override it.
      '';
    };

    openFirewall = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = "Open the Tailscale UDP port for direct (non-relayed) connections.";
    };

    ephemeral = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = ''
        Register as an ephemeral node (deregistered when offline). Usually
        false for persistent machines. Applies to a node on Tailscale's own
        control plane, where it is a parameter of an OAuth client key; with
        `baseURL` set, the pre-auth key minted on that server decides.
      '';
    };
  };

Usage

othrys.services.tailscale = {
  enable = true;
  baseURL = "https://headscale.example.com";
  authKeyFile = config.sops.secrets."tailscale/preauth".path;
  acceptDns = false;   # the host runs its own resolver
};

Mosh

othrys.services.mosh installs Mosh, the mobile shell, which keeps a session open through sleep and a change of network. A client logs in over SSH and starts mosh-server on the remote host, and the session then runs over UDP. enable is the same on a server and on a client.

othrys.services.mosh.enable = true;

On NixOS the module turns on programs.mosh, and with openFirewall, which is on by default, it opens UDP 60000 to 61000 in the NixOS firewall. That is the range mosh-server picks its port from. The module turns on no SSH server. The client reaches mosh-server through SSH, so a server host also runs sshd, which othrys.services.ssh.server.enable provides.

A client host enables the same option to get the mosh command, and then connects with mosh alice@host.example.com. A host that only connects out sets openFirewall = false and keeps the UDP range closed.

On nix-darwin

darwinModules.default carries the module, and it puts mosh on the system path. sshd runs mosh-server through the account’s shell with -c, a shell that is neither a login nor interactive. zsh reads nix-darwin’s /etc/zshenv even then, and that file puts the system profile on PATH, so for an account whose shell is zsh nothing else runs on the Mac. A non-interactive bash reads no such file, so a client reaching an account with another shell passes mosh --server=/run/current-system/sw/bin/mosh-server. The firewall nix-darwin manages takes no port list, so openFirewall is unread there. A host that turns on the macOS application firewall allows mosh-server through it.

Options

  options.othrys.services.mosh = {
    enable = lib.mkEnableOption "Mosh server and client";

    openFirewall = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = ''
        Open UDP 60000 to 61000, the range mosh-server picks its port from,
        in the NixOS firewall. A host that only connects out to other hosts
        turns it off. nix-darwin's firewall takes no port list, so it is
        unread there.
      '';
    };
  };

Headscale

Headscale is a self-hosted implementation of the Tailscale control server, the coordination plane the Tailscale module points its baseURL at. A thin wrapper over services.headscale with helpers for the public URL, listen socket, MagicDNS and OIDC, while anything else goes through settings (freeform config.yaml), deep-merged over the generated config. The OIDC client secret is a runtime file path from a secrets provider, never an inline value.

An optional web UI (Headplane) is bundled under ui. Headplane was chosen over the static-SPA UIs (headscale-ui, headscale-admin) on two axes: nixpkgs ships a native services.headplane module (no extra flake input to carry), and it holds the Headscale API key, cookie secret, and OIDC secret server-side as file paths, since the SPAs park a full-privilege API key in browser localStorage. Enabling ui reuses this instance’s generated config, port, and user automatically, so you supply only the listen socket and a couple of secret paths. OIDC SSO is the recommended (server-side-custody) login mode, without it Headplane falls back to its in-browser API-key login.

Options

  options.othrys.services.headscale = {
    enable = lib.mkEnableOption "Headscale self-hosted Tailscale control server";

    serverUrl = lib.mkOption {
      type = lib.types.str;
      example = "https://headscale.example.com";
      description = ''
        Public URL clients register against (settings.server_url). Mandatory, with
        no default.
        Must resolve to this host (typically via a TLS-terminating reverse proxy)
        and must differ from the MagicDNS `baseDomain`.
      '';
    };

    address = lib.mkOption {
      type = lib.types.str;
      default = "127.0.0.1";
      description = "Address Headscale listens on. Defaults to loopback, expecting a reverse proxy in front; set to 0.0.0.0 to expose it directly.";
    };

    port = lib.mkOption {
      type = lib.types.port;
      default = 8080;
      description = "Port Headscale listens on.";
    };

    openFirewall = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = "Open `port` in the firewall. Leave off when a reverse proxy fronts Headscale (the default).";
    };

    magicDns = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = "Enable MagicDNS (settings.dns.magic_dns).";
    };

    baseDomain = lib.mkOption {
      type = lib.types.nullOr lib.types.str;
      default = null;
      example = "tailnet.example.com";
      description = "MagicDNS base domain (settings.dns.base_domain), an FQDN without a trailing dot. Must differ from the `serverUrl` host. Null leaves it unset.";
    };

    nameservers = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = [];
      example = ["1.1.1.1" "9.9.9.9"];
      description = "Global nameservers pushed to clients (settings.dns.nameservers.global).";
    };

    oidc = {
      enable = lib.mkEnableOption "OIDC authentication for node registration";

      issuer = lib.mkOption {
        type = lib.types.str;
        default = "";
        example = "https://auth.example.com/realms/main";
        description = "OIDC issuer URL (settings.oidc.issuer).";
      };

      clientId = lib.mkOption {
        type = lib.types.str;
        default = "";
        example = "headscale";
        description = "OIDC client ID (settings.oidc.client_id).";
      };

      clientSecretFile = lib.mkOption {
        type = lib.types.nullOr othrysTypes.secretPath;
        default = null;
        example = lib.literalExpression ''config.sops.secrets."headscale/oidc-secret".path'';
        description = ''
          Path to a runtime file holding the OIDC client secret (a
          secrets-provider path). Never inline the secret. Headscale reads it
          as its own user, so the file must be readable by `headscale`; with
          sops-nix that is `owner = "headscale"` on the secret.
        '';
      };

      allowedDomains = lib.mkOption {
        type = lib.types.listOf lib.types.str;
        default = [];
        example = ["example.com"];
        description = "Email domains whose accounts may register (settings.oidc.allowed_domains).";
      };

      allowedUsers = lib.mkOption {
        type = lib.types.listOf lib.types.str;
        default = [];
        example = ["alice@example.com"];
        description = "Accounts that may register (settings.oidc.allowed_users).";
      };

      allowedGroups = lib.mkOption {
        type = lib.types.listOf lib.types.str;
        default = [];
        example = ["tailnet"];
        description = ''
          Groups whose members may register (settings.oidc.allowed_groups).
          The issuer has to put a groups claim in the token for this to apply.

          With none of the three lists set, every account the issuer knows
          can register a node, and the module warns about it.
        '';
      };
    };

    policy = lib.mkOption {
      type = lib.types.nullOr (lib.types.either lib.types.path (lib.types.attrsOf lib.types.anything));
      default = null;
      example = lib.literalExpression ''
        {
          acls = [
            {
              action = "accept";
              src = ["group:admins"];
              dst = ["*:*"];
            }
          ];
          groups."group:admins" = ["alice@example.com"];
        }
      '';
      description = ''
        The tailnet ACL policy (settings.policy), as a path to a HuJSON file
        or as an attribute set written out as JSON. Null leaves Headscale on
        its default, which lets every node reach every other node. The
        policy is not a secret and lives in the store.
      '';
    };

    settings = lib.mkOption {
      type = lib.types.attrsOf lib.types.anything;
      default = {};
      description = "Extra config.yaml settings, deep-merged over (and overriding) the generated config.";
    };

    ui = {
      enable = lib.mkEnableOption "Headplane web UI for this Headscale instance (server-side API-key custody, OIDC SSO)";

      package = lib.mkOption {
        type = lib.types.nullOr lib.types.package;
        default = null;
        defaultText = lib.literalExpression "pkgs.headplane";
        description = "Headplane package override. Null uses pkgs.headplane (the nixpkgs default for services.headplane).";
      };

      host = lib.mkOption {
        type = lib.types.str;
        default = "127.0.0.1";
        description = "Address Headplane listens on. Loopback by default, expecting a reverse proxy in front.";
      };

      port = lib.mkOption {
        type = lib.types.port;
        default = 3000;
        description = "Port Headplane listens on.";
      };

      openFirewall = lib.mkOption {
        type = lib.types.bool;
        default = false;
        description = "Open the UI `port` in the firewall. Leave off when a reverse proxy fronts Headplane (the default).";
      };

      apiKeyFile = lib.mkOption {
        type = lib.types.nullOr othrysTypes.secretPath;
        default = null;
        example = lib.literalExpression ''config.sops.secrets."headscale/headplane-apikey".path'';
        description = ''
          Path to a runtime file holding a Headscale API key (from
          `headscale apikeys create`). Written to Headplane's
          `headscale.api_key_path`, which it uses server-side to mint OIDC
          sessions, so it is required when `ui.oidc` is enabled. Without it,
          Headplane authenticates via its in-browser API-key login and this
          is unused. Use a secrets-provider path readable by the `headscale`
          user, which Headplane runs as.
        '';
      };

      cookieSecretFile = lib.mkOption {
        type = lib.types.nullOr othrysTypes.secretPath;
        default = null;
        example = lib.literalExpression ''config.sops.secrets."headscale/headplane-cookie".path'';
        description = "Path to a runtime file holding the cookie-signing secret (a random string). Required when the UI is enabled. Use a secrets-provider path readable by the `headscale` user.";
      };

      configPath = lib.mkOption {
        type = lib.types.nullOr lib.types.path;
        default = null;
        defaultText = lib.literalExpression "config.services.headscale.configFile";
        description = "Path to the Headscale config.yaml Headplane reads. Null uses the NixOS-generated config file for this instance.";
      };

      oidc = {
        enable = lib.mkEnableOption "OIDC SSO for Headplane admin login";

        issuer = lib.mkOption {
          type = lib.types.str;
          default = "";
          example = "https://auth.example.com/realms/main";
          description = "OIDC issuer URL for Headplane login.";
        };

        clientId = lib.mkOption {
          type = lib.types.str;
          default = "";
          example = "headplane";
          description = "OIDC client ID for Headplane.";
        };

        clientSecretFile = lib.mkOption {
          type = lib.types.nullOr othrysTypes.secretPath;
          default = null;
          example = lib.literalExpression ''config.sops.secrets."headscale/headplane-oidc".path'';
          description = "Path to a runtime file holding Headplane's OIDC client secret. Never inline the secret. Readable by the `headscale` user.";
        };

        disableApiKeyLogin = lib.mkOption {
          type = lib.types.bool;
          default = true;
          description = "Disable the fallback API-key login form once OIDC is configured, enforcing SSO-only admin access.";
        };
      };

      settings = lib.mkOption {
        type = lib.types.attrsOf lib.types.anything;
        default = {};
        description = "Extra Headplane settings, deep-merged over (and overriding) the generated config.";
      };
    };
  };

Usage

othrys.services.headscale = {
  enable = true;
  serverUrl = "https://headscale.example.com";  # public URL, behind a TLS reverse proxy
  baseDomain = "tailnet.example.com";            # MagicDNS suffix (must differ from serverUrl)
  nameservers = ["1.1.1.1" "9.9.9.9"];

  # Optional OIDC, client secret comes from sops (a runtime file, not the store):
  oidc = {
    enable = true;
    issuer = "https://auth.example.com/realms/main";
    clientId = "headscale";
    clientSecretFile = config.sops.secrets."headscale/oidc-secret".path;
  };

  # Optional Headplane web UI (server-side secret custody, OIDC SSO):
  ui = {
    enable = true;
    cookieSecretFile = config.sops.secrets."headscale/headplane-cookie".path;
    apiKeyFile       = config.sops.secrets."headscale/headplane-apikey".path; # `headscale apikeys create`
    oidc = {
      enable = true;
      issuer = "https://auth.example.com/realms/main";
      clientId = "headplane";
      clientSecretFile = config.sops.secrets."headscale/headplane-oidc".path;
    };
  };
};

Put a TLS-terminating reverse proxy in front of both Headscale (serverUrl) and Headplane (which listens on 127.0.0.1:3000 by default); behind a proxy set ui.settings.server.base_url to Headplane’s public URL so OIDC redirects resolve. A node then registers against this server through the Tailscale module’s baseURL and authKeyFile, with a pre-auth key from headscale preauthkeys create; see Tailscale.

With OIDC on and none of oidc.allowedDomains, allowedUsers or allowedGroups set, every account the issuer knows can register a node, and the module warns about it. Set at least one. policy is the tailnet ACL, as a HuJSON file or an attribute set written out as JSON; without it every node reaches every other node.

Headscale and Headplane both run as the headscale user, so every secret file named above has to be readable by it, which with sops-nix is owner = "headscale" on the secret. Headscale’s default port, 8080, is also the default of Scrutiny’s web UI and of the CrowdSec local API, and Headplane’s default, 3000, is the documentation server’s; the module refuses each clash on the same host.

Printing

CUPS with the Gutenprint drivers, and optionally Avahi for printer discovery. CUPS listens on localhost:631 unless listenAddresses names another address, and openFirewall opens the TCP ports of those addresses. A print server reached from other hosts also sets services.printing.allowFrom, which the module leaves at upstream’s localhost.

Options

  options.othrys.services.printing = {
    enable = lib.mkEnableOption "CUPS printing service";

    avahi = lib.mkEnableOption "Avahi for network printer discovery";

    listenAddresses = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = ["localhost:631"];
      example = ["*:631"];
      description = ''
        Addresses and ports CUPS listens on (services.printing.listenAddresses).
        The default is loopback only. A print server reached from other
        hosts lists an address here and also sets
        `services.printing.allowFrom`, which stays at upstream's `localhost`.
      '';
    };

    openFirewall = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = "Open the TCP ports named in `listenAddresses` in the firewall (services.printing.openFirewall).";
    };
  };

Mounts

Non-system filesystem mounts, grouped under othrys.services.mounts.*.

Disks

Additional local disk mounts (NTFS, ext4, btrfs, xfs, vfat).

NTFS and vfat store no Unix owner, so both are mounted with uid, gid, dmask and fmask from the device’s options. The defaults are uid 1000 and gid 100, which is the first account on a NixOS host and the users group. The two masks are octal strings of three or four digits, and anything else is a type error. ext4, btrfs and xfs carry their own ownership and take none of the four.

Every filesystem type is mounted with nosuid and nodev, since these are data disks and a data disk is not where a setuid binary or a device node belongs. A disk that does hold them, such as one carrying a container store or a chroot, sets allowSuid or allowDev on its device.

othrys.services.mounts.disks.devices.containers = {
  device = "/dev/disk/by-uuid/abcd1234-5678-90ab-cdef";
  mountPoint = "/var/lib/containers";
  fsType = "ext4";
  allowSuid = true;
  allowDev = true;
};

Options

  options.othrys.services.mounts.disks = {
    enable = lib.mkEnableOption "additional disk mounts";

    devices = lib.mkOption {
      type = lib.types.attrsOf diskType;
      default = {};
      description = "Disk mount configurations.";
      example = lib.literalExpression ''
        {
          data = {
            device = "/dev/disk/by-uuid/0123456789ABCDEF";
            mountPoint = "/mnt/data";
            fsType = "ntfs-3g";
          };
          backup = {
            device = "/dev/disk/by-uuid/abcd1234-5678-90ab-cdef";
            mountPoint = "/mnt/backup";
            fsType = "ext4";
          };
        }
      '';
    };
  };

CIFS

CIFS/SMB network share mounts. Credentials files are generated from sops templates containing username/password pairs.

The files of a share belong to the primary user and that user’s group on a host with othrys.system.users.enable. The account’s uid is passed when the host declares one, and its name otherwise, which mount.cifs resolves at mount time. uid and gid on a share replace either, as a number or a name. A host that manages no account has nothing to default to, and an assertion asks for both there.

Every share is mounted with nosuid and nodev. Three options set what crosses the network:

  • vers defaults to "3.1.1", which pins the newest SMB dialect so a server cannot negotiate the mount down. An older NAS needs the dialect it speaks, and "default" hands the choice back to the kernel.
  • seal defaults to true and encrypts the session. Authentication protects the password only, and without seal file contents travel in the clear. Encryption needs SMB 3.0 or newer, so seal with vers below "3.0" fails evaluation.
  • sec takes one of none, krb5, krb5i, ntlmv2, ntlmv2i, ntlmssp and ntlmsspi, and any other value is a type error.

Options

  options.othrys.services.mounts.cifs = {
    enable = lib.mkEnableOption "CIFS/SMB network share mounts";

    shares = lib.mkOption {
      type = lib.types.attrsOf shareType;
      default = {};
      description = "CIFS/SMB shares to mount, keyed by mount name.";
    };
  };

Monitoring

A Prometheus server and a node exporter on one host. The exporter runs a curated set of collectors covering systemd units, processes, CPU, memory, disks, filesystems and the network, and extraCollectors adds to that set. Prometheus scrapes the exporter under the job name node-exporter and itself under prometheus, each labelled with the host name as instance.

Both listeners bind listenAddress, which is loopback by default, and the scrape targets follow it when it names one interface. openFirewall opens both ports for a Grafana that runs on another host. On an impermanence host the TSDB under /var/lib is persisted, since retentionTime describes a window a wiped root would otherwise empty at every boot.

Options

  options.othrys.services.monitoring = {
    enable = lib.mkEnableOption "Prometheus monitoring";

    listenAddress = lib.mkOption {
      type = lib.types.str;
      default = "127.0.0.1";
      description = "Address Prometheus and the node exporter bind to.";
    };

    port = lib.mkOption {
      type = lib.types.port;
      default = 9090;
      description = "Prometheus server port.";
    };

    nodePort = lib.mkOption {
      type = lib.types.port;
      default = 9100;
      description = "Node exporter port.";
    };

    openFirewall = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = "Open firewall ports for external Grafana access.";
    };

    retentionTime = lib.mkOption {
      type = lib.types.str;
      default = "15d";
      example = "90d";
      description = "Prometheus metric retention (dedicated monitoring hosts usually want more than the 15d default).";
    };

    extraCollectors = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = [];
      example = ["ethtool" "smartctl"];
      description = "Node-exporter collectors enabled in addition to the curated base set.";
    };
  };

Usage

othrys.services.monitoring = {
  enable = true;
  retentionTime = "90d";
  extraCollectors = ["ethtool"];
};

VictoriaMetrics

VictoriaMetrics is a fast, resource-efficient time-series database with a Prometheus-compatible API (scrape, remote-write, MetricsQL). A thin wrapper over services.victoriametrics: loopback by default (reverse proxy in front), retention exposed as policy, and an optional scrape of the node exporter the Monitoring module runs, so enabling both wires them together automatically.

The stores, Grafana, alerting and the journal upload all run on one host and find each other through listenAddress. A store moved to one interface is scraped and queried at that address, while a store on every interface (0.0.0.0 or ::) is reached over loopback, so the scrape targets and datasources follow the listener wherever it is bound. The node exporter is scraped under the job name node-exporter, which is the job label the starter alert rules and any dashboard see.

Options

  options.othrys.services.victoriametrics = {
    enable = lib.mkEnableOption "VictoriaMetrics single-node time-series database (Prometheus-compatible)";

    listenAddress = lib.mkOption {
      type = lib.types.str;
      default = "127.0.0.1";
      description = "Address VictoriaMetrics listens on. Loopback by default, expecting a reverse proxy in front; set to 0.0.0.0 to expose it directly.";
    };

    port = lib.mkOption {
      type = lib.types.port;
      default = 8428;
      description = "Port VictoriaMetrics listens on (HTTP API: scrape, remote-write, query).";
    };

    openFirewall = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = "Open `port` in the firewall. Leave off when a reverse proxy fronts VictoriaMetrics (the default).";
    };

    retentionPeriod = lib.mkOption {
      type = lib.types.nullOr lib.types.str;
      default = null;
      example = "1y";
      description = "How long to retain samples (suffixes s/h/d/w/y, a bare number is months). Null uses the upstream default (1 month), and long-term storage hosts usually want more.";
    };

    scrapeNodeExporter = lib.mkOption {
      type = lib.types.bool;
      default = monitoringCfg.enable;
      defaultText = lib.literalExpression "config.othrys.services.monitoring.enable";
      description = "Scrape the local node exporter (at othrys.services.monitoring.nodePort). Follows the monitoring module by default so enabling both wires them together.";
    };

    scrapeConfigs = lib.mkOption {
      type = lib.types.listOf (lib.types.attrsOf lib.types.anything);
      default = [];
      example = lib.literalExpression ''
        [
          {
            job_name = "headscale";
            static_configs = [{targets = ["127.0.0.1:9090"];}];
          }
        ]
      '';
      description = "Additional Prometheus-style scrape configs appended to the generated set.";
    };

    extraFlags = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = [];
      example = ["-dedup.minScrapeInterval=15s"];
      description = "Extra command-line flags passed to VictoriaMetrics.";
    };
  };

Usage

othrys.services.victoriametrics = {
  enable = true;
  retentionPeriod = "1y";
  scrapeConfigs = [
    {
      job_name = "headscale";
      static_configs = [{targets = ["127.0.0.1:9090"];}];
    }
  ];
};

VictoriaLogs

VictoriaLogs is the log database from the VictoriaMetrics family (LogsQL queries, minimal footprint). The host’s systemd journal ships to it natively via systemd-journal-upload with no extra agent.

The log store is persisted at /var/lib/private/victorialogs, where a DynamicUser service keeps it. The uploader’s cursor is persisted beside it at /var/lib/private/systemd/journal-upload when collectJournal is on. The journal itself survives a reboot, so a lost cursor would have the uploader send every entry a second time.

Options

  options.othrys.services.victorialogs = {
    enable = lib.mkEnableOption "VictoriaLogs log database (LogsQL, journald ingestion)";

    listenAddress = lib.mkOption {
      type = lib.types.str;
      default = "127.0.0.1";
      description = "Address VictoriaLogs listens on. Loopback by default, expecting a reverse proxy in front.";
    };

    port = lib.mkOption {
      type = lib.types.port;
      default = 9428;
      description = "Port VictoriaLogs listens on (HTTP API: ingestion and LogsQL queries).";
    };

    openFirewall = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = "Open `port` in the firewall. Leave off when a reverse proxy fronts VictoriaLogs (the default).";
    };

    retentionPeriod = lib.mkOption {
      type = lib.types.nullOr lib.types.str;
      default = null;
      example = "12w";
      description = "How long to retain logs (suffixes: h/d/w/y; a bare number is months). Null uses the upstream default (7 days).";
    };

    collectJournal = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = "Ship this host's systemd journal into VictoriaLogs via systemd-journal-upload.";
    };

    extraFlags = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = [];
      description = "Extra command-line flags passed to VictoriaLogs.";
    };
  };

Grafana

Dashboards over the othrys stores. Datasources are auto-provisioned from whichever stores are enabled on the same host (Monitoring’s Prometheus, VictoriaMetrics, and VictoriaLogs, the last with its datasource plugin installed, since that type is not built into Grafana). Enabling Grafana beside any of them wires them together with zero configuration.

Two secrets arrive as runtime file paths, both readable by the grafana user, which with sops-nix is owner = "grafana" on each. secretKeyFile is required, since Grafana encrypts stored credentials with it and upstream ships no default. adminPasswordFile is read on first start only, after which the hash lives in the database. Without it Grafana serves the stock admin/admin credential, which the module warns about on a loopback listener and refuses once the listener leaves loopback or openFirewall is on.

A host that exposes Grafana, by setting listenAddress off loopback, must also set rootUrl to the public URL, as https://grafana.example.com/. Grafana builds redirects and OIDC callbacks from it, and the secure flag on the session cookie follows its scheme, so an https:// URL marks the cookie secure and a plain http:// one leaves it off. Sign-up from the login page is off on every host.

Options

  options.othrys.services.grafana = {
    enable = lib.mkEnableOption "Grafana dashboards (datasources auto-provisioned from enabled othrys metrics stores)";

    listenAddress = lib.mkOption {
      type = lib.types.str;
      default = "127.0.0.1";
      description = "Address Grafana listens on. Loopback by default, expecting a reverse proxy in front.";
    };

    port = lib.mkOption {
      type = lib.types.port;
      default = 3001;
      description = "Port Grafana listens on (3001, since the docs server claims 3000 by default).";
    };

    openFirewall = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = "Open `port` in the firewall. Leave off when a reverse proxy fronts Grafana (the default).";
    };

    rootUrl = lib.mkOption {
      type = lib.types.nullOr lib.types.str;
      default = null;
      example = "https://grafana.example.com/";
      description = "Public URL Grafana is reached at, written to `server.root_url`. Redirects, OIDC callbacks and the secure flag on the session cookie follow it, so it must be set when `listenAddress` is not loopback. Null keeps Grafana's default, which names localhost.";
    };

    adminPasswordFile = lib.mkOption {
      type = lib.types.nullOr othrysTypes.secretPath;
      default = null;
      example = lib.literalExpression ''config.sops.secrets."grafana/admin-password".path'';
      description = ''
        Path to a runtime file holding the admin password (a secrets-provider
        path). Grafana reads it as the `grafana` user, so with sops-nix set
        `owner = "grafana"` on the secret. The value is applied when the
        database is first created and ignored afterwards, and the password of
        an existing instance changes with
        `grafana cli admin reset-admin-password`. Null keeps the stock
        admin/admin credential, which the module warns about on loopback and
        refuses when `listenAddress` is not loopback or `openFirewall` is on.
      '';
    };

    secretKeyFile = lib.mkOption {
      type = lib.types.nullOr othrysTypes.secretPath;
      default = null;
      defaultText = lib.literalMD "none, and an assertion rejects an unset value once the module is enabled";
      example = lib.literalExpression ''config.sops.secrets."grafana/secret-key".path'';
      description = ''
        Path to a runtime file holding Grafana's secret_key (encrypts stored
        credentials, so generate a random string). Must be set when this
        module is enabled, since upstream no longer ships a default. Use a
        secrets-provider path, readable by the `grafana` user, which with
        sops-nix is `owner = "grafana"` on the secret.
      '';
    };

    extraDatasources = lib.mkOption {
      type = lib.types.listOf (lib.types.attrsOf lib.types.anything);
      default = [];
      description = "Datasources provisioned in addition to the auto-detected othrys metrics stores.";
    };

    dashboardsDir = lib.mkOption {
      type = lib.types.nullOr lib.types.path;
      default = null;
      description = "Directory of dashboard JSON files to provision (fleet-provided).";
    };
  };

Scrutiny

Scrutiny keeps every S.M.A.R.T. reading in InfluxDB and judges disks against observed failure rates, which is how a slowly dying disk shows months before smartd alarms. The module has a hub-and-spoke shape: a hub (enable) runs the web UI, InfluxDB and a collector for its own disks; a satellite runs collector.enable with collector.endpoint pointing at the hub.

The hub’s web UI and collector API have no authentication of their own: anyone who reaches the port reads every disk and can post readings. The hub listens on loopback by default, and the module warns when it is moved off loopback or its port is opened. Its default port, 8080, is also the CrowdSec local API’s and Headscale’s, and the module refuses that clash on one host. Failures of the collector are routed to notify-failure@ when notify is on.

collector.endpoint is written to the collector’s unit and configuration in the store, so a URL with a user, a password or a token ahead of the host fails an assertion. Upstream types the endpoint as a plain string and has no file form for it. A satellite whose hub sits behind a proxy that asks for credentials sets collector.environmentFile to a secrets-provider file with the line COLLECTOR_API_ENDPOINT=https://user:password@scrutiny.example.com, which replaces endpoint when the collector runs.

othrys.services.scrutiny.collector = {
  enable = true;
  endpoint = "https://scrutiny.example.com";
  environmentFile = config.sops.secrets."scrutiny/collector-env".path;
};

The state directory is persisted at /var/lib/private/scrutiny, where a DynamicUser service keeps it.

Options

  options.othrys.services.scrutiny = {
    enable = lib.mkEnableOption "the Scrutiny hub: web UI + InfluxDB, and a collector for this host's own disks";

    listenAddress = lib.mkOption {
      type = lib.types.str;
      default = "127.0.0.1";
      description = "Address the web UI listens on. Loopback by default, expecting a reverse proxy in front; satellites then report in through the proxied URL.";
    };

    port = lib.mkOption {
      type = lib.types.port;
      default = 8080;
      description = "Port the web UI (and collector API) listens on.";
    };

    openFirewall = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = "Open `port` in the firewall. Leave off when a reverse proxy fronts the web UI (the default).";
    };

    notifyUrls = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default =
        lib.optional (notifyCfg.enable && notifyCfg.url != null && notifyCfg.tokenFile == null && !config.othrys.internal.notifyRefusedLocally)
        (ntfyShoutrrr notifyCfg.url notifyCfg.topic);
      defaultText = lib.literalExpression "the othrys.services.notify endpoint as a shoutrrr ntfy URL, when notify is enabled, unauthenticated and not refused by the ntfy server on this host; else []";
      example = ["ntfy://ntfy.example.com/alerts"];
      description = "shoutrrr URLs Scrutiny pushes device-failure notifications to. Follows the fleet notify channel by default. A token-authenticated notify endpoint is NOT auto-wired (the token would end up world-readable in the rendered config). Pass an explicit URL instead. Nothing is wired either when notify points at the ntfy server on this host with no token while that server denies anonymous clients, since every push would be refused.";
    };

    collector = {
      enable = lib.mkOption {
        type = lib.types.bool;
        default = cfg.enable;
        defaultText = lib.literalExpression "config.othrys.services.scrutiny.enable";
        description = "Run the smartctl collector on this host. Follows `enable` (a hub watches its own disks); set alone on satellite hosts, with `endpoint`.";
      };

      endpoint = lib.mkOption {
        type = lib.types.nullOr lib.types.str;
        default = null;
        example = "https://scrutiny.example.com";
        description = ''
          Scrutiny API base URL the collector reports to. Null means the local
          web UI, which suits a hub, and a satellite must set it. The value
          is written to the collector's unit and configuration in the store,
          so a URL with a user, password or token before the host is refused.
          A hub behind a proxy that asks for credentials is reached through
          `environmentFile`.
        '';
      };

      environmentFile = lib.mkOption {
        type = lib.types.nullOr othrysTypes.secretPath;
        default = null;
        example = lib.literalExpression ''config.sops.secrets."scrutiny/collector-env".path'';
        description = ''
          Environment file read by the collector unit, a secrets-provider
          path. A line `COLLECTOR_API_ENDPOINT=https://user:password@scrutiny.example.com`
          in it replaces `endpoint` at run time, which is how the collector
          authenticates to a hub behind a proxy without the credentials
          entering the store. Upstream types the endpoint as a plain string
          and has no file form for it.
        '';
      };

      schedule = lib.mkOption {
        type = lib.types.str;
        default = "daily";
        description = "systemd calendar expression for collector runs. Daily is enough, since smartd covers the fast alarms and this feeds the trend history.";
      };

      hostId = lib.mkOption {
        type = lib.types.str;
        default = config.networking.hostName;
        defaultText = lib.literalExpression "config.networking.hostName";
        description = "Label the web UI groups this host's disks under.";
      };
    };
  };

Alerting

Rule evaluation via vmalert, datasource-agnostic (any Prometheus-compatible API, with the local VictoriaMetrics or Prometheus auto-discovered). Delivery flows to Notify through an internal alertmanager → alertmanager-ntfy chain (loopback implementation details, while the consumer surface is rules in, phone notifications out). Ships curated starter rules (instance down, disk space, memory pressure) that can be disabled or extended.

The internal chain’s alertmanager keeps its silences and notification log at /var/lib/private/alertmanager, where a DynamicUser service keeps it, and the module persists that directory under impermanence. A host that names its own notifierUrls runs no alertmanager and persists nothing here.

The rendered rule file is parsed with vmalert -dryRun while the system is built, so a rule group, an expression or an annotation template that does not parse fails the build instead of stopping the unit on the host. No datasource is contacted. checkRules = false turns the check off.

Options

  options.othrys.services.alerting = {
    enable = lib.mkEnableOption "alert rule evaluation (vmalert) with ntfy delivery";

    listenAddress = lib.mkOption {
      type = lib.types.str;
      default = "127.0.0.1";
      description = "Address vmalert's HTTP interface listens on.";
    };

    port = lib.mkOption {
      type = lib.types.port;
      default = 8880;
      description = "Port vmalert's HTTP interface listens on.";
    };

    datasourceUrl = lib.mkOption {
      type = lib.types.nullOr lib.types.str;
      # The store runs on this host, so the URL is its listener seen from here
      # (modules/lib/net.nix). 0.0.0.0 is a bind address and not a destination.
      default =
        if vmCfg.enable
        then "http://${local vmCfg.listenAddress}:${toString vmCfg.port}"
        else if monitoringCfg.enable
        then "http://${local monitoringCfg.listenAddress}:${toString monitoringCfg.port}"
        else null;
      defaultText = lib.literalExpression "the local VictoriaMetrics instance when enabled, else the local Prometheus, else null";
      description = "Prometheus-compatible datasource rules are evaluated against. Auto-discovered from the enabled othrys metrics store.";
    };

    notifierUrls = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = [];
      example = ["http://127.0.0.1:9093"];
      description = "Alertmanager endpoints alerts are sent to. Empty with othrys.services.notify enabled runs the internal alertmanager -> ntfy delivery chain.";
    };

    starterRules = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = "Include the curated starter rules (instance down, disk space, memory pressure).";
    };

    ruleGroups = lib.mkOption {
      type = lib.types.listOf (lib.types.attrsOf lib.types.anything);
      default = [];
      description = "Additional Prometheus-style rule groups appended to the starter set.";
    };

    checkRules = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = ''
        Parse the rendered rule file with `vmalert -dryRun` at build time, so
        a rule that does not parse fails the build instead of the service.
        Set to `false` where vmalert cannot run on the build host.
      '';
    };
  };

Ntfy

Self-hosted ntfy push-notification server, the implementation-named server half of the notification pair, related to Notify the way Headscale relates to Tailscale.

Anonymous clients are denied by default (defaultAccess = "deny-all"). ntfy’s own default is read-write, which lets anyone who reaches the port publish to and read every topic, the alert topic included. Access comes from users (name, bcrypt hash from ntfy user hash, role), access (user, topic, permission) and tokensFile, an environment file from the secrets provider holding NTFY_AUTH_TOKENS=user:tk_token:label. A publisher then sets othrys.services.notify.tokenFile to a file holding its token. The same can be done on the host with ntfy user, ntfy access and ntfy token, which write the auth database the module persists.

othrys.services.ntfy = {
  enable = true;
  users = ["fleet:$2a$10$...:user"];
  access = ["fleet:alerts:write-only"];
  tokensFile = config.sops.secrets."ntfy/tokens".path;
};

The state directory is persisted at /var/lib/private/ntfy-sh, which is where a DynamicUser service keeps it; /var/lib/ntfy-sh is systemd’s symlink to it.

Options

  options.othrys.services.ntfy = {
    enable = lib.mkEnableOption "self-hosted ntfy push-notification server";

    listenAddress = lib.mkOption {
      type = lib.types.str;
      default = "127.0.0.1";
      description = "Address ntfy listens on. Loopback by default, expecting a reverse proxy in front; set to 0.0.0.0 to expose it directly.";
    };

    port = lib.mkOption {
      type = lib.types.port;
      default = 2586;
      description = "Port ntfy listens on.";
    };

    openFirewall = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = "Open `port` in the firewall. Leave off when a reverse proxy fronts ntfy (the default).";
    };

    baseUrl = lib.mkOption {
      type = lib.types.str;
      default = "http://${cfg.listenAddress}:${toString cfg.port}";
      defaultText = lib.literalExpression ''"http://''${listenAddress}:''${port}"'';
      example = "https://ntfy.example.com";
      description = "Base URL (upstream requires it; used for attachments and web-app links). The loopback default serves internal notify hosts. Set the public URL when a reverse proxy fronts it.";
    };

    defaultAccess = lib.mkOption {
      type = lib.types.enum ["deny-all" "read-only" "write-only" "read-write"];
      default = "deny-all";
      description = ''
        What a client with no credentials may do on any topic
        (`auth-default-access`). ntfy's own default is `read-write`, which
        lets anyone who reaches the port publish to and read every topic,
        the alert topic included. Access is granted through `users`,
        `access` and `tokensFile`, or through `ntfy user` and `ntfy access`
        on the host.
      '';
    };

    users = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = [];
      example = ["alice:$2a$10$examplehash:user" "fleet:$2a$10$otherhash:user"];
      description = ''
        Accounts to provision, one `name:bcrypt-hash:role` entry each
        (`auth-users`). The hash comes from `ntfy user hash`, and the role is
        `user` or `admin`. A hash is not a password, so it may sit in the
        store; the password itself never goes here.
      '';
    };

    access = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = [];
      example = ["fleet:alerts:write-only" "alice:*:read-write"];
      description = "Access rules, one `user:topic:permission` entry each (`auth-access`), where the user is a name from `users` or `*` for anonymous clients.";
    };

    tokensFile = lib.mkOption {
      type = lib.types.nullOr othrysTypes.secretPath;
      default = null;
      example = lib.literalExpression ''config.sops.secrets."ntfy/tokens".path'';
      description = ''
        Environment file holding `NTFY_AUTH_TOKENS=user:tk_token:label,...`,
        which provisions access tokens for the accounts in `users`. A token
        is a credential, so it comes from a secrets provider and never from
        the store. The publishers then set `othrys.services.notify.tokenFile`
        to a file holding their token.
      '';
    };

    settings = lib.mkOption {
      type = lib.types.attrsOf lib.types.anything;
      default = {};
      description = "Extra services.ntfy-sh settings (server.yml), deep-merged over (and overriding) the generated config.";
    };
  };

Notify

Host notification dispatch: the othrys-notify CLI and a notify-failure@.service template that modules hook via onFailure, so failing backups, SMART warnings, and UPS events reach a phone instead of dying in the journal. Points at the local Ntfy server automatically when both are enabled, at whatever address that server binds.

With tokenFile set, othrys-notify sends nothing unless it can read the token, and it exits naming the file instead of posting unauthenticated. The token travels as a bearer header, so the module warns when url is plain http:// and not on this host, since every notification then carries the token across the network in clear. Use https:// for a remote server.

The local Ntfy server denies clients without credentials by default, so a notify that points at it with tokenFile unset delivers nothing. The module warns in that case. Either set tokenFile to a token provisioned through othrys.services.ntfy.tokensFile, or give anonymous clients the topic with an othrys.services.ntfy.access entry such as "*:alerts:write-only". Scrutiny leaves the notify URL out of its own configuration while the warning stands.

Options

  options.othrys.services.notify = {
    enable = lib.mkEnableOption "host notification dispatch (othrys-notify + systemd failure hooks)";

    url = lib.mkOption {
      type = lib.types.nullOr lib.types.str;
      # The local server is reached at its listener as seen from this host
      # (modules/lib/net.nix), so an ntfy moved to one interface still works.
      default =
        if ntfyCfg.enable
        then "http://${local ntfyCfg.listenAddress}:${toString ntfyCfg.port}"
        else null;
      defaultText = lib.literalExpression "the local othrys.services.ntfy instance when enabled, else null";
      example = "https://ntfy.example.com";
      description = "ntfy endpoint notifications are published to. Follows the local ntfy server by default; point it at a fleet-central instance otherwise.";
    };

    topic = lib.mkOption {
      type = lib.types.str;
      default = "alerts";
      description = "ntfy topic notifications are published to (on public instances the topic is effectively a password, so use tokenFile or a private server).";
    };

    tokenFile = lib.mkOption {
      type = lib.types.nullOr othrysTypes.secretPath;
      default = null;
      example = lib.literalExpression ''config.sops.secrets."notify/token".path'';
      description = "Path to a runtime file holding an ntfy access token (a secrets-provider path). Null sends unauthenticated.";
    };
  };

WireGuard

Raw WireGuard interfaces for site-to-site links and exit nodes, the coordination-server-free complement to Tailscale. Private keys are secrets-provider paths, and per-interface openFirewall opens the listen port.

mtu, fwMark and table are passed to the upstream interface, and each peer takes an optional presharedKeyFile. A peer whose allowedIPs covers the default route needs the last two together. table moves the tunnel’s routes out of main, and fwMark lets an ip rule send everything except the tunnel’s own encrypted packets to that table. allowedIPsAsRoutes is on by default and adds a route for every peer’s allowedIPs. An interface whose routes come from a routing daemon or from the host’s own rules sets it to false, and allowedIPs then only says which sources a peer may send from.

othrys.services.wireguard.interfaces.wg0 = {
  privateKeyFile = config.sops.secrets."wireguard/wg0".path;
  ips = ["10.100.0.2/24"];
  mtu = 1380;
  fwMark = "0x6e6978";
  table = "51820";
  peers = [{
    publicKey = "<peer public key>";
    allowedIPs = ["0.0.0.0/0"];
    endpoint = "vpn.example.com:51820";
    presharedKeyFile = config.sops.secrets."wireguard/wg0-psk".path;
  }];
};

Options

  options.othrys.services.wireguard = {
    enable = lib.mkEnableOption "raw WireGuard interfaces (coordination-server-free VPN links)";

    interfaces = lib.mkOption {
      default = {};
      description = "WireGuard interfaces (maps to networking.wireguard.interfaces).";
      example = lib.literalExpression ''
        {
          wg0 = {
            privateKeyFile = config.sops.secrets."wireguard/wg0".path;
            ips = ["10.100.0.2/24"];
            listenPort = 51820;
            openFirewall = true;
            peers = [
              {
                publicKey = "<peer public key>";
                allowedIPs = ["10.100.0.0/24"];
                endpoint = "vpn.example.com:51820";
                persistentKeepalive = 25;
              }
            ];
          };
        }
      '';
      type = lib.types.attrsOf (lib.types.submodule {
        options = {
          privateKeyFile = lib.mkOption {
            type = othrysTypes.secretPath;
            description = "Path to a runtime file holding the interface private key (a secrets-provider path).";
          };

          ips = lib.mkOption {
            type = lib.types.listOf lib.types.str;
            description = "Addresses (CIDR) assigned to the interface.";
          };

          listenPort = lib.mkOption {
            type = lib.types.nullOr lib.types.port;
            default = null;
            description = "UDP listen port. Null picks a random port (fine for outbound-only peers).";
          };

          openFirewall = lib.mkOption {
            type = lib.types.bool;
            default = false;
            description = "Open listenPort in the firewall (requires listenPort).";
          };

          mtu = lib.mkOption {
            type = lib.types.nullOr lib.types.ints.positive;
            default = null;
            example = 1280;
            description = "MTU of the interface in bytes. Null leaves the WireGuard default of 1420, which is too large where the path underneath carries less than 1500.";
          };

          fwMark = lib.mkOption {
            type = lib.types.nullOr lib.types.str;
            default = null;
            example = "0x6e6978";
            description = "Firewall mark set on the encrypted packets this interface sends. Policy routing uses it to keep the tunnel's own packets out of the tunnel when `allowedIPs` covers the default route.";
          };

          table = lib.mkOption {
            type = lib.types.str;
            default = "main";
            example = "51820";
            description = "Routing table the routes for `allowedIPs` are added to, by name or number. Anything but `main` leaves the default route alone until an `ip rule` selects the table.";
          };

          allowedIPsAsRoutes = lib.mkOption {
            type = lib.types.bool;
            default = true;
            description = ''
              Add a route for every peer's `allowedIPs` to `table`. Set to
              `false` where the routes are managed elsewhere, by a routing
              daemon or by the host's own rules, and `allowedIPs` should only
              say which sources a peer may send from.
            '';
          };

          peers = lib.mkOption {
            default = [];
            description = "Peers for this interface.";
            type = lib.types.listOf (lib.types.submodule {
              options = {
                publicKey = lib.mkOption {
                  type = lib.types.str;
                  description = "Peer public key.";
                };
                allowedIPs = lib.mkOption {
                  type = lib.types.listOf lib.types.str;
                  description = "Networks routed to (and accepted from) this peer.";
                };
                endpoint = lib.mkOption {
                  type = lib.types.nullOr lib.types.str;
                  default = null;
                  example = "vpn.example.com:51820";
                  description = "Peer endpoint. Null for peers that dial in.";
                };
                persistentKeepalive = lib.mkOption {
                  type = lib.types.nullOr lib.types.ints.positive;
                  default = null;
                  example = 25;
                  description = "Keepalive interval in seconds (needed behind NAT).";
                };
                presharedKeyFile = lib.mkOption {
                  type = lib.types.nullOr othrysTypes.secretPath;
                  default = null;
                  example = lib.literalExpression ''config.sops.secrets."wireguard/wg0-psk".path'';
                  description = "Path to a runtime file holding the preshared key for this peer, from `wg genpsk` (a secrets-provider path). Both ends must hold the same key.";
                };
              };
            });
          };
        };
      });
    };
  };

Traefik

Traefik as the edge reverse proxy, a wrapper over services.traefik. The module builds the static configuration for the web and websecure entrypoints, the HTTPS redirect and a DNS-01 ACME resolver. Routers, services and further middlewares go through dynamicConfigOptions, which is merged on top of what the module generates.

Two sets of defaults apply to every router behind websecure.

The default TLS options set minVersion = "VersionTLS12", since Traefik itself still admits TLS 1.0 and 1.1. With ACME on they also set sniStrict, so a connection whose server name matches no certificate is refused instead of being answered with the self-signed default certificate. A request to the bare IP address is refused for the same reason.

A headers middleware named othrys-security-headers is attached at the entrypoint. It sends Strict-Transport-Security for one year, without subdomains or preload, X-Content-Type-Options: nosniff, and X-Frame-Options: SAMEORIGIN. The frame header breaks a dashboard that another host name embeds in an iframe. Give that router its own headers middleware, or change securityHeaders.frameOptions.

openFirewall opens 80 and 443 and nothing else. The API and dashboard port, 8080, stays closed even with dashboard.insecure, because that listener carries no authentication. A host that wants it reachable opens the port in its own firewall configuration. Scrutiny, Headscale and the CrowdSec local API default to 8080 as well, and the module refuses dashboard.insecure beside any of them on that port.

acme.storage has to sit under dataDir, which is the directory the module persists under impermanence, and an assertion refuses any other path. An acme.json lost at reboot means every certificate is ordered again until the CA rate limit refuses the host. acme.caServer sets the ACME directory of the resolver, which is where the Let’s Encrypt staging URL goes while a host is being brought up.

othrys.services.traefik.acme.caServer =
  "https://acme-staging-v02.api.letsencrypt.org/directory";

Public deployment

A host exposed to the internet has more to set than the module’s defaults cover. Each item below states what the module writes and what is left to the host.

  • Dashboard. dashboard.enable is off by default. On, it enables the Traefik API and dashboard and creates no router for them, so the host defines a router to api@internal in dynamicConfigOptions, on an entrypoint and host name of its choosing and behind an authentication middleware. dashboard.insecure serves the dashboard on :8080 with no authentication. The module never opens that port in the firewall, and a public host leaves the option off, so the dashboard is never on a public entrypoint without authentication.
  • Forwarded headers. forwardedHeaders.trustedIPs is empty by default, so Traefik discards the X-Forwarded-* headers of every request and the client address it logs and passes on is the peer’s. That is right for a host that faces the internet directly. Behind a CDN or a load balancer the list holds that proxy’s ranges and nothing wider, because a listed peer can state any client address. The option writes the list to both entrypoints.
  • Log level. logLevel sets log.level for Traefik’s own log and is null by default, which leaves Traefik at ERROR. A host being brought up usually wants "INFO" or "DEBUG" until its routers and certificates work.
  • Access log. The module writes no accessLog, and Traefik then logs no requests. A host that wants them sets staticConfigOptions.accessLog. othrys.services.security.crowdsec turns the log on in JSON when both modules are enabled, because its Traefik parser reads those lines from the journal.
  • TLS floor and ciphers. tls.minVersion is "VersionTLS12". The module sets no cipherSuites, so TLS 1.2 connections negotiate from Traefik’s own list. A host narrows it through dynamicConfigOptions.tls.options.default.cipherSuites, or sets tls.minVersion = "VersionTLS13", where the suites are fixed by the protocol.
  • Certificate matching. tls.sniStrict follows acme.enable. A public host with certificates from another source sets it to true itself.
  • Rate limiting. The module defines no rateLimit or inFlightReq middleware and attaches none. A host declares them in dynamicConfigOptions.http.middlewares and names them on each public router.
  • Headers. othrys-security-headers carries HSTS, nosniff and the frame option and nothing else. A content security policy or a referrer policy belongs to each application and goes in that router’s own middleware.
  • ACME. acme.caServer points the resolver at the Let’s Encrypt staging directory during bring-up, as shown above, since production rate-limits failed orders. With the option unset the resolver uses the production directory.
  • Firewall. openFirewall is on by default and opens 80 and 443 on every interface.
othrys.services.traefik = {
  enable = true;
  acme = {
    enable = true;
    email = "admin@example.com";
    dnsProvider = "cloudflare";
  };
  environmentFiles = [config.sops.secrets."traefik/env".path];
  # Only behind a proxy, and only that proxy's ranges.
  forwardedHeaders.trustedIPs = ["192.0.2.0/24"];
  logLevel = "INFO";
  staticConfigOptions.accessLog.format = "json";
  dynamicConfigOptions = {
    tls.options.default.cipherSuites = [
      "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384"
      "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"
      "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305"
      "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305"
    ];
    # A router names this one as `public-rate-limit@file`.
    http.middlewares.public-rate-limit.rateLimit = {
      average = 100;
      burst = 200;
    };
  };
};

TCP routers

tcpRouters puts a TCP service behind Traefik and routes it by the TLS server name the client sends. Each entry writes an entrypoint, a router and a service under its own name, and a servers transport as well when proxyProtocol is set. The entrypoint is named after the entry unless entryPoint.name says otherwise, and its port is opened when the entry’s openFirewall is on, which follows the module’s own openFirewall.

othrys.services.traefik.tcpRouters.soju = {
  entryPoint.address = ":6697";
  domain = "irc.example.com";
  backend = "[::1]:6667";
  proxyProtocol = 2;
};

Every entry has an entrypoint of its own, so the module refuses two entries on one port or with one entrypoint name. It also refuses the entrypoint names web, websecure and traefik, ports 80 and 443, and port 8080 while the insecure dashboard is on and the host has not moved the traefik entrypoint.

The rule is a strict HostSNI(`<domain>`). A client that sends no server name matches nothing, and Traefik closes the TCP connection before any handshake, with no TLS alert. The wildcard rule HostSNI(`*`) does not help such a client. Under tls.sniStrict it is refused all the same, and with sniStrict off it is answered with Traefik’s self-signed default certificate. Serving the ACME certificate as the default takes defaultGeneratedCert, which changes the default certificate for every HTTPS router too.

A router terminates TLS by default, with the certificate the ACME resolver issues, and the module refuses a terminating router while acme.enable is off. It uses the default TLS options, so tls.sniStrict and tls.minVersion apply to it as they do to the HTTPS routers. The router names its domain in tls.domains, and that list decides what the resolver requests. passthrough = true forwards the TLS stream unopened to a backend that terminates TLS itself. Traefik reads only the server name from the client’s hello, and the router needs no ACME.

proxyProtocol sends a PROXY protocol header, so the backend sees the client’s address and not Traefik’s. The header goes on a servers transport named after the entry, since loadBalancer.proxyProtocol has been deprecated since Traefik 3.5.2. A backend has to trust the header from Traefik’s address alone, because a peer it trusts can state any client address. soju is the worked example.

Switches

Each default has its own switch.

othrys.services.traefik = {
  tls.minVersion = null;                  # Traefik's own default
  tls.sniStrict = false;
  securityHeaders.hstsSeconds = 0;        # no HSTS header
  securityHeaders.contentTypeNosniff = false;
  securityHeaders.frameOptions = null;    # no X-Frame-Options header
  securityHeaders.enable = false;         # attach no middleware at all
};

Options

  options.othrys.services.traefik = {
    enable = lib.mkEnableOption "Traefik reverse proxy";

    dataDir = lib.mkOption {
      type = lib.types.path;
      default = "/var/lib/traefik";
      description = "Persistent data directory (holds acme.json).";
    };

    group = lib.mkOption {
      type = lib.types.str;
      default = "traefik";
      description = "Group Traefik runs under (set to \"docker\" for the Docker provider).";
    };

    httpsRedirect = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = "Redirect the web (:80) entrypoint to websecure (:443).";
    };

    dashboard = {
      enable = lib.mkEnableOption "the Traefik dashboard/API";

      insecure = lib.mkOption {
        type = lib.types.bool;
        default = false;
        description = "Expose the dashboard on :8080 without auth. Convenient but unsafe, so prefer a secured router. The firewall port stays closed whatever openFirewall says.";
      };
    };

    acme = {
      enable = lib.mkEnableOption "automatic TLS via Let's Encrypt (DNS-01)";

      email = lib.mkOption {
        type = lib.types.str;
        default = "";
        description = "Contact email for the ACME account.";
      };

      dnsProvider = lib.mkOption {
        type = lib.types.str;
        default = "";
        example = "cloudflare";
        description = "lego DNS provider name. Its credentials are supplied via environmentFiles.";
      };

      resolver = lib.mkOption {
        type = lib.types.str;
        default = "letsencrypt";
        description = "Name of the certificate resolver referenced by routers.";
      };

      dnsResolvers = lib.mkOption {
        type = lib.types.listOf lib.types.str;
        default = [];
        example = ["1.1.1.1:53" "8.8.8.8:53"];
        description = "DNS servers used to check record propagation.";
      };

      storage = lib.mkOption {
        type = lib.types.nullOr lib.types.str;
        default = null;
        description = "Path to acme.json. Defaults to <dataDir>/acme.json, and must stay under dataDir, which is the directory persisted under impermanence.";
      };

      caServer = lib.mkOption {
        type = lib.types.nullOr lib.types.str;
        default = null;
        example = "https://acme-staging-v02.api.letsencrypt.org/directory";
        description = ''
          ACME directory URL written to the certificate resolver. Null leaves
          Traefik on the Let's Encrypt production directory. Point it at the
          staging directory while bringing a host up, since production
          rate-limits failed orders.
        '';
      };
    };

    tls = {
      minVersion = lib.mkOption {
        type = lib.types.nullOr (lib.types.enum ["VersionTLS12" "VersionTLS13"]);
        default = "VersionTLS12";
        description = ''
          Lowest TLS version the default TLS options accept. Traefik's own
          default admits TLS 1.0 and 1.1. `null` leaves Traefik's default in
          place.
        '';
      };

      sniStrict = lib.mkOption {
        type = lib.types.bool;
        default = cfg.acme.enable;
        defaultText = lib.literalExpression "config.othrys.services.traefik.acme.enable";
        description = ''
          Refuse a TLS connection whose server name matches no certificate,
          instead of answering with Traefik's self-signed default certificate.
          A request made to the bare IP address is refused as well.

          On by default when ACME issues the certificates, since every routed
          host then has one. Off by default otherwise, because a proxy with no
          certificate of its own would refuse every connection.
        '';
      };
    };

    securityHeaders = {
      enable = lib.mkOption {
        type = lib.types.bool;
        default = true;
        description = ''
          Attach a headers middleware to the websecure entrypoint, so every
          router behind it sends the headers below. A router that needs
          different values sets its own headers middleware, which runs after
          this one and wins. Set to `false` to attach nothing.
        '';
      };

      hstsSeconds = lib.mkOption {
        type = lib.types.ints.unsigned;
        default = 31536000;
        description = ''
          `max-age` of the `Strict-Transport-Security` header, one year by
          default. Subdomains are not included and preload is not requested,
          since both reach past the hosts this proxy serves. `0` sends no HSTS
          header.
        '';
      };

      contentTypeNosniff = lib.mkOption {
        type = lib.types.bool;
        default = true;
        description = "Send `X-Content-Type-Options: nosniff`.";
      };

      frameOptions = lib.mkOption {
        type = lib.types.nullOr lib.types.str;
        default = "SAMEORIGIN";
        example = "DENY";
        description = ''
          Value of the `X-Frame-Options` header. The default lets a site frame
          its own pages and stops other origins from framing them, which breaks
          a dashboard embedded from a different host name. `null` sends no such
          header.
        '';
      };
    };

    forwardedHeaders.trustedIPs = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = [];
      example = ["192.0.2.0/24"];
      description = ''
        Addresses or CIDR ranges of the proxies in front of Traefik whose
        `X-Forwarded-*` headers are kept, written to the `web` and
        `websecure` entrypoints. With the list empty Traefik discards those
        headers from every peer, which is right for a host that faces the
        internet directly. Behind a CDN or a load balancer the list holds that
        proxy's ranges and nothing wider, since a listed peer can state any
        client address it likes.
      '';
    };

    logLevel = lib.mkOption {
      type = lib.types.nullOr (lib.types.enum ["TRACE" "DEBUG" "INFO" "WARN" "ERROR" "FATAL" "PANIC"]);
      default = null;
      example = "INFO";
      description = ''
        Level of Traefik's own log, written as `log.level`. Null leaves
        Traefik's default of `ERROR`. This is the log of the proxy itself,
        and requests go to the access log, which is a separate setting.
      '';
    };

    environmentFiles = lib.mkOption {
      type = lib.types.listOf othrysTypes.secretPath;
      default = [];
      example = lib.literalExpression ''[ config.sops.secrets."traefik/env".path ]'';
      description = ''
        EnvironmentFiles for the service (e.g. the DNS provider token like
        CF_DNS_API_TOKEN). Substituted into the static config via envsubst.
      '';
    };

    openFirewall = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = "Open the web (:80) and websecure (:443) ports. It is also the default of tcpRouters.<name>.openFirewall. The API and dashboard port, :8080, is never opened here, since the insecure dashboard carries no authentication.";
    };

    staticConfigOptions = lib.mkOption {
      type = lib.types.attrsOf lib.types.anything;
      default = {};
      description = "Extra static configuration, merged on top of the generated static config.";
    };

    dynamicConfigOptions = lib.mkOption {
      type = lib.types.attrsOf lib.types.anything;
      default = {};
      description = "Dynamic configuration (routers, services, middlewares, TLS), merged on top of the generated TLS options and headers middleware.";
    };

    tcpRouters = lib.mkOption {
      type = lib.types.attrsOf (lib.types.submodule ({name, ...}: {
        options = {
          entryPoint = {
            name = lib.mkOption {
              type = lib.types.str;
              default = name;
              defaultText = lib.literalExpression "<router name>";
              example = "ircs";
              description = "Name of the entrypoint the router listens on. Each router gets its own.";
            };

            address = lib.mkOption {
              type = lib.types.strMatching ".*:[0-9]+";
              example = ":6697";
              description = ''
                Address of the entrypoint, `:<port>` for every address or
                `<address>:<port>` for one. Ports 80 and 443 belong to `web`
                and `websecure`, and 8080 to the insecure dashboard.
              '';
            };
          };

          domain = lib.mkOption {
            type = lib.types.str;
            example = "irc.example.com";
            description = ''
              Name the router answers to, matched as `HostSNI` against the
              name the client sends. A client that sends no name is not
              routed. A terminating router asks the ACME resolver for a
              certificate for this name.
            '';
          };

          backend = lib.mkOption {
            type = lib.types.str;
            example = "[::1]:6667";
            description = "Address and port Traefik forwards the connection to.";
          };

          proxyProtocol = lib.mkOption {
            type = lib.types.nullOr (lib.types.enum [1 2]);
            default = null;
            example = 2;
            description = ''
              Version of the PROXY protocol header Traefik sends to the
              backend, so the backend sees the client's address. Null sends
              none. The backend has to expect the header from Traefik's
              address and from no other peer.
            '';
          };

          passthrough = lib.mkOption {
            type = lib.types.bool;
            default = false;
            description = ''
              Forward the TLS stream unopened to a backend that terminates TLS
              itself. Traefik reads only the name from the client's hello, and
              requests no certificate. Off by default, so Traefik terminates TLS
              with the certificate `acme.resolver` issues.
            '';
          };

          openFirewall = lib.mkOption {
            type = lib.types.bool;
            default = cfg.openFirewall;
            defaultText = lib.literalExpression "config.othrys.services.traefik.openFirewall";
            description = "Open the entrypoint's port in the NixOS firewall.";
          };
        };
      }));
      default = {};
      example = lib.literalExpression ''
        {
          soju = {
            entryPoint.address = ":6697";
            domain = "irc.example.com";
            backend = "[::1]:6667";
            proxyProtocol = 2;
          };
        }
      '';
      description = ''
        TCP services behind Traefik, each on an entrypoint of its own and
        reached by the TLS server name. Each entry writes an entrypoint, a
        router, a service and, with `proxyProtocol`, a servers transport,
        under its own name. A terminating router uses the default TLS
        options, so `tls.sniStrict` and `tls.minVersion` apply to it as they
        do to the HTTPS routers.
      '';
    };
  };

soju

soju is an IRC bouncer, and the module is a wrapper over services.soju. soju holds the connections to the upstream networks and keeps their history while clients come and go. Clients reach it over TLS in one of two ways, through a Traefik TCP router or through soju’s own TLS listener. senpai is the client module, and IRC with soju and senpai sets up both.

othrys.services.soju = {
  enable = true;
  traefik = {
    enable = true;
    domain = "irc.example.com";
  };
};

Upstream’s default listen is :6697, which soju reads as ircs, and soju exits with missing TLS configuration when no certificate is set. The module listens on irc+insecure://127.0.0.1:6667 instead, at port, and never opens that port in the firewall.

Both TLS paths serve port 6697, so the module refuses traefik.enable beside tls.certificateFile.

Through Traefik. traefik.enable writes othrys.services.traefik.tcpRouters.soju, an entrypoint named ircs at :6697 that forwards to [::1]:<port> with a PROXY protocol version 2 header. It needs traefik.domain, and Traefik with ACME on. soju trusts a PROXY header by the peer’s address, on every listener at once, and accepts a trusted peer that sends none. The module adds a second plaintext listener on [::1] for Traefik to dial, and ::1/128 is the only trusted range, so a header sent from 127.0.0.1, where a local client connects, is not read. networking.enableIPv6 = false removes ::1 from lo, and the module refuses it beside traefik.enable. The port Traefik listens on is opened by othrys.services.traefik.tcpRouters.soju.openFirewall and not by soju’s own openFirewall.

Direct TLS. tls.certificateFile and tls.keyFile are set together and add an ircs://:6697 listener, which openFirewall opens. The service runs under DynamicUser and cannot read a certificate another user owns, so both files reach it through LoadCredential. systemd reads them as root when the service starts, and the ACME files can stay owned by the acme user. The copy is taken once per start, so a renewed certificate is read at the next restart of soju.service and not at a reload. security.acme.certs.<name>.reloadServices runs systemctl try-reload-or-restart, and the upstream unit answers a reload with SIGHUP, so soju would reload against the stale copy. A host using security.acme restarts the service after renewal instead.

security.acme.certs."irc.example.com".postRun = "systemctl restart soju.service";

othrys.services.soju = {
  enable = true;
  tls = {
    certificateFile = "/var/lib/acme/irc.example.com/fullchain.pem";
    keyFile = "/var/lib/acme/irc.example.com/key.pem";
  };
  openFirewall = true;
};

The module declares no accounts. An account is created on the host, and sojuctl takes the password only as an argument, so the password is visible in the process list while the command runs. A declarative account would put it there at every activation.

sudo sojuctl user create -username alice -password 'change-me' -admin true

messageStore defaults to db, which is soju’s own default and differs from the fs that upstream NixOS sets. History then sits in soju.db beside the accounts and the passwords soju sends to the networks it joins. The state directory is persisted at /var/lib/private/soju, where a DynamicUser service keeps it, and /var/lib/soju is systemd’s symlink to it.

hostName is the name soju gives itself as an IRC server. It follows traefik.domain while traefik.enable is on, and networking.hostName otherwise. soju warns at start when the name has no dot, and it never compares the name with the TLS name a client uses.

Options

  options.othrys.services.soju = {
    enable = lib.mkEnableOption "the soju IRC bouncer";

    port = lib.mkOption {
      type = lib.types.port;
      default = 6667;
      description = ''
        Port of the plaintext listener on loopback, `irc+insecure://`, which
        a client on the same host uses and which Traefik forwards to. It is
        never opened in the firewall.
      '';
    };

    hostName = lib.mkOption {
      type = lib.types.str;
      default =
        if cfg.traefik.enable && cfg.traefik.domain != null
        then cfg.traefik.domain
        else config.networking.hostName;
      defaultText = lib.literalExpression "traefik.domain when traefik.enable is on, config.networking.hostName otherwise";
      example = "irc.example.com";
      description = ''
        Name soju gives itself as an IRC server, in the prefix of its own
        messages and in its welcome replies. soju warns at start when the
        name has no dot. It is not compared with the TLS name a client uses.
      '';
    };

    messageStore = lib.mkOption {
      type = lib.types.enum ["db" "fs" "memory"];
      default = "db";
      description = ''
        Where soju keeps message history. `db` writes it to the same sqlite
        database that holds the accounts, `soju.db` in the state directory,
        and gives soju's message search. `fs` writes plain-text logs under
        `logs` in the state directory, and `memory` keeps nothing across a
        restart. Upstream NixOS defaults to `fs`, while soju itself
        defaults to `db`.
      '';
    };

    tls = {
      certificateFile = lib.mkOption {
        type = lib.types.nullOr othrysTypes.secretPath;
        default = null;
        example = "/var/lib/acme/irc.example.com/fullchain.pem";
        description = ''
          Runtime path to the certificate chain for soju's own TLS listener,
          `ircs://` on port 6697. Set together with `tls.keyFile`. The file
          is loaded into the service as a credential, so it can stay owned
          by root. A renewed certificate is read at the next restart of
          `soju.service`.
        '';
      };

      keyFile = lib.mkOption {
        type = lib.types.nullOr othrysTypes.secretPath;
        default = null;
        example = "/var/lib/acme/irc.example.com/key.pem";
        description = "Runtime path to the private key for `tls.certificateFile`.";
      };
    };

    openFirewall = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = ''
        Open port 6697 for soju's own TLS listener. It has an effect only
        with `tls.certificateFile` set. The plaintext listener is never
        opened, and the port Traefik listens on is opened by
        `othrys.services.traefik.tcpRouters.soju.openFirewall`.
      '';
    };

    traefik = {
      enable = lib.mkEnableOption ''
        a Traefik TCP router for soju. Traefik terminates TLS on port 6697
        with its ACME resolver and forwards to soju over `[::1]` with a PROXY
        protocol header, so soju sees each client's own address
      '';

      domain = lib.mkOption {
        type = lib.types.nullOr lib.types.str;
        default = null;
        example = "irc.example.com";
        description = ''
          Name clients connect to. Traefik requests its certificate and
          routes on it, and a client that sends no such name is not routed.
          It becomes the default of `hostName`.
        '';
      };
    };

    extraConfig = lib.mkOption {
      type = lib.types.lines;
      default = "";
      example = "max-user-networks 5";
      description = "Lines appended to `soju.conf`. See {manpage}`soju(1)` for the directives.";
    };
  };

DDNS

Dynamic DNS via inadyn, keeping hostnames pointing at a dynamic residential IP, pairing with Traefik’s DNS-01 ACME. Credentials arrive as an inadyn include snippet (password = <token>) from a secrets provider. inadyn reads it as its own user, so the secret needs owner = "inadyn".

provider is an enum of the names inadyn registers, which inadyn -L lists. It takes the full name, such as default@cloudflare.com or ipv6@dynv6.com, or the service name after the @, such as cloudflare.com. inadyn itself accepts any substring of a name, so a misspelt provider would otherwise reach the daemon and fail at its first run.

Options

  options.othrys.services.ddns = {
    enable = lib.mkEnableOption "dynamic DNS updates (inadyn)";

    provider = lib.mkOption {
      type = lib.types.nullOr (lib.types.enum providerNames);
      default = null;
      defaultText = lib.literalMD "none, and an assertion rejects an unset value once the module is enabled";
      example = "cloudflare.com";
      description = ''
        DDNS provider, one of the names inadyn registers (`inadyn -L` lists
        them). Either the full name, such as `default@cloudflare.com` or
        `ipv6@dynv6.com`, or the service name after the `@`, which inadyn
        resolves to the first plugin that carries it. Must be set when this
        module is enabled.
      '';
    };

    hostnames = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = [];
      defaultText = lib.literalMD "none, and an assertion rejects an empty list once the module is enabled";
      example = ["home.example.com"];
      description = "Hostnames to keep updated. Identity-shaped, set from the consuming host. Must be non-empty when this module is enabled.";
    };

    username = lib.mkOption {
      type = lib.types.nullOr lib.types.str;
      default = null;
      example = "example.com";
      description = "Provider username/account (for Cloudflare: the zone name). Null for token-only providers.";
    };

    credentialsFile = lib.mkOption {
      type = lib.types.nullOr othrysTypes.secretPath;
      default = null;
      defaultText = lib.literalMD "none, and an assertion rejects an unset value once the module is enabled";
      example = lib.literalExpression ''config.sops.secrets."ddns/credentials".path'';
      description = ''
        Path to a runtime file included into the provider block, since inadyn.conf
        syntax, typically a single `password = <token>` line. A
        secrets-provider path; never inline the token. Must be set when this
        module is enabled.

        inadyn opens the file at run time as its own user inside a private
        user namespace, so a file that is root-owned and mode 0400 is
        unreadable and the service fails at its first update. With sops-nix
        set `owner = "inadyn"` on the secret.
      '';
    };

    extraSettings = lib.mkOption {
      type = lib.types.attrsOf lib.types.anything;
      default = {};
      description = "Extra per-provider inadyn settings merged into the provider block.";
    };
  };

Containerization

Platforms: NixOS only.

Container modules under othrys.services.containerization.*. Located in modules/services/containerization/.

Available Modules

ModuleOptionDescription
Podmanothrys.services.containerization.podmanContainer runtime with Docker compatibility
Dockerothrys.services.containerization.dockerDocker runtime (conflicts with Podman dockerCompat)
k3sothrys.services.containerization.k3sLightweight single-node/cluster Kubernetes

Podman

Options

  options.othrys.services.containerization.podman = {
    enable = lib.mkEnableOption "Podman container runtime";

    dockerCompat = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = "Create docker alias pointing to podman for drop-in replacement.";
    };

    enableDns = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = "Enable DNS for default network (required for podman-compose).";
    };

    distrobox = {
      enable = lib.mkOption {
        type = lib.types.bool;
        default = false;
        description = "Enable Distrobox for running containers as if they were native apps.";
      };
    };

    compose = {
      enable = lib.mkOption {
        type = lib.types.bool;
        default = true;
        description = "Install podman-compose for docker-compose compatibility.";
      };
    };

    autoPrune = {
      enable = lib.mkOption {
        type = lib.types.bool;
        default = true;
        description = "Periodically prune unused Podman resources.";
      };

      dates = lib.mkOption {
        type = lib.types.str;
        default = "weekly";
        description = "systemd calendar expression for the prune timer.";
      };

      flags = lib.mkOption {
        type = lib.types.listOf lib.types.str;
        default = ["--all"];
        description = "Flags passed to `podman system prune`. `--all` removes every image without a running container; hosts that pre-pull pinned images should override this.";
      };
    };

    extraPackages = lib.mkOption {
      type = lib.types.listOf lib.types.package;
      default = [];
      description = "Additional packages to install alongside Podman.";
      example = lib.literalExpression "with pkgs; [ skopeo buildah ]";
    };
  };

Features

  • Docker CLI compatibility via dockerCompat
  • DNS enabled for container networking (required for compose)
  • Auto-prune of unused images on autoPrune.dates, weekly by default, for the root store and for the primary user’s rootless store
  • podman-compose for docker-compose compatibility
  • Optional Distrobox for running containers as native apps
  • Shell aliases: docker-compose → podman-compose
  • Persistence for container storage and config

The primary user runs podman rootless and is not added to group podman. That group owns the rootful podman.socket nixpkgs installs, so membership is access to the root daemon’s API, which is root. A host that wants a user on the rootful socket adds the group in users.users.<name>.extraGroups itself.

Docker

The Docker runtime (othrys.services.containerization.docker), rootless by default. With rootless.enable the only daemon is the user’s, started in the user’s session, and no rootful daemon or root socket runs; the user’s store is pruned by a user timer on autoPrune.dates. With rootless.enable = false the rootful daemon runs, the primary user joins group docker, and upstream’s prune unit prunes the root store. That group owns the root daemon’s socket, so membership is root.

The rootful daemon writes its own iptables rules ahead of the router’s chain, so on a host with othrys.services.router a published container port is reachable from the WAN whatever the router allows. The module refuses that pairing unless daemon.settings.iptables = false is set, after which ports are published through the router’s portForwards. Rootless Docker reaches the network through its own namespace and touches no host rules.

GPU containers

GPU access for containers comes from the NVIDIA module, which serves Docker and Podman alike. othrys.hardware.nvidia.containerToolkit.enable writes a CDI specification for the card at boot, as Hardware describes. Podman reads it with --device nvidia.com/gpu=all. Docker, rootful or rootless, reads it with --gpus all or the same --device flag. The option was othrys.services.containerization.docker.nvidia.enable before, and that name still works with a warning.

k3s

Lightweight Kubernetes (othrys.services.containerization.k3s) for a single-node control plane or a joined cluster. See modules/services/containerization/k3s.nix for the full option set (role, node labels and taints, manifests).

The cluster token is a file from the secrets provider, tokenFile, and never a string in the configuration. An agent, or a server that joins another through serverAddr, must set it; a single server that initialises its own cluster needs none. openFirewall is off by default. On, it opens the kubelet and the flannel tunnel on every node, the API on a server, and embedded etcd only on a server that initialises or joins a cluster. k3s bundles its own Traefik on 80 and 443, so a server beside othrys.services.traefik must list "traefik" in disable. /etc/rancher, which holds the admin kubeconfig, is persisted private to root.

hardenedFlags is on by default and starts a server with --write-kubeconfig-mode=0600 and --secrets-encryption, ahead of extraFlags. k3s requires every server of a cluster to agree on secrets encryption, so all of them take the same value. A cluster created without encryption sets hardenedFlags = false and turns encryption on with k3s secrets-encrypt, as the k3s documentation describes. An agent takes neither flag. Forwarding is switched on through net.ipv4.conf.all.forwarding as a default, the key othrys.services.router writes, so a host with both emits it once.

Security

Platforms: The YubiKey module runs on NixOS and nix-darwin, with the U2F login on NixOS alone. CrowdSec, fail2ban, polkit and sudo are NixOS only. See Darwin.

Security modules under othrys.services.security.*. Located in modules/services/security/.

Available Modules

ModuleOptionDescription
Sudoothrys.services.security.sudosudo with a password for wheel, use_pty and a credential timeout
Polkitothrys.services.security.polkitTurns on polkit and adds no rules
YubiKeyothrys.services.security.yubikeyU2F PAM, GPG agent, SSH keygrips
fail2banothrys.services.security.fail2banIntrusion prevention
CrowdSecothrys.services.security.crowdsecCrowdSec engine + nftables firewall bouncer

YubiKey

  • U2F PAM: password and touch for login, sudo, the greeter, polkit and the lockers
  • GPG agent: YubiKey-backed GPG with SSH support
  • SSH keygrips: Specific GPG keygrips for SSH authentication
  • age-plugin-yubikey: For manual sops secret editing

What the U2F factor actually proves

pam_u2f is inserted into the services named in u2fServices, which are login, sudo, greetd, polkit-1, hyprlock and swaylock by default, and into no other. su and sshd are left out on purpose: su is how root is reached from a console with no key at hand, and sshd authenticates with keys of its own. nixpkgs’ global switch, which puts pam_u2f into every PAM service on the host, is not used.

By default the control is required: the password and the touch must both succeed, and the key is a second factor. That applies to the whole PAM service and not to one user, so every account that authenticates through a listed service needs an enrolled credential, and an account with none is locked out of those services while other accounts keep working. The module refuses the setting while any normal user of the host has no mapping, the primary user and every other account declared with isNormalUser alike. An account that never authenticates through a listed service, such as one reached over SSH alone, is named in u2fExemptUsers and the check passes it over. root is not checked, since su stays off the list as the way to it. Enrol and test a key for every account that logs in, and count service and recovery accounts among them.

othrys.services.security.yubikey.u2fRequirePassword = false switches the control to sufficient: a touch on an enrolled key satisfies the service on its own and no password is asked for. That is authentication by possession alone, so whoever holds the token can become root, and a token left in a laptop is a token in somebody else’s hand. It is a reasonable choice for a personal workstation where the token lives on a keyring and the wrong one for a machine left unattended. An account with no mapping falls through to its password, so nothing is locked out.

On nix-darwin

darwinModules.default carries the module. The GnuPG configuration, the sshcontrol keygrips and the gpg-agent with SSH support are the same Home Manager configuration as on NixOS, and Home Manager runs the agent as the user’s launchd agent. pinentryPackage defaults to pinentry_mac there, and to pinentry-curses on a Mac with othrys.desktop.graphical off. macOS reads the token through its own smart card stack, so there is no pcscd or udev rule to set up. The tools are installed system-wide, without pam_u2f.

The U2F login is NixOS only, and a darwin host with a u2fMappings entry is refused. Touch ID for sudo stays the host’s own choice through security.pam.services.sudo_local.touchIdAuth, since it lets a fingerprint alone pass sudo while u2fRequirePassword defaults to two factors.

Options

  options.othrys.services.security.yubikey = {
    enable = lib.mkEnableOption "YubiKey authentication (U2F + GPG + SSH)";

    # U2F PAM options
    u2fMappings = lib.mkOption {
      # One pamu2fcfg credential: key handle, public key, COSE type and an
      # options field, comma-separated. A colon or a newline would start
      # another user's line in the mappings file.
      type = lib.types.attrsOf (lib.types.listOf (lib.types.strMatching "[A-Za-z0-9+/=_.-]+(,[A-Za-z0-9+/=_.-]*)+"));
      default = {};
      description = ''
        U2F key mappings per user. Generated with:
          pamu2fcfg -n -o pam://yubi

        That command prints each credential with a leading colon, which
        joins it to a user's line in a mappings file. Leave the colon out
        here, since each list entry is one credential.

        Keys are stored in /nix/store (read-only) for security. Any
        non-empty mapping turns pam_u2f on for the services in
        `u2fServices`. NixOS only, and a darwin host refuses a mapping,
        since nix-darwin manages the sudo service alone and othrys puts no
        pam_u2f line there.
      '';
      example = {
        alice = [
          "<KeyHandle1>,<UserKey1>,<CoseType1>,<Options1>"
          "<KeyHandle2>,<UserKey2>,<CoseType2>,<Options2>"
        ];
      };
    };

    u2fOrigin = lib.mkOption {
      type = lib.types.str;
      default = "pam://yubi";
      description = "U2F origin for cross-machine portability.";
    };

    u2fRequirePassword = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = ''
        Require a password in addition to the touch, rather than accepting the
        touch alone.

        With this on, pam_u2f is inserted as `required` in every service in
        `u2fServices`, so both the password and the touch must succeed and the
        key is a second factor. The control applies to the whole PAM service
        and not to one user, so every account that authenticates through one
        of those services needs an enrolled credential, and an account with
        none is locked out of them while other accounts keep working. Enrol
        and test a key for every such account before turning it on. The
        module refuses the setting while any normal user of the host has no
        mapping, apart from the accounts named in `u2fExemptUsers`.

        With this off, pam_u2f is `sufficient`: a touch on an enrolled key
        satisfies the service with no password, which is authentication by
        possession alone. Whoever holds the token holds root, and a token
        left in a laptop is a token in someone's hand. An account with no
        mapping falls through to its password, so nothing is locked out.
      '';
    };

    u2fExemptUsers = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = [];
      example = ["deploy"];
      description = ''
        Normal users that have no entry in `u2fMappings` on purpose. With
        `u2fRequirePassword` on, the module refuses a host where a normal
        user has no mapping, since that account fails every service in
        `u2fServices`. An account that never authenticates through them, such
        as one reached over SSH alone, is named here and the check passes it
        over. It stays locked out of those services.
      '';
    };

    u2fServices = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = ["login" "sudo" "greetd" "polkit-1" "hyprlock" "swaylock"];
      description = ''
        PAM services that take the YubiKey, by their names under
        `security.pam.services`. Console login, sudo, the greeter, polkit
        prompts and the two screen lockers by default. `su` and `sshd` are
        left out on purpose: `su` is how root is reached from a console with
        no key at hand, and `sshd` authenticates with keys of its own. A
        service listed here that the host does not run is harmless.
      '';
    };

    # GPG/SSH options
    sshKeygrips = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = [];
      description = "GPG keygrips to authorize for SSH authentication.";
      example = ["0123456789ABCDEF0123456789ABCDEF01234567"];
    };

    pinentryPackage = lib.mkOption {
      type = lib.types.package;
      default =
        if !config.othrys.desktop.graphical
        then pkgs.pinentry-curses
        else if pkgs.stdenv.hostPlatform.isDarwin
        then pkgs.pinentry_mac
        else pkgs.pinentry-qt;
      defaultText = lib.literalExpression "pkgs.pinentry-curses unless othrys.desktop.graphical, and on a graphical host pkgs.pinentry_mac on nix-darwin and pkgs.pinentry-qt otherwise";
      description = ''
        Pinentry program for GPG/SSH PIN prompts. A graphical pinentry on a
        headless host cannot render, silently breaking every GPG and SSH
        authentication, which is why the terminal fallback is the default.
      '';
    };
  };

Onboarding & Key Rotation

# New key generation
just yubikey-onboard

# Rotate onto a replacement YubiKey from existing backup
just yubikey-onboard -- --from-backup /mnt/usb/yubikey-backup

# Verify current YubiKey health
just yubikey-onboard -- --verify

The onboarding script handles new key generation, key rotation from backup, multi-key redundancy, and outputs all values needed for the NixOS configuration. See the YubiKey Onboarding guide for full details.

fail2ban

One jail, sshd, which is defined only on a host that runs the OpenSSH server. It reads the journal with the aggressive filter mode and bans an address after maxretry failures within ten minutes. The ban lasts bantime the first time and grows with each repeat up to 48 hours.

The jail names no port of its own. It bans on the ports in services.openssh.ports, so a server moved off port 22 through othrys.services.ssh.server.ports is covered without further configuration. The filter matches more failed logins when sshd logs at VERBOSE, which is the level the SSH module sets.

bantime takes a number of seconds or a number with one of the suffixes s, m, h, d, w, mo and y. Any other string is rejected at evaluation.

The ban database at /var/lib/fail2ban is persisted under impermanence. It holds the active bans and the per-address count that bantime-increment escalates from, so a reboot neither lifts a ban nor resets an offender to the base bantime.

Options

  options.othrys.services.security.fail2ban = {
    enable = lib.mkEnableOption "Fail2ban intrusion prevention";

    maxretry = lib.mkOption {
      type = lib.types.ints.positive;
      default = 5;
      description = "Failures before a ban (applies to the base config and the sshd jail).";
    };

    bantime = lib.mkOption {
      type = lib.types.strMatching "[0-9]+(s|m|h|d|w|mo|y)?";
      default = "10m";
      example = "1h";
      description = ''
        Base ban duration, escalated by bantime-increment up to 48h. A number
        of seconds, or a number with one of the suffixes `s`, `m`, `h`, `d`,
        `w`, `mo` and `y`.
      '';
    };

    ignoreIP = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = [
        "127.0.0.1/8"
        "::1"
      ];
      example = [
        "127.0.0.1/8"
        "::1"
        "100.64.0.0/10"
      ];
      description = ''
        Addresses exempt from banning. Loopback only by default. Tailnet
        peers are NOT exempt, since exempting the Tailscale CGNAT range
        (100.64.0.0/10) would let every tailnet node bypass fail2ban (shared
        Headscale, third-party devices). Hosts that fully trust their tailnet
        can add it explicitly.
      '';
    };
  };

CrowdSec

CrowdSec security engine plus its nftables firewall bouncer (both from nixpkgs, with no extra flake input). The engine parses logs and decides, while the bouncer enforces those decisions in nftables. registerBouncer wires the two automatically, so no manual cscli bouncers add is required. A complement to fail2ban: fail2ban bans locally, CrowdSec adds crowd-sourced blocklists.

Central-console enrollment (to pull community blocklists) is a one-time runtime step, cscli console enroll <key> with a key from your secrets provider, left to the fleet. Advanced engine/bouncer configuration is available through the upstream services.crowdsec.* / services.crowdsec-firewall-bouncer.* options.

Under impermanence the module persists /var/lib/crowdsec, which holds the hub, the decision database and the machine credentials, together with /var/lib/crowdsec-firewall-bouncer-register, which holds the bouncer’s API key. The two go together, since the engine database records the bouncer as registered and the register unit refuses to start when that record exists and the key file does not.

The engine runs its own Local API on loopback (127.0.0.1:8080), which is what the agent authenticates against and what the bouncer reads decisions from, machine credentials are minted on first start under /var/lib/crowdsec/state/. On a router host the bouncer’s own chains hook input only, so the module adds a forward hook to the bouncer’s tables there and a banned address is no longer forwarded to the LAN. The engine watches the sshd journal by default and Traefik’s access log when that module is on, which the crowdsec module turns on in JSON; Tailscale SSH has no CrowdSec parser and is not watched, and the module warns when othrys.services.tailscale.ssh is on beside it. Enable openFirewall only if a remote bouncer or a second engine has to reach that API.

Options

  options.othrys.services.security.crowdsec = {
    enable = lib.mkEnableOption "CrowdSec security engine + firewall bouncer";

    collections = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = ["crowdsecurity/linux" "crowdsecurity/sshd"];
      description = "CrowdSec hub collections to install (bundle parsers + scenarios).";
    };

    acquisitions = lib.mkOption {
      type = lib.types.listOf (lib.types.attrsOf lib.types.anything);
      default = [
        {
          source = "journalctl";
          journalctl_filter = ["_SYSTEMD_UNIT=sshd.service"];
          labels.type = "syslog";
        }
      ];
      description = ''
        Log sources CrowdSec parses (see the CrowdSec data-sources docs).
        Setting this replaces the curated default outright, including the sshd
        journal source, so list every source the host should watch rather than
        only the ones being added. Traefik's access log is added beside this
        list on a host with `othrys.services.traefik`, and the module turns
        that log on. Tailscale SSH has no CrowdSec parser and is not watched.
      '';
    };

    autoUpdate = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = "Run `cscli hub update` daily.";
    };

    openFirewall = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = "Open the CrowdSec LAPI port in the firewall.";
    };

    firewallBouncer.enable = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = "Enable the nftables firewall bouncer that enforces CrowdSec decisions (auto-registered with the local engine).";
    };
  };

Usage

othrys.services.security.crowdsec = {
  enable = true;
  collections = ["crowdsecurity/linux" "crowdsecurity/sshd"];   # default
  firewallBouncer.enable = true;                                 # default
};

Upstream module

nixpkgs rewrote services.crowdsec in October 2026. The rewrite starts on a fresh host without help, so the workarounds this module carried for the old one are gone. Three things remain.

The rewrite moved the data directory from /var/lib/crowdsec/state to /var/lib/crowdsec/data. The module pins the old path, which keeps the decision database, the hub and the machine credentials of a host that ran the old module.

The rewrite also dropped services.crowdsec.openFirewall. The othrys option of that name now opens the port of services.crowdsec.settings.config.api.server.listen_uri itself. Since that address is on loopback by default, the option matters only beside a changed listen_uri.

The hub index is fetched by crowdsec-setup.service, and the engine waits on that unit. After=network-online.target protects boot and nothing else. On a host that resolves through its own othrys.services.unbound, a switch can restart the resolver and the setup unit in one transaction, and the fetch then lands while the resolver is down. The module orders crowdsec-setup.service after unbound.service whenever othrys Unbound is on, which a restart transaction honours. eval-router-services reads that ordering back.

The crowdsec-test VM check boots a fresh machine, runs the update timer and reboots.

Shell

Platforms: NixOS and nix-darwin. See Darwin.

Shell modules under othrys.system.shell.*. Located in modules/system/shell/.

Available Modules

ModuleOptionDescription
Zshothrys.system.shell.zshPrimary shell with plugins, completions, aliases
Bashothrys.system.shell.bashFallback shell
Starshipothrys.system.shell.starshipCross-shell prompt

Zsh

Full-featured Zsh with:

  • Plugin management (syntax highlighting, autosuggestions, completions)
  • Direnv integration for automatic dev shell activation
  • Zoxide for smart directory jumping
  • Toggleable alias presets (aliasPresets.{nix,navigation,modernUnix,editor,git,python,jvm,ansible,opentofu,node,docker,clipboard}, all on by default except clipboard, which follows othrys.desktop.graphical on NixOS and is off on darwin, where macOS has its own pbcopy) plus extraAliases for consumer additions
  • Persistence for history and the zoxide database. History is kept in ~/.local/share/zsh/history, and the module persists that directory rather than the file, since zsh saves history by renaming a temporary file over HISTFILE and a rename onto a bind-mounted file fails. The direnv allow database is persisted by othrys.apps.development, which owns direnv.

Enabling zsh makes it the primary user’s login shell through othrys.system.users.defaultShell, which a host overrides when it wants another. On darwin the login shell applies only to an account nix-darwin owns, which takes othrys.system.users.uid, and the nix preset’s rebuild runs darwin-rebuild switch, with no rebuild-test. The nix preset’s nix-clean keeps a week of generations, so a rollback target survives it.

The default editor behind EDITOR/VISUAL, git’s core.editor, and the v/vim/vi aliases is othrys.system.defaultEditor (default vim). The variables are set once, through environment.variables, and an editor module such as nixvim makes itself the default with mkDefault when enabled.

Starship

Minimal, fast prompt with Git integration. Every segment the module formats, the directory included, sits in square brackets with no space between segments, so a prompt reads like [alice@host][src][ main]. The first segment holds the user and the host and shows on every host, local or over SSH. The time sits in brackets on the right. Its colours come from othrys.theme.palette. On a host with no palette the layout is the same and each colour is an ANSI name, which the terminal resolves.

AI Assistants

Platforms: Claude Code, Codex, the project environment, T3 Code in both its modes, Ollama, the shared context and the MCP servers run on NixOS and nix-darwin, and Claude Desktop and Orca are NixOS only. Paseo’s CLI, daemon and desktop app run on NixOS and on aarch64-darwin. See Darwin.

AI assistant modules under othrys.apps.ai.*. Located in modules/apps/cli/ai/.

Available Modules

ModuleOptionDescription
Claude Codeothrys.apps.ai.claude-codeAnthropic CLI assistant
Codexothrys.apps.ai.codexOpenAI CLI assistant
Project environmentothrys.apps.ai.projectEnvironmentStarts Claude Code and Codex in the direnv environment of the directory they start in
Claude Desktopothrys.apps.ai.claude-desktopAnthropic’s desktop app, which also runs Claude Code sessions
Orcaothrys.apps.ai.orcaDesktop app that runs coding agents side by side in git worktrees
T3 Codeothrys.apps.ai.t3codeWeb and desktop interface to Codex and Claude Code, served headless or run as a desktop app
Paseoothrys.apps.ai.paseoDaemon, CLI and desktop app that run Codex and Claude Code agents, with a direnv plugin
Ollamaothrys.apps.ai.ollamaLocal LLM inference server, with the backend chosen from the host’s GPU
MCP Context7othrys.apps.ai.mcp.context7Context7 documentation MCP server

Where the AI packages come from

The packages of othrys.apps.ai.claude-code, othrys.apps.ai.codex, othrys.apps.ai.claude-desktop, othrys.apps.ai.orca and othrys.apps.ai.t3code default to the builds in the llm-agents flake this library locks. That flake follows each vendor’s releases within hours, while nixpkgs typically trails by days. It builds against its own nixpkgs, so its packages come prebuilt from cache.numtide.com, and a host trusts that cache and its key only while such a module is on. package takes any other build, such as pkgs.claude-code. othrys.apps.ai.paseo is the exception and defaults to nixpkgs’ paseo, since the llm-agents build leaves out the web UI the daemon serves (numtide/llm-agents.nix#12308).

The default is built with disableTelemetry, which turns off telemetry and non-essential traffic, and othrys.apps.ai.claude-code.disableTelemetry = false builds it without. A package set by hand is used as given.

Every module that installs or runs Claude Code or Codex, T3 Code and Paseo among them, receives the package wrapped by the launcher that the project environment describes, whether it is the default or one set by hand. A host that sets Home Manager’s programs.claude-code.package or programs.codex.package itself replaces the wrapped package for that user.

llm-agents marks its unfree packages as free, so nixpkgs never asks whether the host admits them. Claude Code and Claude Desktop are unfree, so their modules refuse a host that admits no unfree software, through othrys.system.nix.allowUnfree or the host’s own allowUnfreePredicate or allowUnfreePackages.

The project environment

An agent inherits the environment of whatever started it, such as a daemon, an editor or a shell outside the project. A project whose agent hooks or tools live in its dev shell then fails. In othrys.nix itself, .claude/settings.json refuses every write when othrys-agent-hook is not on PATH. othrys.apps.ai.projectEnvironment, on by default, replaces the claude and codex programs of their packages with a launcher. When the directory the agent starts in has an allowed .envrc, the launcher runs the agent through direnv exec, so it gets the environment a shell in that directory would have, and variables direnv unsets are unset as usual.

The launcher leaves the agent unchanged in a directory without an .envrc, and when DIRENV_DIR names the directory of the .envrc direnv finds from there, since direnv has loaded that environment already. An environment loaded for a parent project does not count when the directory has an .envrc of its own. In an interactive shell inside the project it therefore does nothing beyond what direnv’s own hook did. It runs direnv, jq, git, coreutils and diffutils from the store, so a host without direnv in its profile still runs it, while no .envrc is allowed until the user runs direnv allow.

A blocked .envrc makes direnv exec refuse to run the command at all. The launcher then starts the agent without the environment and prints one line to stderr naming the file. direnv allow in that directory loads it from the next start.

direnv trusts an .envrc by its path, so every new git worktree starts blocked. The launcher allows a worktree’s .envrc when it is byte-identical to the .envrc at the same relative path in the main checkout and that file is allowed, which extends trust only to text the user already approved. A worktree whose .envrc differs stays blocked until direnv allow. The main checkout is found through git rev-parse --git-common-dir, so a worktree of a bare repository or of a submodule is not covered and starts blocked. A worktree the user denied with direnv deny stays denied.

The allow is written to the user’s direnv allow store under $XDG_DATA_HOME/direnv/allow, so it outlasts the agent, and a shell that enters the worktree later loads the file without a prompt. Removing the worktree leaves the entry until direnv prune runs. A host that wants new worktrees to stay blocked until the user allows them sets othrys.apps.ai.projectEnvironment.trustWorktrees = false, and the launcher then never runs direnv allow.

The trust is direnv’s own model, and direnv hashes .envrc alone. Under use flake, a branch that changes flake.nix or the dev shell loads without a prompt, in the main checkout and in a worktree that inherited the trust alike.

The environment belongs to the process and is chosen by the directory the agent starts in. A program that runs one agent process for several directories, or starts the process in its own directory rather than the project’s, gets the environment of that directory only. Such launchers need their own support.

othrys.apps.ai.projectEnvironment.enable = false gives every module the packages as they are set.

Options

  options.othrys.apps.ai.projectEnvironment = {
    enable = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = ''
        Start `claude` and `codex` through `direnv exec` when the directory
        they start in has an allowed `.envrc`, so their hooks and commands
        see the project's environment whichever program started them. A
        directory without an `.envrc` and an environment direnv already
        loaded leave the agent unchanged.
      '';
    };

    trustWorktrees = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = ''
        When an agent starts in a git worktree, run `direnv allow` on its
        `.envrc` when it is identical to the allowed `.envrc` at the same
        place in the main checkout. The allow is written to the user's
        direnv allow store, so it outlasts the agent and a shell in the
        worktree loads the file too. When false, a new worktree's `.envrc`
        stays blocked until the user allows it. Has no effect while
        `enable` is off.
      '';
    };
  };

Codex

othrys.apps.ai.codex wraps Home Manager’s programs.codex. It receives the shared skills, the shared context as its global AGENTS.md, and every server under programs.mcp.servers. othrys.apps.ai.codex.skills holds skills for Codex alone.

disableTelemetry, on by default, turns off Codex’s analytics and the metrics exporter that follows them, /feedback uploads, and the startup check that asks GitHub for a newer release a Nix-managed binary cannot install. othrys.apps.ai.codex.settings is merged over what the module writes and wins over it.

How Codex’s permissions follow Claude Code’s

Codex confines commands with a sandbox where Claude Code prompts for them, so the module carries Claude Code’s choices over in Codex’s own terms.

  • Mode. permissions.mode takes Claude Code’s two mode names. With "default" the workspace stays read-only and every edit asks first. With "acceptEdits" Codex edits the workspace without asking and also runs commands without asking, inside a sandbox with no network that writes only to the workspace. Codex has no mode that applies edits freely while prompting for every command. In both modes, leaving the sandbox asks first.
  • Read denials. permissions.denyRead keeps sandboxed commands from reading .env, .env.* and secrets/**, as Claude Code’s deny list does. Codex expresses that only through its permission profiles, which it marks as Beta, so the module writes a profile named othrys that extends the built-in one the mode names. A command run outside the sandbox is not bound by it.
  • Command rules. sudo and rm -rf are forbidden in othrys.rules, which blocks them under every mode. permissions.extraRules appends lines in Codex’s rule syntax. An allow rule runs its command outside the sandbox, so the only allow rules the modules write are the read-only gh commands, which need the network the sandbox withholds. Codex appends the commands a user chooses to always allow to default.rules, which the modules leave alone.
  • Commit attribution. Codex adds a Co-authored-by: Codex trailer when the ChatGPT account’s commit attribution setting is on. That setting lives on OpenAI’s servers, and no config.toml key turns it off, so turn it off in the account’s Codex settings. An instruction in AGENTS.md does not override it.

The sign-in goes to the desktop keyring where one answers and to ~/.codex/auth.json otherwise. config.toml is merged at each activation rather than linked read-only, since Codex records trusted directories there itself. Under impermanence the module persists ~/.codex at mode 0700, which holds the sign-in file, the sessions, the history and the state database.

Claude Desktop

othrys.apps.ai.claude-desktop installs Anthropic’s desktop app for the user, repackaged from Anthropic’s own Linux build. It needs a graphical session and refuses a host without one. Cowork’s virtual machines need qemu and KVM from the host, which the module does not provide.

The app reads local MCP servers, the ones with a command, from ~/.config/Claude/claude_desktop_config.json. It keeps its preferences in the same file, so the file stays writable, and each activation sets its mcpServers key to the local servers under programs.mcp.servers. Remote servers such as Context7 are added in the app’s own settings. With no local server declared, the file is left as the app keeps it, so removing the last local server leaves the entries the previous activation wrote, to be removed in the app or by hand. The app reads the file at launch, so a running app picks up a change after a restart.

Under impermanence the module persists ~/.config/Claude at mode 0700, which holds the app’s profile, its logs and the config file. The sign-in sits in the desktop keyring.

Orca

By default, Orca starts Claude Code with --dangerously-skip-permissions and Codex with --dangerously-bypass-approvals-and-sandbox. Every permission prompt is then gone for the sessions it starts, Claude Code’s deny list no longer applies, and Codex runs outside its sandbox. The setting lives in Orca’s own state, which no module can declare, so turn it off once per user in Settings → Agents → Agent Permissions → Manual. The choice persists with the rest of Orca’s state.

othrys.apps.ai.orca installs Orca for the user and needs a graphical session. Each task runs in its own git worktree under ~/orca/workspaces. Orca finds Claude Code, Codex and the other agents on the login shell’s PATH and bundles none of them. It writes status hooks into Claude Code’s and Codex’s settings, which is why both keep their settings writable.

disableTelemetry, on by default, wraps the package so that Orca starts with ORCA_TELEMETRY_DISABLED set, since a new install otherwise reports usage to PostHog. Orca still shows a notice when a newer release exists and downloads nothing.

Orca’s runtime port, 6768 by default, binds to loopback until network pairing is turned on in the app. The module opens it on no interface by default. othrys.apps.ai.orca.tailscale.enable opens it on Tailscale’s interface alone, and refuses a host without othrys Tailscale. A client then passes the tailnet’s ACLs and Orca’s per-client pairing token, and the tailnet’s ACL policy should limit that port to the user’s own devices. The port is never opened on the LAN, and Orca’s own documentation advises against exposing it.

Under impermanence the module persists ~/.config/orca, ~/.orca and ~/orca/workspaces, each at mode 0700. They hold the profiles and the permission setting above, the API key files, and the worktrees with the agents’ uncommitted work.

T3 Code

othrys.apps.ai.t3code installs T3 Code, a web and desktop interface that runs coding agents in threads. It installs t3 for the user in both modes. The agents it drives are the host’s own Codex and Claude Code packages, each one while its module is on, and the module refuses a host with neither. Upstream’s default package instead bundles five agents ahead of the user’s PATH, three of them unfree.

mode has no default, and a host that leaves it unset is refused. With "headless" the module runs t3 serve as a systemd user unit on NixOS and as a launchd agent on nix-darwin, restarted whenever it exits. On a NixOS host where othrys manages the user with Home Manager, the user lingers, so the unit runs from boot with nobody logged in. A launchd agent runs only while the user is logged in, so a Mac that serves T3 Code logs the user in at boot. With "desktop" it installs the desktop app, which starts its own server while a window is open, and it refuses a host without a graphical session. Only one server can use ~/.t3. A second one finds the first one’s lock in ~/.t3/userdata/server-owner.sqlite and exits, and the desktop app then quits with “This T3 home is unavailable”. A workstation in desktop mode reaches a headless host by adding it in the app as a saved environment.

# A headless host on the tailnet
othrys.services.tailscale.enable = true;
othrys.apps.ai.codex.enable = true;
othrys.apps.ai.t3code = {
  enable = true;
  mode = "headless";
  listen = "tailscale";
};

# A workstation
othrys.apps.ai.claude-code.enable = true;
othrys.apps.ai.t3code = {
  enable = true;
  mode = "desktop";
};

listen applies to the headless server alone, and desktop mode refuses any value but "loopback". "lan" passes upstream’s --lan, which binds every address and drops a peer outside loopback, the private ranges and the tailnet. On NixOS it opens port in the firewall. othrys controls no firewall on macOS, so there the peer filter and pairing are what protect the port. "tailscale" binds the tailnet IPv4 address that tailscale ip -4 gives when the server starts. With no address the server exits, and the service starts it again ten seconds later until tailscaled has one. On NixOS it opens port on Tailscale’s interface alone, and it refuses a host without othrys.services.tailscale.enable. Traffic is plain HTTP inside WireGuard. Upstream’s --tailscale-serve is not used, since its HTTPS needs node certificates from the control server, which headscale 0.29 does not issue.

Every mode but loopback asks a new client to pair. The server writes a pairing link at start, valid for five minutes, to the journal on NixOS and to ~/Library/Logs/t3code.log on darwin. t3 pair mints a new one later.

$ journalctl --user -u t3code
$ t3 pair

disableTelemetry, on by default, starts t3 and the desktop app with T3CODE_TELEMETRY_ENABLED=false. The desktop app also always starts with T3CODE_DISABLE_AUTO_UPDATE=1, since an app in the store cannot replace itself.

Under impermanence the module persists ~/.t3 at mode 0700, which holds the threads database, the server’s secrets, the settings and the git worktrees with the agents’ uncommitted work. Desktop mode also persists the Electron profile in ~/.config/t3code-v2 at 0700. ~/.cache/t3code is a compile cache and is not persisted. The agents’ sign-ins live in ~/.codex and ~/.claude, which their own modules persist.

Options

  options.othrys.apps.ai.t3code = {
    enable = lib.mkEnableOption "T3 Code, a control surface for coding agents";

    package = lib.mkOption {
      type = lib.types.package;
      default = (llmAgents.package "t3code").override {providerPackages = providers;};
      defaultText = lib.literalMD ''
        the `t3code` package of the llm-agents flake this library locks, with
        the packages of `othrys.apps.ai.codex` and `othrys.apps.ai.claude-code`
        as its agents, each one while its module is on
      '';
      description = ''
        The T3 Code package, whose `out` output holds the `t3` server and
        whose `desktop` output holds the desktop app. The default comes from
        cache.numtide.com, which the host then trusts. Upstream's own default
        puts five agents ahead of the user's PATH, three of them unfree. A
        package set here is used as given.
      '';
    };

    mode = lib.mkOption {
      type = lib.types.nullOr (lib.types.enum ["headless" "desktop"]);
      default = null;
      description = ''
        `"headless"` installs `t3` and runs `t3 serve` as a user service, a
        systemd unit on NixOS and a launchd agent on darwin. `"desktop"`
        installs the desktop app, which starts its own server while a window
        is open, beside `t3`. The two cannot share one `~/.t3`, since the
        second server finds the first one's lock and exits, so a host picks
        one.
      '';
    };

    listen = lib.mkOption {
      type = lib.types.enum ["loopback" "lan" "tailscale"];
      default = "loopback";
      description = ''
        Where the headless server listens. `"loopback"` keeps it to this
        host. `"lan"` binds every address and drops any peer outside
        loopback, the private ranges and the tailnet, and on NixOS opens
        `port` in the firewall. `"tailscale"` binds the host's tailnet
        address alone and on NixOS opens `port` on Tailscale's interface.
        Every mode but loopback asks a new client to pair, with a link from
        `t3 pair`.
      '';
    };

    port = lib.mkOption {
      type = lib.types.port;
      default = 3773;
      description = "Port the headless server listens on, which is upstream's own default.";
    };

    disableTelemetry = lib.mkOption {
      type = lib.types.bool;
      default = true;
      description = ''
        Start `t3` and the desktop app with `T3CODE_TELEMETRY_ENABLED` set
        to false, which turns off the product events T3 Code sends.
      '';
    };
  };

Paseo

othrys.apps.ai.paseo installs Paseo’s paseo CLI for the user, and desktop.enable adds its desktop app. On darwin, Home Manager links Paseo.app into ~/Applications/Home Manager Apps, not /Applications. nixpkgs’ build turns the app’s self-update off, since a store path cannot change. The agents it drives are the host’s own Codex and Claude Code, which it finds on the daemon’s PATH as the launchers of the project environment, each one while its module is on. The module refuses a host with neither. T3 Code and Paseo can be enabled on one host, and they share no state or port.

Without service.enable the module runs no daemon. The desktop app then starts a daemon of its own, which reads none of the module’s daemon options, so the module refuses listen, relay.enable, passwordFile and direnv.enable without the service. With service.enable the daemon runs as a systemd user unit on NixOS, restarted ten seconds after it exits, and as a launchd agent on nix-darwin, started again no sooner than ten seconds after its last start. The desktop app attaches to it. On a NixOS host where othrys manages the user with Home Manager, the user lingers, so the unit runs from boot with nobody logged in. The launchd agent runs while the user is logged in. The service runs paseo-server directly, since paseo daemon start drops every PASEO_* variable the module sets. The log is in the journal on NixOS and in ~/Library/Logs/paseo.log on darwin.

othrys.services.tailscale.enable = true;
othrys.apps.ai.codex.enable = true;
othrys.apps.ai.paseo = {
  enable = true;
  service.enable = true;
  listen = "tailscale";
  passwordFile = "/run/secrets/paseo-password";
};

"lan" binds every address and on NixOS opens port in the firewall. "tailscale" binds the tailnet IPv4 address and admits the host’s MagicDNS name, read when the daemon starts. With no address the daemon exits and the service starts it again until tailscaled has one. On NixOS it opens port on Tailscale’s interface alone, and it refuses a host without othrys.services.tailscale.enable. othrys controls no firewall on macOS. Outside loopback, any peer that reaches the port controls the host’s agents unless the daemon has a password, and the module warns while passwordFile is unset. A password set with paseo daemon set-password also counts, while passwordFile wins over it. A password file the daemon cannot read stops it.

The hosted relay at relay.paseo.sh stays off unless relay.enable is set. The setting is passed as PASEO_RELAY_ENABLED at every start, so a config.json that omits it does not turn the relay on.

webUi.enable makes the daemon serve Paseo’s browser UI on its own port, beside the API and the WebSocket, and the setting is passed as PASEO_WEB_UI_ENABLED at every start, so config.json cannot turn it on. The page loads without the password, while the API behind it asks for one. The daemon refuses a request whose Host header is neither one of its addresses nor a listed name, which guards against DNS rebinding, so a reverse proxy’s name goes in hostnames. The proxy must pass the Host header through unchanged and forward the WebSocket upgrade at /ws.

othrys.apps.ai.paseo = {
  enable = true;
  service.enable = true;
  listen = "tailscale";
  webUi.enable = true;
  hostnames = ["paseo.example.com"];
  passwordFile = "/run/secrets/paseo-password";
};

direnv.enable defaults to on while the service and othrys.apps.ai.projectEnvironment.enable are both on. It loads the paseo-direnv plugin, which loads the direnv environment of each agent’s directory before the agent starts. It is on by default because it is the project environment’s counterpart inside Paseo. Without it, a Codex agent the daemon starts misses the environment that the launcher gives the same agent started from a shell. The plugin runs unsandboxed with the user’s access, so a host that does not want it sets direnv.enable = false. That covers Codex agents, whose process Paseo starts with no working directory, and the app offers to allow or deny a blocked .envrc. The plugin comes from its own flake input, which only a host with the option on fetches. Paseo enables plugins only through ~/.paseo/config.json, so the start script sets pluginsEnabled and the plugin’s own entry there at every start. While the option is off, each Home Manager switch and each start remove an entry that points into the store, which an earlier generation wrote, so a daemon othrys does not start, such as the desktop app’s own, loads no collected store path. An entry pointed at a checkout of the user’s own stays. The file is rewritten only when the entry changes, and nothing else in it is touched. A config.json that jq cannot read, an empty one included, stops the daemon and is left as it is. Turning othrys.apps.ai.paseo.enable off removes nothing, so delete the paseo-direnv entry by hand if Paseo still runs outside othrys. A new worktree inherits trust as othrys.apps.ai.projectEnvironment.trustWorktrees says, passed as PASEO_DIRENV_TRUST_WORKTREES. The variable wins over the plugin’s toggle under Settings → Plugins → direnv → Worktrees, which shows the value disabled.

Under impermanence the module persists ~/.paseo at mode 0700, which holds config.json with the password hash, the daemon’s key pair, the plugins’ settings, the agents’ state and the git worktrees with their uncommitted work. With desktop.enable it also persists the app’s profile in ~/.config/Paseo at 0700.

Options

  options.othrys.apps.ai.paseo = {
    enable = lib.mkEnableOption "Paseo, a self-hosted daemon and CLI for orchestrating coding agents";

    package = lib.mkOption {
      type = lib.types.package;
      default = pkgs.paseo;
      defaultText = lib.literalExpression "pkgs.paseo";
      description = ''
        The Paseo package, which holds the `paseo` CLI, the `paseo-server`
        daemon and the web UI the daemon serves.
      '';
    };

    service.enable = lib.mkEnableOption ''
      the Paseo daemon as a user service, a systemd unit on NixOS and a
      launchd agent on darwin. The desktop app attaches to this daemon
      instead of starting its own'';

    desktop = {
      enable = lib.mkEnableOption ''
        the Paseo desktop app. Without `service.enable` the app
        starts a daemon of its own, which reads none of the options below'';

      package = lib.mkOption {
        type = lib.types.package;
        default = pkgs.paseo.desktop;
        defaultText = lib.literalExpression "pkgs.paseo.desktop";
        description = ''
          The Paseo desktop package, which holds `Paseo.app` on darwin.
        '';
      };
    };

    listen = lib.mkOption {
      type = lib.types.enum ["loopback" "lan" "tailscale"];
      default = "loopback";
      description = ''
        Where the daemon listens. `"loopback"` keeps it to this host. `"lan"`
        binds every address and on NixOS opens `port` in the firewall.
        `"tailscale"` binds the host's tailnet address alone, admits the
        host's MagicDNS name in the Host header and on NixOS opens `port` on
        Tailscale's interface. Every peer that reaches the port can connect
        unless `passwordFile` is set.
      '';
    };

    port = lib.mkOption {
      type = lib.types.port;
      default = 6767;
      description = "Port the daemon listens on, which is upstream's own default.";
    };

    relay.enable = lib.mkEnableOption ''
      the hosted relay at relay.paseo.sh, through which a client outside the
      network reaches the daemon. The daemon then keeps an outbound
      connection to that server, and the traffic over it is end-to-end
      encrypted'';

    webUi.enable = lib.mkEnableOption ''
      the browser UI the daemon serves on its own port, beside its API and
      WebSocket. The page itself loads without the password, while the API
      behind it asks for one'';

    hostnames = lib.mkOption {
      type = lib.types.listOf lib.types.str;
      default = [];
      example = ["paseo.example.com"];
      description = ''
        Hostnames the daemon accepts in the Host header besides its own
        addresses, such as the name a reverse proxy serves it under. The
        daemon refuses any other name, which guards against DNS rebinding.
        `"tailscale"` adds the host's MagicDNS name on its own.
      '';
    };

    passwordFile = lib.mkOption {
      type = lib.types.nullOr lib.types.str;
      default = null;
      example = "/run/secrets/paseo-password";
      description = ''
        A file holding the daemon's password, read when the daemon starts, so
        the password stays out of the store. It takes precedence over a hash
        that `paseo daemon set-password` wrote to `~/.paseo/config.json`.
      '';
    };

    direnv = {
      enable = lib.mkOption {
        type = lib.types.bool;
        default = cfg.service.enable && envCfg.enable;
        defaultText = lib.literalExpression "othrys.apps.ai.paseo.service.enable && othrys.apps.ai.projectEnvironment.enable";
        description = ''
          The paseo-direnv plugin in the daemon othrys runs. It loads the
          direnv environment of each agent's directory before the agent
          starts, and offers to allow a blocked `.envrc` in the app. A new
          git worktree inherits trust as
          othrys.apps.ai.projectEnvironment.trustWorktrees says, and the
          plugin's own toggle shows that value disabled.
        '';
      };

      package = lib.mkOption {
        type = lib.types.package;
        default = othrysInputs.paseo-direnv.packages.${pkgs.stdenv.hostPlatform.system}.default;
        defaultText = lib.literalMD "the default package of the paseo-direnv flake this library locks";
        description = ''
          The paseo-direnv plugin, a directory holding its manifest and its
          TypeScript source, which Paseo compiles when it loads it.
        '';
      };
    };
  };

Claude Code’s settings file

Claude Code’s settings.json is merged at each activation rather than linked read-only. The declared settings win, while keys that Claude Code or a program it runs adds itself stay in place, such as the status hooks Orca writes. A host that wants the file read-only sets home-manager.users.<name>.programs.claude-code.mutableSettings = false.

What the Claude Code permission lists are for

othrys.apps.ai.claude-code ships an allow-list and a deny-list, and it is worth being plain about what they do. They reduce prompting for commands you would approve anyway, and they catch a careless mistake. They are not a security boundary.

A rule matches a command string, and a string has endless spellings. rm -rf is denied while rm -fr is not. sudo is denied while pkexec is not. Read(./.env) is denied while cat .env arrives as a Bash invocation and matches nothing. Anything that can run a shell can reach whatever the user can reach, so the boundary that actually holds is whether the repository is one you trust.

Three defaults follow from that. Every allow-list entry names a tool and a command prefix, and no bare tool name appears, since a bare Edit approves every edit and is acceptEdits by another route. Bash(just:*), Bash(find:*), Bash(nix eval:*) and Bash(nix fmt:*) are absent, because each one runs whatever a repository hands it, through a recipe, -exec, --expr or the repository’s own formatter. And permissions.defaultMode is "default", so edits are prompted rather than applied. Hosts that want any of them back set permissions.extraAllow and permissions.defaultMode explicitly, which keeps the decision visible in the host configuration rather than inherited from a library. The module registers no hooks of its own.

theme takes one of Claude Code’s six themes, dark, light, dark-daltonized, light-daltonized, dark-ansi and light-ansi. Any other value is refused at evaluation.

Shared skills and context

Two things are declared once and handed to every enabled assistant.

othrys.apps.ai.skills holds skills in the Agent Skills layout, keyed by name. A value is the text of a SKILL.md, the path of one, or the path of a directory that holds one. A name is lower-case letters, digits and single hyphens, and any other name is refused at evaluation. A skill for one tool alone goes to that tool’s own option, such as othrys.apps.ai.claude-code.skills, and an entry there replaces a shared one of the same name.

othrys.apps.ai.skills.release-notes = ./skills/release-notes;

othrys.apps.ai.context is the global context. Its first part describes the host the assistant runs on, and context.nixos.enable = false leaves it out. It defaults to off on darwin, where the text about NixOS does not apply. The line about the root wipe is rendered from othrys.system.impermanence.enable, so a host with a persistent root is not told its root is wiped. The line about where to store data follows the same option. It says “only in $HOME” on a host that wipes its root and suggests the home directory on every other host. context.extra holds the host’s own lines, which follow that text. context.text is the rendered result.

othrys.apps.ai.mcp.context is a removed option, and its text is othrys.apps.ai.context.text.

Ollama

othrys.apps.ai.ollama runs the Ollama server on the address in host and the port in port, 127.0.0.1 and 11434 by default. It pulls the models in loadModels at start and persists them. acceleration picks the package, and its default follows the host. An othrys.hardware.nvidia host gets ollama-cuda, any other host with hardware.graphics.enable gets ollama-vulkan, which runs on AMD and Intel cards, and a host without graphics gets ollama-cpu. An AMD host that wants ROCm sets acceleration = "rocm". The CUDA build is unfree and pulls the CUDA toolkit, so a host without an NVIDIA card never gets it by default.

host = "0.0.0.0" or host = "::" serves every address. Ollama asks for no credentials, so anything that reaches the port can run models. On NixOS the module opens no port in the firewall, so while networking.firewall.enable is on the host opens it where it wants clients, for example with networking.firewall.interfaces.<name>.allowedTCPPorts. On nix-darwin nothing closes the port, so an address other than loopback is reachable from the network as soon as the agent starts.

othrys.apps.ai.ollama = {
  enable = true;
  host = "0.0.0.0";
};
networking.firewall.interfaces.eth0.allowedTCPPorts = [11434];

The module sets OLLAMA_HOST for the user, so the ollama client finds the server. When the server binds every address, the variable points at the loopback of that family, 127.0.0.1 for 0.0.0.0 and [::1] for ::, and otherwise at the address the server binds. An IPv6 address is put in brackets for the server and the client alike, since both upstream modules join the host and the port with a bare colon. The module hands the server both values as defaults, and the variable is read from the server’s merged values, so a host that sets services.ollama.host or services.ollama.port itself still points the client at the server.

On nix-darwin, which has no Ollama service, the server is Home Manager’s services.ollama. It runs as the user’s launchd agent on the same host and port and reaches the user through darwinModules.home, so a host without a managed account gets no server. The CUDA, ROCm and Vulkan variants are Linux only, so acceleration defaults to "cpu" there, which names nixpkgs’ one darwin build, and any other value is refused. Home Manager’s agent pulls no models, so loadModels is refused as well, and the user runs ollama pull.

MCP Servers

Model Context Protocol servers provide AI assistants with live tool access. othrys.apps.ai.mcp.context7 serves up-to-date library documentation and code examples, and takes no credential.

The NixOS MCP server is gone. It depended on fastmcp, which nixpkgs marked broken, and the nix CLI answers the same questions. nix search nixpkgs finds packages, and man configuration.nix and man home-configuration.nix list the options. A host that still sets othrys.apps.ai.mcp.nixos fails evaluation with that advice.

GitHub

There is no GitHub MCP server. An agent reaches GitHub through the gh CLI, which acts with the user’s own login, so no separate long-lived token is kept for the agent. othrys.apps.gh configures it, and on a host that also enables Claude Code it adds the read-only gh commands to the allow-list. Reading an issue, a pull request, a workflow run or a release then runs without a prompt, while every command that writes to GitHub is prompted.

othrys.apps.ai.mcp.github is a removed option, and a host that still sets it fails at evaluation with a message naming othrys.apps.gh.

Installation

Fresh install from NixOS installation media, using this library’s disko and impermanence modules from your own fleet flake. Commands below use the fleet justfile described in the Justfile reference. Substitute your host names throughout.

Prerequisites

  • NixOS installation media (Ventoy recommended)
  • A fleet flake consuming othrys.nix, with a host defined that imports nixosModules.disko and the disko module (see Host Configuration)
  • Target disk identifier (ls -l /dev/disk/by-id/)
  • YubiKey (for secrets management, post-install)

Steps

1. Boot Installer and Clone

git clone <your-fleet-repo-url>
cd <your-fleet-repo>

2. Partition and Format

# WARNING: This erases the target disk!
just disk <hostname>

This runs disko in destroy/format/mount mode using the host’s disk configuration. You’ll be prompted to set the LUKS recovery passphrase interactively (sops secrets don’t exist yet at this stage). Keep it safe, since it’s the break-glass fallback if your YubiKeys are ever unavailable.

3. Install NixOS

just install <hostname>

4. Reboot

reboot

5. Post-Install

After first boot (unlock with the recovery passphrase from step 2):

  • Verify system with just build <hostname>
  • Set up YubiKey: just yubikey-onboard (see YubiKey Onboarding)
  • Enroll each YubiKey for disk unlock: just luks-enroll (run once per key, since the extra keys are your backup). Afterwards, boot unlocks via YubiKey touch + PIN, with the recovery passphrase as fallback.
  • Apply permanent config: just switch <hostname>

Host Disk Configuration

Each host’s disk is configured in your fleet’s hosts/<hostname>/default.nix via othrys.system.disko. Update the device path to match your hardware. YubiKey unlock is toggled with luks.fido2.enable (which also switches swap to ephemeral random-key encryption, so hibernation is disabled).

Daily Usage

Common workflows for maintaining a system built on these modules. Host commands run from your fleet repo, development commands from either repo.

Rebuild Workflow

# 1. Build without applying (syntax + dependency check)
just build <hostname>

# 2. Show what will change
just diff <hostname>

# 3. Test changes (temporary, reverts on reboot)
just test <hostname>

# 4. Apply permanently
just switch <hostname>

Update Dependencies

# Update all flake inputs
just update

# Update a specific input
just update nixpkgs

Maintenance

# Garbage collect + optimize (delete generations older than 7 days)
just maintain

# Just garbage collect
just gc 7d

# Optimize nix store
just optimize

# Remove build artifacts
just clean

Rollback

Since impermanence wipes root on boot, rollback works at the bootloader level. Previous generations are available in the boot menu.

Development

# Enter the default dev shell
just dev

# Enter a specific dev shell
just dev rust
just dev python
just dev javascript

Adding Modules

How to create a new NixOS module in this repository.

Steps

1. Create the Module File

Modules live at modules/{category}/{name}.nix, where the category is one of system, desktop, hardware, services or apps. Application modules sit one level further down, under modules/apps/cli/ or modules/apps/gui/.

2. Define Options and Config

# modules/{category}/{name}.nix
# One line saying what this module is for
{
  config,
  lib,
  pkgs,
  ...
}: let
  cfg = config.othrys.{category}.{name};
in {
  options.othrys.{category}.{name} = {
    enable = lib.mkEnableOption "Description of the module";
  };

  config = lib.mkIf cfg.enable {
    othrys.internal.persist."{category}.{name}" = {
      user.directories = [
        ".config/{name}"
      ];
    };

    othrys.internal.homeConfig."{category}.{name}" = {
      home.packages = with pkgs; [package-name];
    };
  };
}

This is the template in CONTRIBUTING.md, and modules/apps/cli/gh.nix is a module that follows it.

There is no username module argument. A module that needs the primary user reads config.othrys.system.user.name, and puts every account write behind a guard on othrys.system.users.enable, since the option has no default and a headless host can leave it unset. The template needs neither, because both of its per-user writes go through a registry.

User configuration goes into othrys.internal.homeConfig, under a key that is the module’s own option path. modules/system/home.nix, exported as nixosModules.home, splices every entry into home-manager.users.<name> behind othrys.system.users.homeManaged, so the module spells no Home Manager guard of its own. A module never writes home-manager.users directly and never reads config.home-manager, and the contract-guards hook rejects one that does. Those options exist only on a host that imports the Home Manager module, which nixosModules.default does not require. A module whose user configuration depends on a second option wraps the whole entry in a top-level lib.mkIf, as modules/services/docs.nix does.

othrys.internal.homeConfig."services.docs" = lib.mkIf cfg.desktopEntry {
  # User-level configuration
};

Persistent paths go into othrys.internal.persist, under the same key. Paths in the primary user’s home go under user, relative to it, and a system path goes in directories or files, as in modules/services/traefik.nix.

othrys.internal.persist."services.{service}" = {
  directories = [
    "/var/lib/{service}"
  ];
};

The module spells no guard here either. modules/system/impermanence.nix, exported as nixosModules.impermanence, splices the registry into environment.persistence when impermanence is on, and leaves the paths under user out on a host with no managed account. A module never writes environment.persistence directly. That option exists only on a host that imports the impermanence module, so a direct write fails on every other host, and the contract-guards hook rejects it.

3. Import in Category default.nix

Add the import to modules/{category}/default.nix:

imports = [
  ./{name}.nix
  # ... other modules
];

4. Enable in the Consuming Flake

Modules stay inert until a consuming flake turns them on. Where the enable goes is that flake’s business, whether in a shared profile imported by several hosts or in one host’s own configuration:

# e.g. hosts/<hostname>/default.nix in your flake
othrys.{category}.{name}.enable = true;

5. Test

just check

That is the whole of what this repository can verify, since it holds no hosts. Building an actual machine happens in the flake that consumes this one, against its own host definitions.

Conventions

Comments here earn their place or they get deleted. Four kinds are load-bearing.

File header. Every .nix file under modules/ and flake/ opens with two lines, the repository-relative path and a one-line statement of purpose. The path line matters because these files are read as {{#include}} fragments in the documentation, stripped of their filename.

# modules/services/example.nix
# What this module is for, in one line

Anchor markers. # ANCHOR: <name> and # ANCHOR_END: <name> mark the regions that documentation pages embed. Naming follows two rules. An options block anchors as <basename>-options. A config excerpt anchors as <basename>-<what> with a suffix describing what the excerpt shows, as in disko-partitions or hyprland-keybindings.

Add an anchor only when a documentation page actually embeds it. Every option is already published in docs/src/reference/options.md, generated from the module tree, so an anchor that no page includes is duplication with a maintenance cost and nothing reading it. The comment-hygiene check fails on one.

Prose that must exist in two places. Anchor it and add the pair to contract-mirror in flake/checks/. The consumer contract is the worked example. CONTRIBUTING.md holds the canonical copy, docs/src/architecture/ embeds it through mdbook, and AGENTS.md carries an enforced duplicate because an agent reads that file automatically and would otherwise have to be told to go and fetch the contract. Duplication is only dangerous when the copies can disagree unnoticed, so the hook diffs the two regions and turns the copy into a mirror. Only one such block exists today, and the hook stays specific to it until a second one appears.

Rationale. Comments that answer why, never what. A guard that has to sit at the attrset level, an assertion that needs its own mkIf, an upstream defect and the check that guards against its return. These are the comments worth writing at length, since they carry knowledge the code cannot.

Attribution. Where a module is adapted from another project, say so and name it.

Everything else goes. No banner rules, no # ==== separators and no boxed headers. No comment that restates the line beneath it. No NOTE:, TODO: or FIXME: prefixes. No em dashes anywhere, in comments or in prose.

Section labels inside long literal configuration blocks are the exception that survives, since a # Cursor label over five cursor settings in a hundred-line terminal config is navigation rather than restatement.

Theming

Every othrys module that draws colour reads one place, othrys.theme. It holds a base16 palette, two fonts, window opacity, the polarity and the wallpaper. The compositors, the bar, the prompt, tmux, the browser, the game overlay and the editor dashboard take their colours from othrys.theme.palette and from nothing else.

Each value is nullable, and null has one meaning throughout. A module that finds a null value writes nothing for that setting, and the application keeps its own look. A host with no palette still gets a working compositor, bar and prompt.

othrys.theme is part of nixosModules.default and depends on no theming framework. Stylix is supported through a separate export, described below, which themes the applications othrys does not configure itself.

Choosing a Scheme and a Polarity

A scheme is a named pair of palettes, one dark and one light. scheme picks the pair and polarity picks the half.

othrys.theme = {
  scheme = "oxocarbon"; # the default
  polarity = "dark";    # "dark" or "light", dark by default
};

othrys ships one scheme, oxocarbon, in modules/theme/schemes/oxocarbon.nix. A name that is in no scheme table fails an assertion that lists the names the host does have.

Adding a Scheme of Your Own

othrys.theme.schemes is an attribute set of schemes, and a host adds to it in its own configuration. Nothing in this repository has to change. A scheme holds dark and light, and each is an attribute set of colours written as six hexadecimal digits with no #.

othrys.theme = {
  schemes.gruvbox = {
    dark = {
      base00 = "282828"; # Background
      base01 = "3c3836"; # Lighter background
      base02 = "504945"; # Selection
      base03 = "665c54"; # Comments
      base04 = "bdae93"; # Dark foreground
      base05 = "d5c4a1"; # Foreground
      base06 = "ebdbb2"; # Light foreground
      base07 = "fbf1c7"; # Lightest foreground
      base08 = "fb4934"; # Red
      base09 = "fe8019"; # Orange
      base0A = "fabd2f"; # Yellow
      base0B = "b8bb26"; # Green
      base0C = "8ec07c"; # Cyan
      base0D = "83a598"; # Blue
      base0E = "d3869b"; # Purple
      base0F = "d65d0e"; # Brown
    };
    light = {
      base00 = "fbf1c7";
      base01 = "ebdbb2";
      base02 = "d5c4a1";
      base03 = "bdae93";
      base04 = "665c54";
      base05 = "504945";
      base06 = "3c3836";
      base07 = "282828";
      base08 = "9d0006";
      base09 = "af3a03";
      base0A = "b57614";
      base0B = "79740e";
      base0C = "427b58";
      base0D = "076678";
      base0E = "8f3f71";
      base0F = "d65d0e";
    };
  };
  scheme = "gruvbox";
};

The sixteen base16 colours base00 to base0F are required in both halves. The eight base24 colours base10 to base17 are optional. A palette that lacks a required colour, or holds a key outside those twenty-four, is refused under the option’s own name. Definitions of schemes merge, so adding a scheme leaves oxocarbon available, and a host can change one colour of a shipped scheme without restating the rest.

othrys.theme.schemes.oxocarbon.dark.base00 = lib.mkForce "000000";

The name wallpaper is reserved, since scheme = "wallpaper" has another meaning.

Setting a Palette Directly

othrys.theme.palette is the value the modules read. Its default is the chosen scheme at the chosen polarity, and a host can set it to any palette of the same shape, from any source that produces one.

othrys.theme.palette = builtins.fromJSON (builtins.readFile ./palette.json);

A palette set this way reaches the othrys modules and does not reach Stylix, which takes its colours from the scheme table. A host that uses the Stylix export defines a scheme instead.

othrys.theme.colors is derived from the palette and is not set. A module that needs the colour with a leading # reads colors.withHashtag.<name>, and one that needs the red, green and blue channels as integers reads colors.rgb.<name>.

Fonts and Opacity

othrys.theme = {
  fonts.sansSerif = {
    name = "Inter";
    package = pkgs.inter;
  };
  fonts.monospace = {
    name = "JetBrainsMono Nerd Font";
    package = pkgs.nerd-fonts.jetbrains-mono;
  };
  opacity.terminal = 0.95;
};

Each font is a family name and, optionally, the package that provides it, which othrys adds to fonts.packages. The bar reads fonts.sansSerif. Both fonts and the opacity are null by default.

Wallpapers

othrys.theme.wallpaper holds the wallpaper, and othrys.desktop.wallpaper draws it with wpaperd under Hyprland and niri alike. The daemon starts by itself on a host that runs an othrys compositor and declares a wallpaper, as the desktop page describes. No image ships with this library, so a host provides its own.

The Forms of a Source

source is null by default, which sets no wallpaper. The three other forms differ in where the images live.

A Nix path is one image. It is copied into the store, so the wallpaper is part of the system and changes with a rebuild. A package that builds an image is accepted in the same place.

othrys.theme.wallpaper.source = ./wallpaper.png;

A list of images is a set the daemon picks from. Each image is copied into the store, and othrys builds a directory of links to them for the daemon to read.

othrys.theme.wallpaper.source = [
  ./wallpapers/dawn.png
  ./wallpapers/noon.png
  ./wallpapers/dusk.png
];

A string is a directory the daemon reads while the session runs. It starts with / or with ~/, which the daemon expands to the home directory. Nothing is copied, so an image added to the directory is picked up without a rebuild.

othrys.theme.wallpaper.source = "~/Pictures/Wallpapers";

Any other value is refused when the option is read. That includes a relative string, an empty list and a list that holds a run-time string.

Rotation

interval is the time one image stays on screen, as a number of seconds or as a duration such as "30s", "10m" or "1h 30m". Null, the default, keeps the image the session started with. order is random by default, and ascending or descending go through the file names in order. A list is linked under names that carry each image’s position, so ascending shows a list in the order it is written.

othrys.theme.wallpaper = {
  source = "~/Pictures/Wallpapers";
  interval = "10m";
  order = "ascending";
};

Both options have an effect only when source is a list or a directory. With a single image they are left out of the daemon’s configuration. The daemon does the rotating, and othrys adds no timer of its own.

fill decides how an image that does not match the screen is drawn. center, the default, covers the screen and crops what does not fit. fit shows the whole image with black borders, fit-border-color takes the border colour from the image’s edge, stretch changes the aspect ratio, and tile repeats the image.

Per-Monitor Overrides

outputs is keyed by the name the compositor gives a monitor, which hyprctl monitors or niri msg outputs prints. Each entry holds the same source, interval, order and fill. A value left out takes the one set for every monitor, and a monitor with no entry uses the top-level settings as they are.

othrys.theme.wallpaper = {
  source = "~/Pictures/Wallpapers";
  interval = "10m";

  outputs = {
    # the same directory and interval, shown whole on a portrait monitor
    "DP-2".fill = "fit";
    # one fixed image, which does not rotate
    "HDMI-A-1".source = ./wallpapers/dusk.png;
  };
};

A host can also declare a wallpaper for single monitors only and leave the top-level source null. The monitors with no entry then show no wallpaper.

The Primary Image

Some consumers need exactly one image that is known when the system is built. primary is that image. It is source when source is one image and the first element when source is a list, so a host with either form sets nothing further.

A directory read at run time has no image that is known at evaluation, and primary is null for it. A host that needs one names it.

othrys.theme.wallpaper = {
  source = "~/Pictures/Wallpapers";
  primary = ./wallpapers/dawn.png;
};

primary does not change what is drawn. It is read by colour from the wallpaper and by the Stylix export.

The Stylix Export

nixosModules.stylix is the adapter between othrys.theme and Stylix. nixosModules.default does not import it, so a host that wants Stylix imports the adapter and the Stylix module together, and a host that does not imports neither. nixosModules.full holds both, so a host built from it only sets the option.

# flake.nix
inputs.stylix.follows = "othrys/stylix";

# the host's module list
modules = [
  inputs.othrys.nixosModules.default
  inputs.othrys.nixosModules.stylix
  inputs.stylix.nixosModules.stylix
  # ...
  {othrys.system.stylix.enable = true;}
];

With othrys.system.stylix.enable set, the adapter does four things.

  • It configures Stylix from the theme. stylix.base16Scheme is the chosen scheme at the chosen polarity, stylix.polarity follows othrys.theme.polarity, and stylix.image is othrys.theme.wallpaper.primary.
  • It sets the taste values Stylix needs. Fonts, font sizes, a cursor, opacities and an icon theme are each written with mkDefault, so a host replaces one with a plain assignment to the Stylix option.
  • It fills the theme back. othrys.theme.fonts and othrys.theme.opacity default to the values Stylix ends up with, so the bar is drawn in the font Stylix gives every other application.
  • It carries the Stylix targets othrys modules need. The Floorp target is switched on for the profile the Floorp module creates. While othrys.desktop.wallpaper is on, Stylix’s hyprland.hyprpaper, hyprpaper and wpaperd targets are switched off, since othrys draws the wallpaper itself and two programs would draw over each other. While othrys.apps.tmux is on, the tmux target is switched off, since the tmux module colours tmux itself. A host that wants the Stylix theme there sets stylix.targets.tmux.enable = lib.mkForce true.

Stylix takes one image, so it is handed primary and never the list or the directory. The targets that show an image, such as the lock screen, show that one. With a run-time directory and no primary, stylix.image is null and those targets show none, while the desktop wallpaper is drawn as declared.

Stylix then themes what othrys leaves alone, which includes the console, Plymouth, GTK, the terminals and the cursor. othrys.system.stylix.gui.enable follows othrys.desktop.graphical, and with it off only the console and Plymouth targets remain, which suits a server. The adapter sets no Qt target.

A font or an opacity is changed on the Stylix side, and the theme follows.

stylix.fonts.monospace = {
  package = pkgs.nerd-fonts.fira-code;
  name = "FiraCode Nerd Font";
};
stylix.opacity.terminal = 1.0;

The adapter also exports the palette as BASE00 to BASE0F and COLOR_* session variables and installs show-colors, which prints the palette with its hex values and a swatch of each colour.

A nix-darwin host imports darwinModules.stylix with the darwinModules.stylix of the stylix flake, or takes both from darwinModules.full. Stylix themes the fonts, jankyborders and neovim at the system level there, and the terminals and editors through Home Manager, so the host imports darwinModules.home as well. The scheme, the fonts, the opacities, the session variables and show-colors are the same as on NixOS. Stylix declares no cursor, console or Plymouth target on darwin. The adapter sets no cursor and no GTK icon theme there, and turns the user’s GTK target off, since a Mac has no GTK desktop.

othrys.system.stylix.scheme, polarity and wallpaper are the former names of othrys.theme.scheme, othrys.theme.polarity and othrys.theme.wallpaper.source. They still work on a host that imports the adapter, and each prints a warning naming its replacement.

Colour from the Wallpaper

othrys.theme.scheme = "wallpaper" derives the palette from othrys.theme.wallpaper.primary, with polarity deciding between a dark and a light result. Stylix holds the generator, so this value needs the Stylix export with othrys.system.stylix.enable set. Without it the host fails an assertion that names nixosModules.stylix and darwinModules.stylix, and without a wallpaper it fails one that names othrys.theme.wallpaper.source. A source that is a directory read at run time gives the generator no image, so such a host fails an assertion that names othrys.theme.wallpaper.primary until it sets that option.

othrys.theme = {
  scheme = "wallpaper";
  polarity = "dark";
  wallpaper.source = ./wallpaper.png;
};
othrys.system.stylix.enable = true;

The palette is generated when the system is built and copied into othrys.theme.palette, so the othrys modules and Stylix draw the same colours. A new primary image takes effect at the next rebuild. othrys does not change colours while the session runs, so a rotating wallpaper keeps the palette of its primary image.

Handing Colour to a Run-Time Tool

A tool that recolours the session while it runs, from the wallpaper or from the time of day, needs othrys to write no colour of its own. Setting othrys.theme.scheme = null leaves the palette null, and every module then omits its colours. The compositors keep their own border colours, the bar and the overlay keep their defaults, Floorp gets no stylesheet, and the editor dashboard falls back to fixed neutral colours. The prompt and the tmux status line keep their layout and name their colours by ANSI name, so it follows whatever the tool does to the terminal’s palette. Everything that is not colour stays themed. The bar still reads othrys.theme.fonts, Floorp still follows polarity for its dark or light variant, and the wallpaper option is unchanged. The Stylix export cannot be enabled on such a host, since Stylix does not run without a palette.

Oxocarbon Colour Reference

The dark half of oxocarbon, drawn from IBM’s Carbon palette. The roles are the ones the scheme file’s own comments give.

BaseRoleHex
base00Background#161616
base01Lighter BG#262626
base02Selection#393939
base03Comments#525252
base04Dark FG#6f6f6f
base05Foreground#f4f4f4
base06Light FG#ffffff
base07Light BG#e0e0e0
base08Red#fa4d56
base09Orange#ff832b
base0AYellow#f1c21b
base0BGreen#42be65
base0CCyan#3ddbd9
base0DBlue#4589ff
base0EPurple#be95ff
base0FMagenta#ff7eb6
base10Bright black#525252
base11Bright red#ff8389
base12Bright green#6fdc8c
base13Bright yellow#fddc69
base14Bright blue#78a9ff
base15Bright purple#d4bbff
base16Bright cyan#08bdba
base17Bright white#ffffff

YubiKey Onboarding

Interactive script for provisioning one or more YubiKeys with PGP keys, U2F credentials, and age identity for sops-nix. Supports both new key generation and key rotation from an existing backup. Follows drduh’s YubiKey Guide.

Quick Start

# New key generation
just yubikey-onboard

# Key rotation from the backup directory a previous run left
just yubikey-onboard -- --from-backup /mnt/usb/yubikey-backup

# Health check on currently inserted YubiKey
just yubikey-onboard -- --verify

Options

Modes

FlagDescription
(default)Generate new PGP keys and provision YubiKey(s)
--from-backup <path>Import an existing master key and provision YubiKey(s) (key rotation). The path is a backup directory, master-secret.key.age, master-secret.key.pass.age or a plaintext master-secret.key
--verifyCheck the currently inserted YubiKey’s health and config

Key Identity

FlagDescription
--name <name>Real name for the PGP key
--email <email>Email address for the PGP key
--expiry <duration>Subkey expiry period (default: 2y)

Name and email have no defaults. Both are prompted for when the flag is absent, and an empty answer is refused, since the pair becomes a permanent PGP identity.

Provisioning

FlagDescription
--backup-dir <path>Master key backup directory (required, skips the prompt)
--force-volatileAllow a backup directory the host may not persist
--no-passphraseLeave the master key unprotected (escape hatch)
--algo <algorithm>Force key algorithm: ed25519 or rsa4096 (auto-detected by default)
--key-count <n>Number of YubiKeys to provision (skips the “provision another?” prompt)
--allow-default-pinsFinish even when a PIN, PUK or management key was not changed in this run
--age-identity <file>age identity file that opens master-secret.key.age for --from-backup (default: the YubiKey in the reader)
--dry-runWalk through all phases. Touches no YubiKey and no keyring, and writes no file

The backup directory has no default either. It used to offer /tmp/yubikey-backup-<date>, which is predictable, unencrypted, and on most hosts does not survive a reboot, so pressing Enter put the only copy of a master key somewhere it could vanish. The script refuses a target that looks volatile, by filesystem type or by path, and --force-volatile overrides that for an operator who knows the location is kept.

A dry run reads no token, so the serial it prints is the word dry-run and the firmware is assumed to be current. It prints the directory a real run would save its summary under and creates nothing there.

Encrypted Backup

FlagDescription
--age-recipient <r>Extra age recipient for the token copies, repeatable
--no-age-passphraseSkip the passphrase-encrypted copies
--keep-plaintextKeep the plaintext exports after the encrypted copies verify
--no-age-backupDo not produce encrypted copies at all

Examples

# Preview the full workflow without touching the YubiKey
just yubikey-onboard -- --dry-run

# Non-interactive new key generation for 2 YubiKeys
just yubikey-onboard -- --name "alice" --email "alice@example.com" \
  --expiry 2y --backup-dir /mnt/usb/backup --key-count 2

# Rotate from the passphrase copy, which needs no token to open
just yubikey-onboard -- --from-backup /mnt/usb/backup/master-secret.key.pass.age

# Rotate from the token copy, opened by a YubiKey provisioned earlier
just yubikey-onboard -- --from-backup /mnt/usb/backup/master-secret.key.age

# The same, opened by an age identity file instead of a token
just yubikey-onboard -- --from-backup /mnt/usb/backup/master-secret.key.age \
  --age-identity /mnt/usb/offline-identity.txt

# Rotate a token whose PINs were set on an earlier day and stay as they are
just yubikey-onboard -- --from-backup /mnt/usb/backup --allow-default-pins

# Force RSA 4096 for an older YubiKey
just yubikey-onboard -- --algo rsa4096

Nix Package

The script is packaged as a Nix derivation at flake/packages.nix and exposed as packages.<system>.yubikey-onboard for x86_64-linux and aarch64-linux. All runtime dependencies (gnupg, yubikey-manager, pam_u2f, age, age-plugin-yubikey, ssh-to-age, pinentry-curses, openssh, util-linux) are pinned via the flake lockfile. Building the package runs shellcheck over the script, and the yubikey-onboard-builds check builds it in CI.

# Via justfile (recommended)
just yubikey-onboard

# Via nix run directly
nix run .#yubikey-onboard

# With arguments
nix run .#yubikey-onboard -- --verify

Prerequisites

  • A YubiKey 5 series (firmware 5.2.3+ for ed25519, older keys fall back to RSA 4096)
  • Removable media for master key backup (new key mode) or the existing backup (rotation mode)

Workflow

The script generates PGP keys once (or imports from backup), then provisions one or more YubiKeys with the same subkeys for redundancy. After the first YubiKey is provisioned, the script prompts to provision additional keys, restoring the subkeys from backup between each keytocard pass.

PhaseRunsDescription
0OncePreflight, verify tools, detect YubiKey firmware
1OncePGP Key Generation or Import from Backup
2OnceMaster Key Backup (skipped in --from-backup mode)
3-6Per keyProvision YubiKey, reset, keytocard and its verification, PINs for OpenPGP and PIV, U2F, age identity
7OnceSSH Keygrip, extract authentication subkey keygrip
8OncePublic Key Import, import into persistent keyring
9OnceEncrypted Backup, age-encrypt the master key and subkeys exports and remove the plaintext
10OnceSummary, print all values for NixOS config

Phase Details

Phase 0: Preflight Checks

Verifies required tools are available, detects the YubiKey (serial and firmware), and determines the key algorithm. The --algo flag overrides auto-detection.

phase_preflight() {
  header "Phase 0: Preflight Checks"

  # Check required tools
  local tools=("gpg" "ykman" "pamu2fcfg" "age" "age-plugin-yubikey" "ssh-to-age")
  local missing=()
  for tool in "${tools[@]}"; do
    if ! command -v "$tool" &>/dev/null; then
      missing+=("$tool")
    fi
  done

  if [[ ${#missing[@]} -gt 0 ]]; then
    error "Missing required tools: ${missing[*]}"
    echo "  These should be available when othrys.services.security.yubikey.enable = true"
    echo "  You can also run: nix shell nixpkgs#{${missing[*]// /,}}"
    exit 1
  fi
  success "All required tools found."

  # Detect initial YubiKey (for firmware/algorithm check)
  check_yubikey
  read_yubikey
  local firmware="$CURRENT_FIRMWARE"

  if $DRY_RUN; then
    dry_run_skip "ykman info (assuming firmware $firmware)"
  else
    info "YubiKey detected:"
    echo "  Serial:   $CURRENT_SERIAL"
    echo "  Firmware: ${firmware:-unreported}"
  fi

  # Determine key algorithm
  if [[ -z $firmware && -z $OPT_ALGO ]]; then
    error "This token reports no firmware version, so the key algorithm cannot be chosen."
    error "Pass --algo ed25519 or --algo rsa4096 to choose one."
    exit 1
  elif [[ -n $OPT_ALGO ]]; then
    KEY_ALGO="$OPT_ALGO"
    info "Algorithm forced via --algo: $KEY_ALGO"
    if [[ $KEY_ALGO == "ed25519" && -n $firmware ]] && ! version_gte "$firmware" "$MIN_ECC_FIRMWARE"; then
      warn "Firmware $firmware may not support ed25519 (requires >= $MIN_ECC_FIRMWARE)."
      warn "Proceeding anyway as --algo was explicitly set."
    fi
  elif version_gte "$firmware" "$MIN_ECC_FIRMWARE"; then
    success "Firmware supports ed25519/cv25519."
    KEY_ALGO="ed25519"
  else
    warn "Firmware $firmware does not support ed25519 (requires >= $MIN_ECC_FIRMWARE)."
    warn "Falling back to RSA 4096."
    KEY_ALGO="rsa4096"
  fi
}

Phase 1: PGP Key Generation

Generates a master key (Certify only) and three subkeys (Sign, Encrypt, Authenticate) in a temporary GNUPGHOME on ramfs, so the key never touches persistent storage or swap. See Security Notes for the fallback when unprivileged user namespaces are unavailable.

The temporary GPG environment uses a hardened gpg.conf matching the settings in modules/services/security/yubikey.nix and pinentry-curses for terminal PIN entry.

The --name, --email, and --expiry flags skip the interactive prompts. Name and email are refused if empty.

The phase ends by setting a passphrase on the master key, through gpg-agent’s own pinentry on the same terminal. It will not advance to the backup phase while the key is unprotected unless --no-passphrase was given.

phase_generate_keys() {
  header "Phase 1: PGP Master Key Generation"

  info "Master key will be generated in a temporary GNUPGHOME held in memory."
  echo ""

  # Prompt for key details (skip if provided via CLI)
  local real_name email expiry
  if [[ -n $OPT_NAME ]]; then
    real_name="$OPT_NAME"
  else
    real_name=$(prompt_required "Real name for the key")
  fi
  if [[ -n $OPT_EMAIL ]]; then
    email="$OPT_EMAIL"
  else
    email=$(prompt_required "Email address")
  fi
  if [[ -n $OPT_EXPIRY ]]; then
    expiry="$OPT_EXPIRY"
  else
    expiry=$(prompt_value "Subkey expiry (e.g., 2y, 1y, 6m)" "$DEFAULT_EXPIRY")
  fi
  info "Key identity: $real_name <$email> (subkey expiry: $expiry)"

  setup_gnupghome

  if $DRY_RUN; then
    dry_run_skip "gpg --quick-gen-key \"$real_name <$email>\" $KEY_ALGO cert never"
    KEY_FINGERPRINT="DRY_RUN_FINGERPRINT_0000000000000000"
    dry_run_skip "gpg --quick-add-key (Sign, Encrypt, Authenticate subkeys)"
    info "Would generate master key + 3 subkeys with algorithm: $KEY_ALGO"
    info "Subkey expiry: $expiry"
    return
  fi

  info "Generating master key (Certify only)..."

  if [[ $KEY_ALGO == "ed25519" ]]; then
    gpg --batch --passphrase '' --quick-gen-key "$real_name <$email>" ed25519 cert never
  else
    gpg --batch --passphrase '' --quick-gen-key "$real_name <$email>" rsa4096 cert never
  fi

  # Get the fingerprint
  KEY_FINGERPRINT=$(gpg --list-keys --with-colons "$email" 2>/dev/null |
    awk -F: '/^fpr:/ {print $10; exit}')

  if [[ -z $KEY_FINGERPRINT ]]; then
    error "Failed to retrieve key fingerprint."
    exit 1
  fi

  success "Master key generated: $KEY_FINGERPRINT"

  # Generate subkeys
  info "Generating subkeys (Sign, Encrypt, Authenticate) with expiry: $expiry..."

  if [[ $KEY_ALGO == "ed25519" ]]; then
    gpg --batch --passphrase '' --quick-add-key "$KEY_FINGERPRINT" ed25519 sign "$expiry"
    gpg --batch --passphrase '' --quick-add-key "$KEY_FINGERPRINT" cv25519 encr "$expiry"
    gpg --batch --passphrase '' --quick-add-key "$KEY_FINGERPRINT" ed25519 auth "$expiry"
  else
    gpg --batch --passphrase '' --quick-add-key "$KEY_FINGERPRINT" rsa4096 sign "$expiry"
    gpg --batch --passphrase '' --quick-add-key "$KEY_FINGERPRINT" rsa4096 encr "$expiry"
    gpg --batch --passphrase '' --quick-add-key "$KEY_FINGERPRINT" rsa4096 auth "$expiry"
  fi

  success "Subkeys generated."
  echo ""
  gpg --list-keys --with-keygrip "$KEY_FINGERPRINT"

  echo ""
  set_master_passphrase
}

# Returns 0 when the master secret key on disk is passphrase-protected.
#
# gpg-agent's KEYINFO reports the protection state in field 8 of its S line,
# `C` for a key stored in the clear and `P` for a protected one. Verified
# against a freshly generated key both ways. This asks the agent about what is
# actually on disk rather than trusting that a passphrase dialog was completed,
# so it holds however the passphrase was set.
master_key_is_protected() {
  local grip
  grip=$(gpg --list-secret-keys --with-keygrip --with-colons "$KEY_FINGERPRINT" 2>/dev/null |
    awk -F: '/^grp/{print $10; exit}')
  [[ -n $grip ]] || return 1
  gpg-connect-agent "KEYINFO $grip" /bye 2>/dev/null |
    awk '/^S KEYINFO/{exit ($8 == "P") ? 0 : 1}'
}

# The master key and its subkeys are generated with --passphrase '', so until
# this runs the only copy of the identity is unprotected. This used to print a
# command to run in a second terminal followed by "Press Enter when done (or
# skip)", which advanced to the backup phase whether or not anything happened.
#
# Entry goes through gpg-agent's own pinentry on this terminal, so the
# passphrase lives in the agent's mlocked memory and never reaches a shell
# variable, the process environment or a trace. The gate below re-reads the
# on-disk state afterwards, so a cancelled or failed dialog cannot pass.
set_master_passphrase() {
  if $OPT_NO_PASSPHRASE; then
    warn "--no-passphrase given: the master key backup will be unprotected."
    warn "Anyone who reads the backup file holds your identity."
    return 0
  fi

  if $DRY_RUN; then
    dry_run_skip "gpg --edit-key $KEY_FINGERPRINT passwd"
    return 0
  fi

  warn "The master key is currently unprotected. Set a passphrase now."
  warn "It protects the backup, which is the only copy once subkeys move to the"
  warn "YubiKey and cannot be extracted again."
  echo ""

  while ! master_key_is_protected; do
    gpg --edit-key "$KEY_FINGERPRINT" passwd || true
    if master_key_is_protected; then
      break
    fi
    error "The master key is still unprotected."
    if prompt_yn "Try again?" "y"; then
      continue
    fi
    if prompt_yn "Continue with an UNPROTECTED master key?"; then
      warn "Proceeding with an unprotected master key at your request."
      return 0
    fi
    error "Refusing to continue to backup with an unprotected master key."
    error "Re-run with --no-passphrase if that is genuinely what you want."
    exit 1
  done

  success "Master key is passphrase-protected."
}

Phase 1 (alternate): Import from Backup

When --from-backup is used, the script imports an existing master key instead of generating a new one. It offers to generate fresh subkeys (recommended for rotation) or reuse the existing ones from the backup.

A default run leaves no plaintext behind, so the usual input is one of the two encrypted copies. The path may name either file, or the directory that holds them:

InputOpened with
master-secret.key.pass.agethe backup passphrase, which age asks for
master-secret.key.agean identity file given with --age-identity or at the prompt, or the YubiKey in the reader through age-plugin-yubikey
master-secret.keynothing, since it is plaintext

Given a directory, the script takes a plaintext master-secret.key when one is there, and otherwise asks which encrypted copy to open when both exist. The token copy opens only with a YubiKey that was provisioned when the backup was written, so a rotation onto a blank replacement token starts from the passphrase copy, or from the token copy with an older token in the reader first. The script pauses after decryption so that the tokens can be swapped.

An encrypted backup is decrypted into the ramfs GNUPGHOME and nowhere else. When fresh subkeys are generated, the new exports are written in the ramfs as well, and the encrypted backup phase writes the new copies to the backup directory. No plaintext reaches the medium in that flow. A plaintext input stays where it is during the run, and the encrypted backup phase encrypts and removes it at the end.

Every file the rotation replaces is written beside its target as <target>.new, read back, and moved into place only after that. A failed or cancelled export leaves the existing backup as it was. The new token copy is encrypted to the YubiKeys provisioned in this run and to any --age-recipient, and the recipients of the copy it replaces are not carried over, so a token from an earlier run keeps opening the backup only when its recipient is passed again.

This mode is intended for:

  • Key rotation. Expired subkeys, generate new ones from the same master
  • Replacement YubiKey. Lost/damaged key, provision a new one with existing subkeys
# What a backup file is. age opens a file with a text header whose second line
# names the first recipient stanza, and `scrypt` there means a passphrase.
backup_form() {
  local file="$1" first="" second=""
  {
    IFS= read -r first || true
    IFS= read -r second || true
  } <"$file" 2>/dev/null
  if [[ $first == "age-encryption.org/v1" || $file == *.age ]]; then
    if [[ $second == "-> scrypt "* || $file == *.pass.age ]]; then
      echo "age-passphrase"
    else
      echo "age-recipient"
    fi
  else
    echo "plaintext"
  fi
}

# Decrypt an encrypted backup to a file inside the ramfs GNUPGHOME. The
# passphrase copy needs nothing but the passphrase. The token copy needs an
# identity, which is a file named with --age-identity or at the prompt, or the
# YubiKey in the reader through age-plugin-yubikey.
decrypt_backup() {
  local source="$1" form="$2" dest="$3"
  local idfile="$OPT_AGE_IDENTITY" rc=0

  if [[ $form == "age-passphrase" ]]; then
    info "Decrypting $source. age asks for the backup passphrase."
    age -d -o "$dest" "$source"
    return
  fi

  if [[ -z $idfile ]]; then
    idfile=$(prompt_value "age identity file that opens it (empty to use the YubiKey in the reader)" "")
  fi
  if [[ -n $idfile ]]; then
    if [[ ! -f $idfile ]]; then
      error "No such identity file: $idfile"
      return 1
    fi
    age -d -i "$idfile" -o "$dest" "$source"
    return
  fi

  idfile="$GNUPGHOME/age-identities"
  release_card
  age-plugin-yubikey --identity >"$idfile" 2>/dev/null || true
  if ! grep -q "^AGE-PLUGIN-YUBIKEY-" "$idfile"; then
    rm -f "$idfile"
    error "The YubiKey in the reader holds no age identity."
    return 1
  fi
  info "Decrypting $source (this needs the inserted YubiKey's PIN and a touch)..."
  age -d -i "$idfile" -o "$dest" "$source" || rc=$?
  rm -f "$idfile"
  return "$rc"
}

phase_import_from_backup() {
  header "Importing Master Key from Backup"

  local backup_path="$OPT_FROM_BACKUP"

  # Validate backup path
  if [[ ! -f $backup_path && ! -d $backup_path ]]; then
    error "Backup path does not exist: $backup_path"
    exit 1
  fi

  # If a directory was given, look for the master key file inside it. A
  # plaintext export comes first because it needs nothing to open. A default
  # run leaves only the two encrypted copies.
  local key_file="$backup_path"
  if [[ -d $backup_path ]]; then
    if [[ -f "$backup_path/master-secret.key" ]]; then
      key_file="$backup_path/master-secret.key"
    elif [[ -f "$backup_path/master-secret.key.pass.age" && -f "$backup_path/master-secret.key.age" ]]; then
      if prompt_yn "Open the passphrase copy? Answer no to open the YubiKey copy." "y"; then
        key_file="$backup_path/master-secret.key.pass.age"
      else
        key_file="$backup_path/master-secret.key.age"
      fi
    elif [[ -f "$backup_path/master-secret.key.pass.age" ]]; then
      key_file="$backup_path/master-secret.key.pass.age"
    elif [[ -f "$backup_path/master-secret.key.age" ]]; then
      key_file="$backup_path/master-secret.key.age"
    else
      error "No master-secret.key, master-secret.key.age or master-secret.key.pass.age in $backup_path"
      error "Expected a file produced by a previous onboarding run."
      exit 1
    fi
    # The directory takes the updated backup and the summary.
    BACKUP_DIR="$backup_path"
  else
    BACKUP_DIR="$(dirname "$backup_path")"
  fi

  local form
  form=$(backup_form "$key_file")

  info "Importing master key from: $key_file"

  setup_gnupghome

  # An encrypted backup is decrypted into the ramfs, and every plaintext export
  # of this run stays there. A plaintext backup is already on the medium, so its
  # exports stay beside it until the encrypted backup phase removes them.
  local source="$key_file"
  if [[ $form == "plaintext" ]]; then
    MASTER_PLAINTEXT="$BACKUP_DIR/master-secret.key"
    SUBKEYS_PLAINTEXT="$BACKUP_DIR/subkeys-secret.key"
  else
    MASTER_PLAINTEXT="$GNUPGHOME/master-secret.key"
    SUBKEYS_PLAINTEXT="$GNUPGHOME/subkeys-secret.key"
    key_file="$MASTER_PLAINTEXT"
  fi

  if $DRY_RUN; then
    if [[ $form != "plaintext" ]]; then
      dry_run_skip "age -d $source (into the ramfs)"
    fi
    dry_run_skip "gpg --import $key_file"
    KEY_FINGERPRINT="DRY_RUN_FINGERPRINT_0000000000000000"
    info "Would import master key and list existing subkeys."
    return
  fi

  if [[ $form == "plaintext" ]]; then
    warn "$source is not encrypted. It stays on the medium until the encrypted"
    warn "backup phase at the end of this run."
  else
    if ! decrypt_backup "$source" "$form" "$key_file" || [[ ! -s $key_file ]]; then
      error "Could not decrypt $source. Nothing was changed."
      exit 1
    fi
    success "Backup decrypted into the temporary GNUPGHOME."
    if [[ $form == "age-recipient" ]]; then
      info "If the YubiKey to provision is not the one in the reader, insert it now."
      read -rp "$(echo -e "${BOLD}Press Enter to continue...${NC}")" || true
    fi
  fi

  # Import the master key
  gpg --batch --import "$key_file" 2>/dev/null || {
    error "Failed to import master key from $key_file"
    exit 1
  }

  # Get the fingerprint (first key in the keyring)
  KEY_FINGERPRINT=$(gpg --list-keys --with-colons 2>/dev/null |
    awk -F: '/^fpr:/ {print $10; exit}')

  if [[ -z $KEY_FINGERPRINT ]]; then
    error "Failed to retrieve key fingerprint after import."
    exit 1
  fi

  success "Master key imported: $KEY_FINGERPRINT"
  echo ""
  gpg --list-keys --with-keygrip "$KEY_FINGERPRINT"

  # Check if subkeys exist and offer to generate new ones
  local subkey_count regenerated=false
  subkey_count=$(gpg --list-keys --with-colons "$KEY_FINGERPRINT" 2>/dev/null |
    grep -c "^sub:" || true)

  if [[ $subkey_count -ge 3 ]]; then
    info "Found $subkey_count existing subkeys."
    if prompt_yn "Generate fresh subkeys (recommended for rotation)?" "y"; then
      local expiry
      if [[ -n $OPT_EXPIRY ]]; then
        expiry="$OPT_EXPIRY"
      else
        expiry=$(prompt_value "New subkey expiry (e.g., 2y, 1y, 6m)" "$DEFAULT_EXPIRY")
      fi

      info "Generating new subkeys with expiry: $expiry..."
      if [[ $KEY_ALGO == "ed25519" ]]; then
        gpg --batch --passphrase '' --quick-add-key "$KEY_FINGERPRINT" ed25519 sign "$expiry"
        gpg --batch --passphrase '' --quick-add-key "$KEY_FINGERPRINT" cv25519 encr "$expiry"
        gpg --batch --passphrase '' --quick-add-key "$KEY_FINGERPRINT" ed25519 auth "$expiry"
      else
        gpg --batch --passphrase '' --quick-add-key "$KEY_FINGERPRINT" rsa4096 sign "$expiry"
        gpg --batch --passphrase '' --quick-add-key "$KEY_FINGERPRINT" rsa4096 encr "$expiry"
        gpg --batch --passphrase '' --quick-add-key "$KEY_FINGERPRINT" rsa4096 auth "$expiry"
      fi
      success "New subkeys generated."
      regenerated=true
      echo ""
      gpg --list-keys --with-keygrip "$KEY_FINGERPRINT"
    else
      info "Using existing subkeys from backup."
    fi
  elif [[ $subkey_count -eq 0 ]]; then
    warn "No subkeys found in backup. Generating new subkeys..."
    local expiry
    if [[ -n $OPT_EXPIRY ]]; then
      expiry="$OPT_EXPIRY"
    else
      expiry=$(prompt_value "Subkey expiry (e.g., 2y, 1y, 6m)" "$DEFAULT_EXPIRY")
    fi

    if [[ $KEY_ALGO == "ed25519" ]]; then
      gpg --batch --passphrase '' --quick-add-key "$KEY_FINGERPRINT" ed25519 sign "$expiry"
      gpg --batch --passphrase '' --quick-add-key "$KEY_FINGERPRINT" cv25519 encr "$expiry"
      gpg --batch --passphrase '' --quick-add-key "$KEY_FINGERPRINT" ed25519 auth "$expiry"
    else
      gpg --batch --passphrase '' --quick-add-key "$KEY_FINGERPRINT" rsa4096 sign "$expiry"
      gpg --batch --passphrase '' --quick-add-key "$KEY_FINGERPRINT" rsa4096 encr "$expiry"
      gpg --batch --passphrase '' --quick-add-key "$KEY_FINGERPRINT" rsa4096 auth "$expiry"
    fi
    success "Subkeys generated."
    regenerated=true
    echo ""
    gpg --list-keys --with-keygrip "$KEY_FINGERPRINT"
  else
    info "Found $subkey_count subkey(s). Proceeding with existing subkeys."
  fi

  if $regenerated; then
    # The key has changed, so the exports follow it. Each is written beside its
    # target as <target>.new and moved into place after it has been read back,
    # so a failed export leaves the existing backup as it was.
    export_verified master "$MASTER_PLAINTEXT" || abort_run "The updated master key could not be exported."
    export_verified subkeys "$SUBKEYS_PLAINTEXT" || abort_run "The updated subkeys could not be exported."
    export_verified public "$BACKUP_DIR/public.key" || abort_run "The updated public key could not be exported."
    if [[ $form == "plaintext" && $source != "$MASTER_PLAINTEXT" ]]; then
      IMPORTED_PLAINTEXT="$source"
    fi
  else
    # Nothing changed, so the imported file is the export and is not rewritten.
    MASTER_PLAINTEXT="$key_file"
    # A plaintext subkeys export from an earlier run is taken through the
    # encrypted backup phase too, provided it belongs to this key.
    if [[ -f "$BACKUP_DIR/subkeys-secret.key" ]] && export_is_covered "$BACKUP_DIR/subkeys-secret.key"; then
      SUBKEYS_PLAINTEXT="$BACKUP_DIR/subkeys-secret.key"
    else
      SUBKEYS_PLAINTEXT=""
    fi
  fi
}

Phase 2: Master Key Backup

Exports the master secret key, subkeys, public key, and revocation certificate to a user-specified directory (or the path from --backup-dir). Each export is written as <target>.new, listed with gpg, and compared with the fingerprints in the keyring before it takes its final name. Displays SHA256 checksums for verification. Both secret exports are plaintext from this point until the encrypted backup phase. The script will not proceed until backups are confirmed – this is a hard gate because keytocard in Phase 3 is irreversible.

This phase is skipped in --from-backup mode since the backup already exists.

# Warn when the backup target looks like somewhere the host will not persist.
#
# A filesystem-type test for tmpfs is not enough on its own. On a host using
# othrys.system.impermanence, /tmp is not a separate mount at all, it sits on a
# root filesystem that the boot wipe clears, and a tmpfs check sees nothing. So
# this looks at both the filesystem type and the well-known volatile paths, and
# still only warns, because no heuristic can enumerate what a given host keeps.
check_backup_target() {
  local target="$1" fstype="" volatile=false
  local parent="$target"
  # findmnt needs a path that exists, so walk up to the nearest one.
  while [[ -n $parent && ! -e $parent ]]; do parent=$(dirname "$parent"); done
  if command -v findmnt >/dev/null 2>&1 && [[ -e $parent ]]; then
    fstype=$(findmnt -no FSTYPE --target "$parent" 2>/dev/null || true)
  fi

  case "$fstype" in
  tmpfs | ramfs) volatile=true ;;
  esac
  case "$target" in
  /tmp/* | /tmp | /var/tmp/* | /var/tmp | /dev/shm/*) volatile=true ;;
  esac

  $volatile || return 0

  error "The backup directory looks volatile: $target"
  [[ -n $fstype ]] && error "  filesystem: $fstype"
  error "This is the only copy of a master key whose subkeys cannot be extracted"
  error "from the YubiKey again. If this location is cleared on reboot, the"
  error "identity is gone."
  if ! $OPT_FORCE_VOLATILE; then
    error "Pass --force-volatile if you know this location is kept."
    exit 1
  fi
  warn "--force-volatile given: continuing anyway."
}

# The fingerprints of the key in the keyring, primary and subkeys, one a line.
keyring_fingerprints() {
  gpg --list-keys --with-colons "$KEY_FINGERPRINT" 2>/dev/null |
    awk -F: '$1 == "fpr" {print $10}' | sort -u || true
}

# The fingerprints gpg finds in an export file. Nothing is imported.
file_fingerprints() {
  gpg --batch --show-keys --with-colons "$1" 2>/dev/null |
    awk -F: '$1 == "fpr" {print $10}' | sort -u || true
}

# True when every key in an export file is also in the keyring, which makes
# the file a subset of what a fresh export of the keyring holds.
export_is_covered() {
  local in_file
  in_file=$(file_fingerprints "$1")
  [[ -n $in_file ]] &&
    [[ -z $(comm -23 <(printf '%s\n' "$in_file") <(keyring_fingerprints)) ]]
}

# True for a path inside the temporary GNUPGHOME, which is memory and goes
# when the script exits. Everything else is treated as the backup medium.
in_gnupghome() {
  [[ -n $TEMP_GNUPGHOME && $1 == "$TEMP_GNUPGHOME"/* ]]
}

# Remove a plaintext export. shred overwrites the blocks of a file in place,
# which removes the data on the ramfs and on a filesystem that writes in place.
# Flash media remap blocks and copy-on-write filesystems write new ones, so the
# old contents can stay readable there and nothing run from here changes that.
# The operator is told once.
SHRED_WARNED=false
remove_plaintext() {
  local file="$1"
  [[ -e $file ]] || return 0
  shred -u "$file" 2>/dev/null || rm -f "$file"
  if in_gnupghome "$file"; then
    return 0
  fi
  if ! $SHRED_WARNED; then
    SHRED_WARNED=true
    warn "shred overwrites a file in place. Flash media and copy-on-write"
    warn "filesystems such as btrfs keep the old blocks, so treat the medium"
    warn "holding $(dirname "$file") as one that has carried the plaintext."
  fi
}

# Export one part of the key to <target>.new, read the new file back, and only
# then move it over <target>. A redirect straight onto the target truncates it
# before gpg has produced anything, and on a rotation the target is the only
# backup.
#
# Reading back means asking gpg to list the new file and comparing the
# fingerprints in it with the keyring. An export that stopped early, or one a
# cancelled passphrase prompt left empty, replaces nothing.
export_verified() {
  local kind="$1" target="$2"
  local new="$target.new"
  local block="-----BEGIN PGP PRIVATE KEY BLOCK-----" # gitleaks:allow (the armor header an export is compared with, not a key)
  local -a export_args=(--export-secret-keys)
  local want got first_line=""

  case "$kind" in
  subkeys) export_args=(--export-secret-subkeys) ;;
  public)
    export_args=(--export)
    block="-----BEGIN PGP PUBLIC KEY BLOCK-----"
    ;;
  esac

  rm -f "$new"
  if ! gpg --armor "${export_args[@]}" "$KEY_FINGERPRINT" >"$new"; then
    remove_plaintext "$new"
    error "gpg could not export the $kind key. $target was not changed."
    return 1
  fi

  want=$(keyring_fingerprints)
  got=$(file_fingerprints "$new")
  IFS= read -r first_line <"$new" || true
  if [[ $first_line != "$block" || -z $want || $got != "$want" ]]; then
    remove_plaintext "$new"
    error "The $kind export did not read back as the key in the keyring."
    error "$target was not changed."
    return 1
  fi

  mv -f "$new" "$target"
}

# Stop the run and say what it leaves behind. Every hard stop after the backup
# phase goes through here, so the operator always learns whether plaintext
# exports are still on the backup medium.
abort_run() {
  error "$1"
  if [[ -n $MASTER_PLAINTEXT && -e $MASTER_PLAINTEXT ]] && ! in_gnupghome "$MASTER_PLAINTEXT"; then
    error "Nothing was removed. The exports in $BACKUP_DIR are still plaintext."
    error "Encrypt them or remove them before the medium leaves your hands."
  elif [[ -n $BACKUP_DIR ]]; then
    error "Nothing was removed from $BACKUP_DIR."
  fi
  exit 1
}

phase_backup() {
  header "Phase 2: Master Key Backup"

  warn "After moving subkeys to the YubiKey, they CANNOT be extracted."
  warn "You MUST back up the master key now."
  echo ""

  if [[ -n $OPT_BACKUP_DIR ]]; then
    BACKUP_DIR="$OPT_BACKUP_DIR"
    info "Using backup directory from --backup-dir: $BACKUP_DIR"
  else
    # No default. This used to offer /tmp/yubikey-backup-<date>, which is
    # predictable, unencrypted, and on most hosts does not survive a reboot, so
    # pressing Enter put the only copy of a master key somewhere it could
    # vanish. The script cannot know what a given host persists, so the operator
    # names the destination.
    echo "Use removable media you can store somewhere safe, e.g. /run/media/you/backup."
    BACKUP_DIR=$(prompt_required "Backup directory")
  fi

  check_backup_target "$BACKUP_DIR"

  MASTER_PLAINTEXT="$BACKUP_DIR/master-secret.key"
  SUBKEYS_PLAINTEXT="$BACKUP_DIR/subkeys-secret.key"

  if $DRY_RUN; then
    dry_run_skip "mkdir -p $BACKUP_DIR"
    dry_run_skip "gpg --export-secret-keys -> $BACKUP_DIR/master-secret.key"
    dry_run_skip "gpg --export-secret-subkeys -> $BACKUP_DIR/subkeys-secret.key"
    dry_run_skip "gpg --export -> $BACKUP_DIR/public.key"
    dry_run_skip "cp revocation.cert -> $BACKUP_DIR/revocation.cert"
    info "Would export master key, subkeys, public key, and revocation cert."
    return
  fi

  mkdir -p "$BACKUP_DIR"
  chmod 700 "$BACKUP_DIR"

  info "Exporting keys to $BACKUP_DIR ..."

  # Master + subkeys, subkeys only, and the public key. Both secret exports
  # are plaintext until the encrypted backup phase has run.
  export_verified master "$MASTER_PLAINTEXT" || exit 1
  export_verified subkeys "$SUBKEYS_PLAINTEXT" || exit 1
  export_verified public "$BACKUP_DIR/public.key" || exit 1

  # Copy revocation cert
  local rev_cert="$GNUPGHOME/openpgp-revocs.d/$KEY_FINGERPRINT.rev"
  if [[ -f $rev_cert ]]; then
    cp "$rev_cert" "$BACKUP_DIR/revocation.cert"
  fi

  echo ""
  info "Backup checksums (SHA256):"
  sha256sum "$BACKUP_DIR"/*.key "$BACKUP_DIR"/*.cert 2>/dev/null || true

  echo ""
  echo -e "${RED}${BOLD}WARNING: Move these backups to secure offline storage NOW.${NC}"
  echo -e "${RED}${BOLD}The master key allows creating new subkeys and revoking old ones.${NC}"
  echo ""

  if ! prompt_yn "Have you saved the backups to secure storage?"; then
    error "Cannot continue without confirmed backups. Aborting."
    exit 1
  fi
}

Phase 3: Move Subkeys to YubiKey

The script runs keytocard itself. The temporary GNUPGHOME sits on a ramfs inside a mount namespace that only the script’s own process tree can see, so a gpg --edit-key typed into a second terminal finds an empty directory and no key. Everything that touches the keyring therefore runs from inside the script.

The subkey for each slot is chosen by capability, and the newest usable one wins. Position in the key listing is not used, since a rotated key carries its expired subkeys ahead of the new ones. One gpg --edit-key session runs for each subkey, selected by fingerprint. The script answers gpg’s questions by the keyword gpg announces on its status channel, and a question it has no answer for ends the session with the key unchanged. gpg-agent asks for the master key passphrase and the OpenPGP admin PIN through pinentry on the same terminal, and neither passes through the script. When the applet already holds keys, the script lists them and asks before anything is replaced.

After the three sessions the script reads gpg --card-status and compares the fingerprint in each slot with the subkey chosen for it. An empty slot or a slot holding another key is a hard failure. The script then offers an interactive gpg --edit-key session on the same terminal, inside the same namespace, prints the three key <fingerprint> commands with their slots, and checks the card again afterwards. Declining stops the run before any PIN is changed and before any export is removed, and the error says whether plaintext exports are still on the backup medium.

# The newest usable subkey with one capability, read from a colon listing on
# stdin. A rotated key carries its expired subkeys beside the new ones, so the
# position in the listing says nothing about which subkey belongs in a slot.
subkey_for_capability() {
  awk -F: -v cap="$1" '
    $1 == "sub" { want = ($2 !~ /^[rei]$/ && index($12, cap) > 0); created = $6 + 0; next }
    $1 == "fpr" && want { if (created >= best) { best = created; fpr = $10 }; want = 0 }
    END { print fpr }'
}

select_card_subkeys() {
  local listing
  listing=$(gpg --list-keys --with-colons "$KEY_FINGERPRINT" 2>/dev/null || true)
  SUBKEY_FPR_SIGN=$(subkey_for_capability s <<<"$listing")
  SUBKEY_FPR_ENCR=$(subkey_for_capability e <<<"$listing")
  SUBKEY_FPR_AUTH=$(subkey_for_capability a <<<"$listing")
  if [[ -z $SUBKEY_FPR_SIGN || -z $SUBKEY_FPR_ENCR || -z $SUBKEY_FPR_AUTH ]]; then
    abort_run "The key lacks a usable signing, encryption or authentication subkey, so nothing was moved to the YubiKey."
  fi
}

# The fingerprints in the three card slots, as the card reports them. An empty
# slot reads as an empty string.
read_card_slots() {
  local line
  line=$(gpg --card-status --with-colons 2>/dev/null |
    awk -F: '$1 == "fpr" {print $2 ":" $3 ":" $4; exit}' || true)
  IFS=: read -r CARD_FPR_SIGN CARD_FPR_ENCR CARD_FPR_AUTH <<<"${line:-::}" || true
  CARD_FPR_SIGN="${CARD_FPR_SIGN^^}"
  CARD_FPR_ENCR="${CARD_FPR_ENCR^^}"
  CARD_FPR_AUTH="${CARD_FPR_AUTH^^}"
  [[ $CARD_FPR_SIGN =~ ^0+$ ]] && CARD_FPR_SIGN=""
  [[ $CARD_FPR_ENCR =~ ^0+$ ]] && CARD_FPR_ENCR=""
  [[ $CARD_FPR_AUTH =~ ^0+$ ]] && CARD_FPR_AUTH=""
  return 0
}

check_card_slot() {
  local label="$1" on_card="$2" expected="${3^^}"
  if [[ -z $on_card ]]; then
    error "$label slot is empty."
    return 1
  fi
  if [[ $on_card != "$expected" ]]; then
    error "$label slot holds $on_card, expected $expected."
    return 1
  fi
  success "$label slot holds $expected."
}

# True only when each slot holds the subkey chosen for it.
verify_card_slots() {
  local ok=true
  read_card_slots
  check_card_slot "Signature" "$CARD_FPR_SIGN" "$SUBKEY_FPR_SIGN" || ok=false
  check_card_slot "Encryption" "$CARD_FPR_ENCR" "$SUBKEY_FPR_ENCR" || ok=false
  check_card_slot "Authentication" "$CARD_FPR_AUTH" "$SUBKEY_FPR_AUTH" || ok=false
  $ok
}

# Run one `gpg --edit-key` session and answer its questions by the keyword gpg
# announces on its status channel. Feeding it lines in a fixed order goes wrong
# as soon as gpg asks one question more or fewer than expected, since every
# later answer then lands on the wrong question. Here a question with no known
# answer ends the session, and gpg leaves the key as it was.
#
# The first two arguments are the card slot and the answer to "replace the key
# in this slot". The rest are the commands for the edit prompt, in order.
#
# gpg runs in the foreground and keeps the terminal. gpg-agent asks for the key
# passphrase and the admin PIN through pinentry there, so neither passes
# through this script.
edit_key_scripted() {
  local slot="$1" replace="$2"
  shift 2
  local cmd_fifo="$GNUPGHOME/edit-commands" status_fifo="$GNUPGHOME/edit-status"
  local responder rc=0

  rm -f "$cmd_fifo" "$status_fifo"
  mkfifo "$cmd_fifo" "$status_fifo"

  (
    trap '' PIPE
    exec 3>"$cmd_fifo" 4<"$status_fifo"
    answered=0
    while IFS= read -r line <&4; do
      case "$line" in
      "[GNUPG:] GET_LINE keyedit.prompt")
        if [[ $# -gt 0 ]]; then
          reply="$1"
          shift
        else
          reply="quit"
        fi
        ;;
      "[GNUPG:] GET_LINE cardedit.genkeys.storekeytype") reply="$slot" ;;
      "[GNUPG:] GET_BOOL cardedit.genkeys.replace_key") reply="$replace" ;;
      "[GNUPG:] GET_BOOL keyedit.save.okay") reply="n" ;;
      "[GNUPG:] GET_"*)
        error "gpg asked a question this script has no answer for: ${line#\[GNUPG:\] }"
        exit 3
        ;;
      *) continue ;;
      esac
      # gpg repeats a question whose answer it did not accept. One subkey takes
      # five answers, so a dozen means the session is going in circles.
      answered=$((answered + 1))
      if ((answered > 12)); then
        error "gpg kept repeating its questions, so the session was ended."
        exit 3
      fi
      printf '%s\n' "$reply" >&3 || exit 3
    done
  ) &
  responder=$!

  gpg --command-fd 3 --status-fd 4 --edit-key "$KEY_FINGERPRINT" \
    3<"$cmd_fifo" 4>"$status_fifo" || rc=$?
  wait "$responder" || rc=$?
  rm -f "$cmd_fifo" "$status_fifo"
  return "$rc"
}

move_subkey_to_card() {
  local label="$1" slot="$2" fpr="$3" on_card="$4" replace="$5"
  if [[ $on_card == "${fpr^^}" ]]; then
    info "$label slot already holds this subkey."
    return 0
  fi
  info "Moving the $label subkey to slot $slot..."
  if ! edit_key_scripted "$slot" "$replace" "key $fpr" "keytocard" "save"; then
    warn "gpg did not finish moving the $label subkey."
  fi
}

phase_keytocard() {
  header "Phase 3: Move Subkeys to YubiKey"

  check_yubikey

  info "This step moves your subkeys to the YubiKey. This is IRREVERSIBLE."
  info "The subkeys in GNUPGHOME will be replaced with stubs."
  echo ""

  if $DRY_RUN; then
    dry_run_skip "gpg --edit-key $KEY_FINGERPRINT keytocard (3 subkeys)"
    dry_run_skip "gpg --card-status (compare the three slots with the subkeys)"
    info "Would move Sign, Encrypt, and Authenticate subkeys to YubiKey."
    return
  fi

  select_card_subkeys

  # gpg asks before it overwrites a slot, and the answer has to be decided
  # before the session starts.
  local replace="n"
  read_card_slots
  if [[ -n $CARD_FPR_SIGN$CARD_FPR_ENCR$CARD_FPR_AUTH ]]; then
    warn "The OpenPGP applet already holds keys:"
    echo "  Signature:      ${CARD_FPR_SIGN:-(empty)}"
    echo "  Encryption:     ${CARD_FPR_ENCR:-(empty)}"
    echo "  Authentication: ${CARD_FPR_AUTH:-(empty)}"
    if ! prompt_yn "Replace them with the subkeys of $KEY_FINGERPRINT?"; then
      abort_run "The slots were left as they are, so the YubiKey does not hold this key."
    fi
    replace="y"
  fi

  info "gpg asks for the master key passphrase and for the OpenPGP admin PIN."
  info "The factory admin PIN is 12345678."
  echo ""

  move_subkey_to_card "Signature" 1 "$SUBKEY_FPR_SIGN" "$CARD_FPR_SIGN" "$replace"
  move_subkey_to_card "Encryption" 2 "$SUBKEY_FPR_ENCR" "$CARD_FPR_ENCR" "$replace"
  move_subkey_to_card "Authentication" 3 "$SUBKEY_FPR_AUTH" "$CARD_FPR_AUTH" "$replace"

  # The card is asked what it holds, and the answer is compared with the
  # subkeys chosen above. An empty slot or another key stops the run here,
  # before any PIN is changed and long before an export is removed.
  echo ""
  info "Verifying keys are on the YubiKey..."
  until verify_card_slots; do
    echo ""
    error "The YubiKey does not hold all three subkeys."
    if ! prompt_yn "Open gpg --edit-key here to move the missing ones by hand?" "y"; then
      abort_run "The subkeys are not on the YubiKey."
    fi
    echo ""
    echo "  For each line, enter the key command, then keytocard, then the slot"
    echo "  number, then the same key command again to deselect the subkey."
    echo "  Leave out a slot the check above reported as holding its subkey."
    echo ""
    echo "    key $SUBKEY_FPR_SIGN    slot 1 (Signature key)"
    echo "    key $SUBKEY_FPR_ENCR    slot 2 (Encryption key)"
    echo "    key $SUBKEY_FPR_AUTH    slot 3 (Authentication key)"
    echo ""
    echo "  Finish with: save"
    echo ""
    gpg --edit-key "$KEY_FINGERPRINT" || true
    echo ""
    info "Verifying keys are on the YubiKey..."
  done
  success "All three subkeys are on the YubiKey."
}

Per-YubiKey Provisioning (Phases 3-6)

For each YubiKey, the script runs:

  • Reset. Optionally factory reset the OpenPGP and FIDO2 applets
  • Phase 3: keytocard for each subkey, then the fingerprint check against the card
  • Phase 4: Change the OpenPGP user PIN (123456) and admin PIN (12345678), then the PIV PIN (123456), PUK (12345678) and management key, all via ykman
  • Phase 5: Register a U2F credential with pamu2fcfg -n -o pam://yubi
  • Phase 6: Generate an age identity with age-plugin-yubikey --generate (touch: always, PIN: once)

Every prompt in Phase 4 defaults to yes. The script cannot ask a token whether a PIN is still the factory one without spending a retry, so it tracks which changes ran. A credential that was not changed stops the run, unless --allow-default-pins is given, which is meant for a token whose PINs were set on an earlier day. The credentials left alone are then listed at the end of the run. Two failed attempts at one credential also stop the run, since a third wrong entry of the current value can block it.

The PIV applet is changed in Phase 4 so that the age identity Phase 6 writes into it is never guarded by the factory PIN. The management key is replaced with a random one stored on the token behind the PIN, which is the form age-plugin-yubikey accepts.

After the first YubiKey is provisioned, the script asks whether to provision another (or provisions exactly --key-count keys). It restores the subkeys from the master key export between each keytocard pass.

Post-Provisioning (Phases 7-9)

  • Phase 7: Extract the authentication subkey’s keygrip for SSH and export the SSH public key (same for all keys since they share the same GPG key)
  • Phase 8: Import the public key into the persistent ~/.gnupg keyring and set ultimate trust

Encrypted Key Backup

Runs after every YubiKey is provisioned, and the ordering is forced rather than chosen. The plaintext backup has to exist before keytocard in Phase 3, since that move is irreversible, and it has to survive the provisioning loop because subkeys are re-imported from it between each key. The age recipients do not exist until Phase 6 has run for a token. There is no earlier point at which both are true.

Both secret exports go through the same function, master-secret.key first and subkeys-secret.key after it. Two files are written for each, because age refuses -p and -r together:

FileOpens with
master-secret.key.age, subkeys-secret.key.ageany provisioned YubiKey, or an extra --age-recipient
master-secret.key.pass.age, subkeys-secret.key.pass.agethe passphrase entered during this phase

age asks for the passphrase twice to encrypt each export and once more to verify it, which makes six entries in a default run.

The passphrase copy is not redundancy for its own sake. A master key backup exists precisely to survive losing every token, so encrypting it only to those tokens makes it worthless in the situation it was created for. --no-age-passphrase declines it.

Each copy is written as <name>.new, decrypted, compared byte for byte with the plaintext, and moved into place only after that, so a copy from an earlier run is never replaced by one that has not been opened. A plaintext export is removed only once one of its copies has passed that comparison in the same run. A failed verification keeps the plaintext and says so, and the run then ends with a non-zero exit status and the list of exports that are still plaintext. --keep-plaintext retains the plaintext even on success, and --no-age-backup skips the phase entirely.

A plaintext subkeys-secret.key that an earlier run left in the backup directory is handled here too. It is encrypted with the rest, or removed once the new encrypted copy holds every key in it.

What shred Removes

The plaintext is removed with shred -u, which overwrites the blocks of a file in place before unlinking it. That removes the data only where an overwrite lands on the blocks that held it:

  • On the ramfs the temporary GNUPGHOME lives on, the overwrite is effective, and the pages are freed when the script exits.
  • On flash media, which covers USB sticks, SD cards and SSDs, the controller remaps writes for wear levelling. The old blocks stay on the device until the controller reuses them, and they can be read from the raw flash.
  • On a copy-on-write filesystem such as btrfs, an overwrite is written to new blocks and the old ones are released without being cleared. Snapshots keep them for as long as the snapshot exists.

shred reports success in all three cases. The recommendation follows from that. Key material that must not persist is worked on in the ramfs, which the script already does for the keyring and for everything a --from-backup run decrypts. A first run cannot avoid plaintext exports on the backup medium, since they have to exist before keytocard and the age recipients do not exist until after it. A plaintext copy that has touched a USB stick is therefore treated as exposed to anyone who later holds that stick. The backup medium should be an encrypted volume, such as a LUKS container, or a stick that is kept or destroyed and never reused for anything else. The master key passphrase from Phase 1 is what protects the export while it sits there, which is one more reason not to pass --no-passphrase.

Verifying the token copy needs the inserted YubiKey’s PIN and a touch, and can only test the token currently in the reader, which after a multi-key run is the last one provisioned. The other tokens are the same mechanism and the same ciphertext, but this phase has not proved them.

# Encrypt the plaintext exports, verify the results, and remove the plaintext.
#
# This runs after every YubiKey is provisioned rather than inside phase_backup,
# and the ordering is forced rather than chosen. The backup has to exist before
# `keytocard` in Phase 3, since that move is irreversible, and the plaintext has
# to survive the provisioning loop because subkeys are re-imported from it
# between each key. The age recipients do not exist until Phase 6 has run for a
# token. Encrypting earlier is therefore impossible in both directions.
#
# Two files for each export, because `age` refuses -p together with -r. The
# token copy is encrypted to the age recipients this run provisioned plus
# anything given with --age-recipient. The passphrase copy exists so that losing
# every token does not lose the identity, which is the exact case the master key
# backup is for.
BACKUP_RECIPIENTS=()
BACKUP_IDFILE=""

# One export through the whole sequence. $1 is the plaintext, which sits in the
# backup directory on a first run and in the ramfs after an encrypted import.
# $2 is the path in the backup directory the encrypted copies are named after.
#
# Each copy is written as <name>.new, decrypted, compared byte for byte with the
# plaintext, and only then moved into place, so a copy from an earlier run is
# never replaced by one that has not been opened.
protect_export() {
  local plaintext="$1" dest="$2"
  local name enc="$2.age" pass_enc="$2.pass.age"
  local check="$GNUPGHOME/verify.tmp"
  local token_ok=false pass_ok=false on_medium=false
  name=$(basename "$dest")
  in_gnupghome "$plaintext" || on_medium=true

  if [[ ${#BACKUP_RECIPIENTS[@]} -gt 0 ]]; then
    local -a args=()
    local r
    for r in "${BACKUP_RECIPIENTS[@]}"; do args+=(-r "$r"); done
    info "Encrypting $name to ${#BACKUP_RECIPIENTS[@]} age recipient(s)..."
    if age "${args[@]}" -o "$enc.new" "$plaintext"; then
      # Decrypting a YubiKey recipient needs the token in the reader, its PIN
      # and a touch, so this proves the file opens with hardware rather than
      # only that age wrote something. It can only test the token currently
      # inserted, which after a multi-key run is the last one provisioned.
      info "Verifying $enc (this needs the inserted YubiKey's PIN and a touch)..."
      if [[ -s $BACKUP_IDFILE ]] &&
        age -d -i "$BACKUP_IDFILE" -o "$check" "$enc.new" &&
        cmp -s "$plaintext" "$check"; then
        mv -f "$enc.new" "$enc"
        token_ok=true
        success "Token-encrypted backup verified: $enc"
      elif [[ -e $enc ]]; then
        warn "Could not verify the new token-encrypted copy of $name."
        warn "$enc from an earlier run was kept. The new copy is $enc.new."
      else
        mv -f "$enc.new" "$enc"
        warn "Could not verify $enc against the inserted token."
        warn "The file was written, but nothing here has proved it opens."
      fi
      rm -f "$check"
    else
      error "Encrypting $name to age recipients failed."
      rm -f "$enc.new"
    fi
  else
    warn "No age recipients captured, so no token-encrypted copy of $name was made."
  fi

  if ! $OPT_NO_AGE_PASSPHRASE; then
    echo ""
    info "Now a passphrase-encrypted copy of $name, so losing every YubiKey does"
    info "not lose the identity. Use a passphrase you can recover without this host."
    if age -p -o "$pass_enc.new" "$plaintext"; then
      info "Verifying $pass_enc (re-enter the same passphrase)..."
      if age -d -o "$check" "$pass_enc.new" &&
        cmp -s "$plaintext" "$check"; then
        mv -f "$pass_enc.new" "$pass_enc"
        pass_ok=true
        success "Passphrase-encrypted backup verified: $pass_enc"
      else
        error "Could not verify the passphrase-encrypted copy of $name."
        rm -f "$pass_enc.new"
      fi
      rm -f "$check"
    else
      error "Passphrase encryption failed or was cancelled."
      rm -f "$pass_enc.new"
    fi
  fi

  # The plaintext goes only against a copy that has been decrypted and compared
  # byte for byte in this run. Removing the only copy of a key on the strength
  # of a write that returned zero is the one mistake this must not make, so an
  # unverified encrypt keeps the plaintext and says why.
  if $pass_ok || $token_ok; then
    if $OPT_KEEP_PLAINTEXT && $on_medium; then
      warn "--keep-plaintext given: $plaintext left in place."
      warn "It is unencrypted key material. Store it accordingly."
      return 0
    fi
    remove_plaintext "$plaintext"
    success "Plaintext $name removed; encrypted copies remain."
    # A plaintext file of the same name that an earlier run left behind. It
    # goes only when every key in it is in the export just encrypted.
    if [[ $dest != "$plaintext" && -e $dest ]]; then
      if ! $OPT_KEEP_PLAINTEXT && export_is_covered "$dest"; then
        remove_plaintext "$dest"
        info "Removed $dest from an earlier run. The new encrypted copy holds every key in it."
      else
        PLAINTEXT_LEFT+=("$dest")
      fi
    fi
    if ! $pass_ok; then
      warn "Only the token-encrypted copy of $name verified. Losing every YubiKey"
      warn "now means losing it. Consider re-running with a passphrase copy."
    fi
    return 0
  fi

  if $on_medium; then
    warn "No encrypted copy verified, so $plaintext was left in place."
    warn "Do not delete it until you have a copy you have opened."
    PLAINTEXT_LEFT+=("$plaintext")
    return 0
  fi

  # The plaintext is in the ramfs and goes when the script exits. Without a
  # verified copy, anything generated in this run would exist nowhere else.
  error "No encrypted copy of $name verified, and the plaintext is held in memory only."
  if prompt_yn "Write it to $dest unencrypted so it is not lost?" "y"; then
    if cp "$plaintext" "$dest.new" && cmp -s "$plaintext" "$dest.new"; then
      mv -f "$dest.new" "$dest"
      PLAINTEXT_LEFT+=("$dest")
    else
      rm -f "$dest.new"
      error "Could not write $dest."
    fi
  else
    warn "$name was not saved. The backup in $BACKUP_DIR is as it was before this run."
  fi
  return 0
}

phase_age_backup() {
  [[ -n $BACKUP_DIR && -n $MASTER_PLAINTEXT ]] || return 0

  local master_dest="$BACKUP_DIR/master-secret.key"
  local subkeys_dest="$BACKUP_DIR/subkeys-secret.key"

  if $OPT_NO_AGE_BACKUP; then
    if in_gnupghome "$MASTER_PLAINTEXT"; then
      warn "--no-age-backup given: the backup in $BACKUP_DIR was not updated."
      warn "Subkeys generated in this run exist only on the YubiKeys."
    fi
    return 0
  fi

  if $DRY_RUN; then
    header "Encrypted Key Backup"
    dry_run_skip "age -r <recipients> -o $master_dest.age.new, verify, mv to $master_dest.age"
    dry_run_skip "age -p -o $master_dest.pass.age.new, verify, mv to $master_dest.pass.age"
    dry_run_skip "the same two copies of $subkeys_dest"
    dry_run_skip "shred the plaintext exports once a copy of each has verified"
    return 0
  fi

  [[ -f $MASTER_PLAINTEXT ]] || return 0

  header "Encrypted Key Backup"

  # Recipients: the tokens provisioned in this run, plus anything supplied.
  local r
  BACKUP_RECIPIENTS=()
  for r in "${AGE_RECIPIENTS[@]}"; do
    [[ -n $r ]] && BACKUP_RECIPIENTS+=("$r")
  done
  for r in "${OPT_AGE_RECIPIENTS[@]+"${OPT_AGE_RECIPIENTS[@]}"}"; do
    [[ -n $r ]] && BACKUP_RECIPIENTS+=("$r")
  done

  # A real file rather than process substitution, since age reads the identity
  # file directly and /dev/fd paths are not seekable. It lives in the ramfs
  # GNUPGHOME and goes with it.
  BACKUP_IDFILE="$GNUPGHOME/age-identities"
  : >"$BACKUP_IDFILE"
  for r in "${AGE_IDENTITIES[@]}"; do
    [[ -n $r ]] && printf '%s\n' "$r" >>"$BACKUP_IDFILE"
  done

  if [[ -e $master_dest.age && ${#BACKUP_RECIPIENTS[@]} -gt 0 ]]; then
    warn "$master_dest.age exists and is replaced once the new copy verifies."
    warn "The new copy opens with the YubiKeys provisioned in this run and with"
    warn "any --age-recipient. Recipients of the old copy are not carried over."
  fi
  if ! $OPT_NO_AGE_PASSPHRASE; then
    info "age asks for the passphrase twice to encrypt each export and once to"
    info "verify it. Use the same passphrase for both exports."
  fi

  protect_export "$MASTER_PLAINTEXT" "$master_dest"
  if [[ -n $SUBKEYS_PLAINTEXT && -f $SUBKEYS_PLAINTEXT ]]; then
    echo ""
    protect_export "$SUBKEYS_PLAINTEXT" "$subkeys_dest"
  fi

  # The plaintext file a rotation started from, when it was not the file the
  # new export replaced. It goes on the same terms as any older plaintext.
  if [[ -n $IMPORTED_PLAINTEXT && -e $IMPORTED_PLAINTEXT ]] && ! $OPT_KEEP_PLAINTEXT; then
    if [[ ! -e $MASTER_PLAINTEXT ]] && export_is_covered "$IMPORTED_PLAINTEXT"; then
      remove_plaintext "$IMPORTED_PLAINTEXT"
      info "Removed $IMPORTED_PLAINTEXT. The new encrypted copy holds every key in it."
    else
      PLAINTEXT_LEFT+=("$IMPORTED_PLAINTEXT")
    fi
  fi

  rm -f "$BACKUP_IDFILE"
}

Phase 10: Summary Output

Prints all values ready to paste into the NixOS host configurations:

  • sshKeygrips, GPG keygrip for SSH authentication (shared across all keys)
  • u2fMappings, one U2F credential per YubiKey
  • ageIdentityStubs, age identity block for sops-nix (primary key)
  • Git signing key fingerprint
  • SSH public key for GitHub/servers
  • age recipients for all provisioned keys (add all to .sops.yaml for redundancy)

A copy is saved in the backup directory as yubikey-onboard-summary-*.txt, since it carries the keygrip, the age recipients and the U2F credential lines that the host configuration needs later. In a --from-backup run the backup directory is the one the backup was read from.

The summary is never written to the working directory, which is often a public checkout. When the backup directory is no longer there at the end of the run, as when the medium was unmounted, the file goes to a new directory with mode 0700 under $XDG_RUNTIME_DIR, or under /tmp when that is unset, and the script prints its path. That directory does not survive a reboot. A dry run writes no summary and prints the directory a real run would use.

Verify Mode

The --verify flag runs a standalone health check on the currently inserted YubiKey:

  • Detects the YubiKey (serial, firmware)
  • Checks all three OpenPGP card slots (Signature, Encryption, Authentication)
  • Checks FIDO2 applet accessibility
  • Lists age identities in PIV slots
  • Checks gpg-agent for SSH key availability
  • Cross-references the YubiKey serial against the NixOS host configs
mode_verify() {
  header "YubiKey Verification"

  # Check tools
  local tools=("gpg" "ykman" "age-plugin-yubikey")
  local missing=()
  for tool in "${tools[@]}"; do
    if ! command -v "$tool" &>/dev/null; then
      missing+=("$tool")
    fi
  done
  if [[ ${#missing[@]} -gt 0 ]]; then
    error "Missing tools: ${missing[*]}"
    exit 1
  fi

  # YubiKey detection
  if ! ykman info &>/dev/null; then
    error "No YubiKey detected."
    exit 1
  fi

  local serial firmware
  serial=$(yubikey_info_field "Serial number")
  firmware=$(yubikey_info_field "Firmware version")
  success "YubiKey detected (serial: ${serial:-$NO_SERIAL}, firmware: ${firmware:-unreported})"

  # OpenPGP card status
  echo ""
  info "OpenPGP card status:"
  local card_status
  card_status=$(gpg --card-status 2>/dev/null || true)

  if [[ -z $card_status ]]; then
    warn "  Could not read OpenPGP card status."
  else
    local sig_key enc_key auth_key
    sig_key=$(echo "$card_status" | grep "Signature key" | head -1 || true)
    enc_key=$(echo "$card_status" | grep "Encryption key" | head -1 || true)
    auth_key=$(echo "$card_status" | grep "Authentication key" | head -1 || true)

    if echo "$sig_key" | grep -q "none"; then
      warn "  Signature slot: empty"
    else
      success "  Signature slot: populated"
    fi
    if echo "$enc_key" | grep -q "none"; then
      warn "  Encryption slot: empty"
    else
      success "  Encryption slot: populated"
    fi
    if echo "$auth_key" | grep -q "none"; then
      warn "  Authentication slot: empty"
    else
      success "  Authentication slot: populated"
    fi
  fi

  # FIDO2/U2F status
  echo ""
  info "FIDO2 status:"
  local fido_info
  fido_info=$(ykman fido info 2>/dev/null || true)
  if [[ -n $fido_info ]]; then
    success "  FIDO2 applet accessible"
  else
    warn "  FIDO2 applet not accessible"
  fi

  # PIV/age status
  echo ""
  info "PIV slots (age-plugin-yubikey):"
  local age_identities
  age_identities=$(age-plugin-yubikey --identity 2>/dev/null || true)
  if [[ -n $age_identities ]]; then
    local slot_count
    slot_count=$(echo "$age_identities" | grep -c "^AGE-PLUGIN-YUBIKEY-" || true)
    success "  $slot_count age identity/identities found"
    echo "$age_identities" | grep "^#" | sed 's/^/    /'
  else
    warn "  No age identities found on this YubiKey"
  fi

  # GPG agent SSH
  echo ""
  info "GPG-agent SSH support:"
  local ssh_keys
  ssh_keys=$(ssh-add -L 2>/dev/null || true)
  if echo "$ssh_keys" | grep -q "cardno:"; then
    success "  SSH key from YubiKey available via gpg-agent"
  else
    warn "  No YubiKey SSH key in agent (may need: gpg --card-status)"
  fi

  # Check against NixOS config (best-effort)
  echo ""
  info "Config cross-reference:"
  local config_files=(hosts/*/default.nix)
  # An empty pattern matches every line, so a token without a serial would be
  # reported as found in every file.
  if [[ -z $serial ]]; then
    warn "  This token reports no serial number, so there is nothing to look up."
    config_files=()
  fi
  for cfg in "${config_files[@]+"${config_files[@]}"}"; do
    if [[ -f $cfg ]]; then
      if grep -qF -- "$serial" "$cfg" 2>/dev/null; then
        success "  Serial $serial found in $cfg"
      else
        warn "  Serial $serial NOT found in $cfg"
      fi
    fi
  done

  echo ""
  success "Verification complete."
}

After Onboarding

  1. Update your fleet’s host configurations with the output values
  2. Update .sops.yaml in the secrets repo with all age recipients
  3. Re-encrypt secrets: sops updatekeys <secret-files>
  4. Upload public key to GitHub: gpg --armor --export <FINGERPRINT>
  5. Rebuild: just switch <hostname>

Script Entrypoint

main() {
  # Handle --verify mode separately
  if $VERIFY_MODE; then
    mode_verify
    exit 0
  fi

  header "YubiKey Onboarding Script"
  echo "This script will guide you through provisioning a new YubiKey for use"
  echo "with this NixOS configuration (PGP, U2F, SSH, sops-nix)."
  echo ""
  echo "Following drduh's YubiKey guide: https://github.com/drduh/YubiKey-Guide"
  echo ""

  if $DRY_RUN; then
    warn "DRY-RUN MODE: No destructive operations will be performed."
    echo ""
  fi

  if [[ -n $OPT_FROM_BACKUP ]]; then
    info "Mode: key rotation (importing from existing backup)"
  else
    info "Mode: new key generation"
  fi
  echo ""

  if ! prompt_yn "Ready to begin?" "y"; then
    echo "Aborted."
    exit 0
  fi

  # gpg-agent starts pinentry on the terminal named here. Without it, a gpg
  # that is fed its commands on another descriptor has no terminal to name.
  if [[ -t 0 ]]; then
    GPG_TTY=$(tty)
    export GPG_TTY
  fi

  # One-time phases: preflight always runs
  phase_preflight

  # Either generate new keys or import from backup
  if [[ -n $OPT_FROM_BACKUP ]]; then
    phase_import_from_backup
  else
    phase_generate_keys
    phase_backup
  fi

  # Determine how many YubiKeys to provision
  local target_count="${OPT_KEY_COUNT:-}"

  # Provision first YubiKey
  provision_yubikey 0
  NUM_KEYS=1

  # Provision additional YubiKeys
  if [[ -n $target_count ]]; then
    # Non-interactive: provision exactly the requested count
    while [[ $NUM_KEYS -lt $target_count ]]; do
      echo ""
      info "Restoring subkeys so they can be moved to the next YubiKey..."
      restore_subkeys
      echo ""
      warn "Remove the current YubiKey and insert YubiKey #$((NUM_KEYS + 1))."
      read -rp "$(echo -e "${BOLD}Press Enter when the new YubiKey is inserted...${NC}")"
      echo ""

      provision_yubikey "$NUM_KEYS"
      NUM_KEYS=$((NUM_KEYS + 1))
    done
  else
    # Interactive: ask after each key
    while prompt_yn "Provision another YubiKey with the same PGP key (redundancy)?"; do
      echo ""
      info "Restoring subkeys so they can be moved to the next YubiKey..."
      restore_subkeys
      echo ""
      warn "Remove the current YubiKey and insert the next one."
      read -rp "$(echo -e "${BOLD}Press Enter when the new YubiKey is inserted...${NC}")"
      echo ""

      provision_yubikey "$NUM_KEYS"
      NUM_KEYS=$((NUM_KEYS + 1))
    done
  fi

  # One-time post-provisioning phases
  phase_ssh_keygrip
  phase_import_pubkey
  phase_age_backup
  phase_summary

  local item
  if [[ ${#UNCHANGED_CREDENTIALS[@]} -gt 0 ]]; then
    warn "Not changed in this run, as --allow-default-pins permits:"
    for item in "${UNCHANGED_CREDENTIALS[@]}"; do
      warn "  $item"
    done
  fi

  # Provisioning is done at this point, but a run that leaves key material
  # unencrypted on the backup medium does not end as a success.
  if [[ ${#PLAINTEXT_LEFT[@]} -gt 0 ]]; then
    error "$NUM_KEYS YubiKey(s) provisioned, but these exports are still plaintext:"
    for item in "${PLAINTEXT_LEFT[@]}"; do
      error "  $item"
    done
    error "Encrypt them or remove them. Each holds secret key material."
    exit 1
  fi

  if $DRY_RUN; then
    success "Dry run complete. Nothing was provisioned and nothing was written."
    return 0
  fi

  success "All done! $NUM_KEYS YubiKey(s) provisioned."
  success "Remember to clean up backup files from insecure locations."
}

Security Notes

  • The script runs with umask 077, so every file it writes is owned by the caller and readable by nobody else
  • The master key lives in a temporary GNUPGHOME on ramfs and is cleaned up on exit via an EXIT trap. ramfs pages are never written to disk or swap. The script re-execs itself under unshare -Urm --propagation slave to mount it, which needs no privilege, and the mount dies with the process rather than needing an unmount that could fail. Where unprivileged user namespaces are disabled it falls back to /dev/shm and says so. That fallback is tmpfs, whose pages are swappable, so on a host with active swap the key can reach disk while it exists, and the script warns when it sees swap
  • The master key is generated unprotected and a passphrase is set before the backup phase. Entry runs through gpg-agent’s own pinentry on the same terminal, so the passphrase stays in the agent’s mlocked memory and never reaches a shell variable. A gate re-reads the on-disk protection state afterwards, so a cancelled dialog cannot pass. --no-passphrase is the explicit escape hatch
  • The backup directory has no default and a volatile target is refused unless --force-volatile is given, since the backup is the only copy of a master key whose subkeys cannot be extracted from the YubiKey again
  • Phase 4 changes the OpenPGP and PIV credentials and refuses to finish with one left unchanged unless --allow-default-pins is given. The FIDO2 applet ships without a PIN, and the script does not set one
  • shred cannot promise removal on flash media or on a copy-on-write filesystem. See What shred Removes
  • Names, email addresses, paths and every other prompted or flag value are refused when they contain a newline or another control character, since some of them are fed to gpg as commands
  • The GPG configuration follows drduh’s hardened settings
  • In --from-backup mode, the master key is loaded into the same ramfs GNUPGHOME from the backup, so it still never persists to disk. An encrypted backup is decrypted there and nowhere else

Secure Boot

Enrolling your own Secure Boot keys on a host that uses othrys.system.bootloader. The keys are created with sbctl, the boot chain is signed on the next rebuild, and the firmware is given the keys last. That order matters, since a firmware that enforces Secure Boot before the boot chain is signed refuses to start it.

Two bootloader types support this. Limine signs itself natively, while systemd-boot is signed through lanzaboote. The steps are the same on both paths and the differences are called out where they occur. See Bootloader & Secure Boot for what the module sets on each.

Prerequisites

  • A UEFI host with othrys.system.bootloader.enable = true and type set to "limine" or "systemd-boot". "grub" and "none" fail evaluation with secureBoot = true.
  • On "systemd-boot", a lanzaboote input in the consuming flake and inputs.lanzaboote.nixosModules.lanzaboote in the host’s modules
  • Access to the firmware setup screen
  • Secure Boot switched off in the firmware for now, so that the still unsigned system keeps booting

Steps

1. Create the Keys

sbctl is installed by the module once secureBoot is on, so the first run comes from nixpkgs.

sudo nix run nixpkgs#sbctl -- create-keys

The keys land in /var/lib/sbctl, readable by root only. They have to exist before the rebuild in step 2, because both installers sign during that rebuild. The Limine installer stops with There are no sbctl secure boot keys present when the directory is missing, and lanzaboote fails when it cannot read its key files.

On a host with othrys.system.impermanence.enable = true, copy the keys to the persistent volume before rebuilding. The module persists /var/lib/sbctl once secureBoot is on, and impermanence then bind-mounts the persisted directory over the original without copying what was there. Keys that exist only on the ephemeral root are hidden by that mount and gone after the next reboot.

sudo mkdir -p /persist/var/lib
sudo cp -a /var/lib/sbctl /persist/var/lib/

Replace /persist with the value of othrys.system.impermanence.persistRoot when the host changes it.

2. Rebuild with secureBoot

On Limine:

othrys.system.bootloader = {
  enable = true;
  secureBoot = true;
};

On systemd-boot:

othrys.system.bootloader = {
  enable = true;
  type = "systemd-boot";
  secureBoot = true;
};

Then rebuild.

sudo nixos-rebuild switch --flake .#<hostname>

On Limine the installer signs the Limine EFI binary with the sbctl keys. NixOS also turns on enrollConfig, validateChecksums and panicOnChecksumMismatch and refuses to evaluate without them, so Limine carries a hash of its own configuration, the configuration carries a checksum for every kernel and initrd, and a mismatch stops the boot.

On systemd-boot the module enables boot.lanzaboote with pkiBundle = "/var/lib/sbctl" and turns boot.loader.systemd-boot.enable off. Lanzaboote installs systemd-boot itself and writes one signed image for each generation, which vouches for the kernel and initrd stored beside it.

The nixpkgs documentation for boot.loader.limine.secureBoot.enable lists key enrollment before this rebuild. Signing needs only the keys on disk, so the order here works on Limine too, and it keeps the firmware from enforcing anything before a signed bootloader is in place.

3. Verify the Signatures

sudo sbctl verify

On Limine the file to look for is EFI/limine/BOOTX64.EFI under the EFI system partition, and it must be reported as signed. Kernel images are reported as not signed, which is expected because Limine checks them against the checksums in its configuration.

On systemd-boot EFI/BOOT/BOOTX64.EFI, EFI/systemd/systemd-bootx64.efi and every EFI/Linux/nixos-generation-*.efi must be signed. Kernel files under EFI/nixos are often reported as not signed, which the lanzaboote documentation lists as expected.

Do not continue while a file that must be signed is not.

4. Put the Firmware in Setup Mode

The firmware accepts new keys only in setup mode, and how to reach it differs between vendors.

systemctl reboot --firmware-setup

In the Secure Boot section, choose the entry that resets to setup mode. Where no such entry exists, erasing the Platform Key has the same effect. Where the firmware offers a separate entry that clears every key, leave it alone, since it also empties the forbidden signature database. Save, boot back into NixOS and confirm.

sudo sbctl status

Setup Mode must read Enabled.

5. Enroll the Keys

sudo sbctl enroll-keys --microsoft

--microsoft enrolls Microsoft’s certificates next to your own, and it is usually kept. The option ROMs on graphics cards, network cards and storage controllers are typically signed by Microsoft, and a firmware that enforces Secure Boot refuses to run the ones it cannot verify. On some machines that leaves no video output, and with it no way to reach the firmware setup. A Windows installation on the same machine needs those certificates as well. Leave the flag out only on hardware known to carry no such option ROMs.

Some firmware also needs --firmware-builtin, which keeps the vendor’s own keys so that firmware updates from the vendor still verify. The nixpkgs Limine documentation enrolls with both flags.

6. Reboot and Confirm

reboot

Some firmware switches Secure Boot on as soon as a Platform Key is enrolled. On the rest, enter the firmware setup once more and enable it. Then check the result from the running system.

bootctl status

The System block must show Secure Boot: enabled (user). bootctl reads the firmware variables and reports the same line on Limine and on systemd-boot.

After Enrollment

Every later rebuild signs what it installs, so nothing here has to be repeated. The private keys stay in /var/lib/sbctl, which the module persists when impermanence is on. Losing that directory means starting again from step 1, including another pass through setup mode.

Limits

  • No option exists for TPM measured boot, so nothing here ties disk unlock to the Secure Boot state.
  • The eval-bootloader check proves that both paths evaluate. No check boots a VM under firmware Secure Boot, so the first boot after step 6 is the test.

IRC with soju and senpai

A soju bouncer on a server, behind Traefik, with senpai as the client on the same server and on a laptop. soju stays connected to the networks and keeps their history, and each senpai connects to soju and never to a network directly.

Prerequisites

  • A server built from this flake, with irc.example.com resolving to it
  • A DNS provider whose API token Traefik can use for DNS-01 ACME
  • nixosModules.home on the server and nixosModules.home or darwinModules.home on the laptop, since senpai is configured through Home Manager

Steps

1. Turn on Traefik with ACME

othrys.services.traefik = {
  enable = true;
  acme = {
    enable = true;
    email = "alice@example.com";
    dnsProvider = "cloudflare";
  };
  environmentFiles = [config.sops.secrets."traefik/env".path];
};

Traefik terminates TLS for soju with the certificate this resolver issues, and the soju module refuses traefik.enable while ACME is off.

2. Turn on soju

othrys.services.soju = {
  enable = true;
  traefik = {
    enable = true;
    domain = "irc.example.com";
  };
};

Traefik now listens on port 6697 and forwards to soju on [::1]. A client that sends no TLS server name is not routed.

3. Create the First Account

sudo sojuctl user create -username alice -password 'change-me' -admin true

The module declares no accounts. The password is visible in the process list while this command runs, and it is written to the shell history.

4. Configure senpai on the Server

othrys.apps.senpai = {
  enable = true;
  nickname = "alice";
  passwordFile = config.sops.secrets."senpai/password".path;
};

address defaults to soju’s loopback listener, since soju is on the same host. senpai logs in with nickname as the account name.

5. Configure senpai on the Laptop

othrys.apps.senpai = {
  enable = true;
  address = "irc.example.com";
  nickname = "alice";
  passwordFile = "/run/secrets/senpai-password";
  # Only when the nickname differs from the soju account name.
  # settings.username = "alice";
};

A bare host name connects with TLS on port 6697, which is Traefik’s entrypoint for soju.

6. Add an Upstream Network

From either senpai, ask soju’s BouncerServ for the network.

/msg BouncerServ network create -addr irc.libera.chat -name libera

soju connects to the network and keeps the connection open while no client is attached. /msg BouncerServ help lists the other commands.

Dev Shells

Development environments defined in flake/dev-shells.nix.

Available Shells

    devShells = {
      # For work on this repository. Installs every hook on shell entry, and
      # carries the commands an agent session is held to: check-one,
      # hygiene-scan and module-coverage.
      default = shellFor (portableHooks // repositoryHooks) agentTools;

      # For a flake that re-exports the shell. Same tools, portable hooks only.
      # The repository hooks check this repository's own tree and reject any
      # other, so a consumer points its default here:
      #   devShells.default = inputs'.othrys.devShells.consumer;
      consumer = shellFor portableHooks [];

      javascript = pkgs.mkShell {
        name = "javascript-dev";
        packages = with pkgs; [
          nodejs_22
          pnpm
          yarn
          bun
          typescript
          typescript-language-server
          eslint
          prettier
          # No vite. pkgs.vite is ViTE, a trace viewer for Linux, and a
          # project takes the Vite build tool from its own dependencies.
        ];
      };

      python = pkgs.mkShell {
        name = "python-dev";
        packages = with pkgs; [
          python312
          python312Packages.pip
          python312Packages.virtualenv
          poetry
          python312Packages.black
          python312Packages.pylint
          python312Packages.pytest
          python312Packages.python-lsp-server
        ];
      };

      golang = pkgs.mkShell {
        name = "golang-dev";
        packages = with pkgs; [
          go
          gopls
          gotools
          go-tools
          delve
          golangci-lint
        ];
        shellHook = ''
          export GOPATH="$HOME/go"
          export PATH="$GOPATH/bin:$PATH"
        '';
      };

      java = pkgs.mkShell {
        name = "java-dev";
        packages = with pkgs; [
          jdk21
          maven
          gradle
        ];
      };

      iac = pkgs.mkShell {
        name = "iac-dev";
        packages = with pkgs; [
          opentofu
          terraform-ls
          tflint
          ansible
          ansible-lint
          awscli2
          kubectl
          kubernetes-helm
          k9s
          sops
          age
        ];
      };

      rust = pkgs.mkShell {
        name = "rust-dev";
        packages = with pkgs; [
          rustc
          cargo
          rust-analyzer
          rustfmt
          clippy
          cargo-watch
          cargo-edit
          cargo-audit
        ];
        RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
      };
    };

Usage

# Enter the default shell (Nix tooling + pre-commit hooks)
just dev

# Enter a specific shell
just dev javascript
just dev python
just dev golang
just dev java
just dev iac
just dev rust

Direnv Integration

The repository includes an .envrc that automatically activates the default dev shell when you enter the directory. This provides Nix tooling and pre-commit hooks without manual nix develop.

Adding a New Shell

Add a new entry to the devShells attrset in flake/dev-shells.nix:

myshell = pkgs.mkShell {
  name = "myshell-dev";
  packages = with pkgs; [ ... ];
};

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

Design Spike: Standalone Home-Manager Export

Status: assessed, not pursued (revisit when a concrete non-NixOS machine needs it). This page records the feasibility analysis so the next look doesn’t start from zero.

The ask

Expose othrys’ user-level configuration (editor, shells, git, CLI tools) as homeManagerModules consumable by standalone home-manager, so work laptops, other distros and darwin.

Why it isn’t a packaging exercise

The user-level configuration in this repository reads NixOS-scoped state. Most modules contribute an othrys.internal.homeConfig entry written at NixOS scope, which reads config directly, while the nixvim and VSCodium fragments are Home Manager modules of their own and read it through osConfig:

  • Identity and guards. othrys.system.user.name, othrys.system.users.homeManaged: the whole per-user guard architecture lives at the NixOS layer. Standalone HM has no osConfig; every gate would need an HM-scoped equivalent.
  • The registry is applied at the NixOS layer. nixosModules.home is the one module that hands othrys.internal.homeConfig to Home Manager, and it writes home-manager.users, an option of Home Manager’s NixOS module. A standalone export needs a second reader of the registry.
  • Cross-module signals. othrys.desktop.graphical, othrys.desktop.lockCommand, othrys.theme.*, othrys.apps.languages.*: the single-signal architecture is declared in NixOS options. Fragments consult these signals constantly (nixvim’s palette fallback, yazi’s clipboard dep, editor toolchain wiring).
  • Mixed-scope modules. Most modules write both system and user config (languages installs toolchains via HM but is gated at the system layer, and theming spans both). Splitting them is a rewrite rather than a refactor.

What portability would take

A shared options layer: declare the othrys.* option schemas once in a scope-neutral module imported by both the NixOS tree (as today) and an HM tree (new), with fragments reading config.othrys.* from whichever scope they’re evaluated in instead of osConfig. Roughly:

  1. Extract option declarations from ~20 modules into shared files.
  2. Rewrite every osConfig read (about 60 sites, nearly all in the nixvim and VSCodium fragments) and every NixOS-scope read inside a registry entry to scope-relative reads.
  3. Re-implement the guard semantics for HM scope (no accounts to guard, so homeManaged is trivially true, graphical becomes a consumer-set flag).
  4. A parallel check matrix for the HM outputs.

Estimate: comparable to the headless-decoupling effort (a multi-session refactor), touching every module with user-level state.

Candidate surface (if pursued)

Genuinely portable content, in value order: nixvim (the whole tree), zsh/starship/bash, git, yazi, gh, comma, the language toolchains. Not portable: anything desktop (compositor-coupled), persistence (impermanence is NixOS), services.

Recommendation

No-go for now. The cost lands on every module while the benefit waits on a machine that doesn’t exist in the fleet yet. If one appears, do the shared-options-layer refactor first as its own phase (it is also a cleanliness win for the NixOS tree), then export the candidate surface incrementally, starting with nixvim.

Linting & Formatting

Nine hooks run on every commit once the dev shell has installed them, and the pre-commit-check flake check runs the same set in CI. Both are built from the two hook sets named in flake/checks/default.nix.

Hooks

HookPurposeHook stageRun by hand
treefmtFormats Nix (Alejandra), shell (shfmt), TOML (taplo), YAML (yamlfmt) and Markdown (mdformat)pre-commitjust fmt
StatixNix linter (anti-patterns)pre-commitjust lint
DeadnixDead code detectorpre-commitjust lint
commitizenConventional commit message validationcommit-msgcz check
gitleaksScans what the commit stages for keys and tokenspre-commit
comment-hygieneFile headers, banner comments, anchors, and docs pages and linkspre-commit
contract-mirrorKeeps the consumer contract in CONTRIBUTING.md and AGENTS.md identicalpre-commit
contract-guardsEnforces the consumer contract against modules/pre-commit
hygiene-scanRefuses staged text that names private infrastructure, such as an SSH flake URL or a tailnet addresspre-commithygiene-scan FILE

The first five suit any Nix repository, and devShells.consumer installs those alone. The last four read this repository’s own tree, so only devShells.default installs them.

Alejandra is not a hook of its own. It runs as one of the treefmt formatters, which are configured in flake/treefmt.nix. mdformat skips docs/ and CHANGELOG.md.

secret-scan is a separate flake check that runs gitleaks over every tracked file, where the hook sees only what one commit stages.

Commit Messages

commitizen enforces the Conventional Commits format.

type(scope): description

# Examples:
feat: add ashell status bar module
fix: resolve GPU adapter failure with Vulkan backend
chore: update flake inputs
docs: add keybindings reference

Valid types: feat, fix, chore, docs, style, refactor, perf, test, build, ci, revert.

Hooks are built in flake/dev-shells.nix with git-hooks.nix and installed when entering the dev shell (nix develop).

Manual Checks

# Format the repository
just fmt

# Format check, statix and deadnix
just lint

# lint plus nix flake check
just ci

just lint runs statix and deadnix from the dev shell. nix run nixpkgs#statix resolves through the flake registry and not through flake.lock, so it can run a different version than CI and the hook do.

Fixing Issues

  • Formatting: just fmt auto-fixes all formatting
  • Statix: Read the suggestions and apply them by hand, or run nix develop -c statix fix .
  • Deadnix: Remove unused variables/arguments flagged by deadnix

Agent Sessions

The repository carries a configuration for Claude Code, so that an agent working here is held to the same rules as a person. It is maintainer tooling. An outside contributor may use it, and AI_POLICY.md at the repository root applies in full to what they submit. Everything under .claude/ is shared by every contributor’s session, and nothing in it is tailored to one person. A contributor’s own preferences, including whether a session may push, tag, sign or merge, belong in their own ~/.claude/settings.json or in .claude/settings.local.json, which git ignores.

A session starts inside nix develop, since the dev shell provides the language server, the formatter, the three commands the session depends on and the hook program its settings run.

Layout

PathHolds
AGENTS.mdThe instructions every session reads, which are the consumer contract, the public hygiene rules and the writing conventions
.claude/settings.jsonThe commands a session is denied and allowed, and the hooks that run before and after every write and shell command
.claude/agents/Three sub-agents
.claude/skills/Ten procedures, each also a slash command
.claude/commands/One command that reads the branch before it runs
flake/checks/agent-hook.pyThe hook program, built into the dev shell as othrys-agent-hook

Claude Code reads AGENTS.md as project instructions when no CLAUDE.md exists, so the repository keeps one file for every tool that reads it.

Agents and the Module Skill

The module skill carries a change under modules/ from the request to a reviewed branch. It runs in the main session, since a sub-agent cannot hand work to another one. The main session writes the module itself and hands the check, the page and the review to sub-agents, in that order.

Sub-agentMay writeDoes
checksflake/checks/, the build workflow and the CI pageWrites the check and returns its name
docsdocs/ and README.mdWrites the module’s page
reviewerNothingReads the branch against the contract, hygiene and coverage, and returns findings

The hook program enforces each column. A write by one of these three outside its paths is refused, measured from the root of whichever worktree of the repository holds the file. The reviewer may run only git diff, git log, git show, git status, git merge-base, hygiene-scan and module-coverage, with no redirection and no option that writes a file or runs another program, and every command it substitutes is held to the same list. No sub-agent of any kind may run check-one. Claude Code’s own sub-agents, such as general-purpose, are not limited to a set of paths.

The review is binding. For each finding the main session either fixes it or states why it stands, and it runs the review a second time after fixes. It stops after the second round and lists what is left.

Skills and Commands

A skill is a procedure a session loads when the work calls for it, and each is also available as a slash command.

SkillFor
moduleCarrying one module change through its check, its page and a review
add-moduleA new module with its options, check and page
change-moduleA change to options, defaults or behaviour, with the rules for a breaking one
remove-moduleRemoving a module and every reference to it
document-moduleA module’s page under docs/src/modules/
write-checkA check that reads a module’s behaviour back from an evaluated host
update-inputsReading a flake.lock update and fixing what it breaks
releasePreparing a release for a maintainer to cut
write-issueAn issue in the four-heading form
statusSummarising open work, unreleased commits and the last runs on main

release and status run only when invoked by name. status reads GitHub through gh, so each of its commands is left to the user’s own permission settings. /review hands the current branch to the reviewer sub-agent.

Automatic Steps

.claude/settings.json runs othrys-agent-hook before and after every write and every shell command. None of these steps calls a model.

  • The dev shell. A write is refused when othrys-agent-hook is not on PATH, since nothing could scan it. Claude Code lets a call through when a hook command is missing or exits with any status but 2, so the settings put a shell test in front of the program, and the program exits 2 whenever it fails before a call.
  • Hygiene. Before a write, the hook reconstructs each complete resulting file and passes it to hygiene-scan under its path in the repository. A file in another worktree of the repository is scanned the same way, and a file outside the repository is not scanned. It applies multiple edits in order, and it refuses a write when the scan fails or when an edit’s old text is missing or not unique. The scan covers what a pattern can prove, which is an SSH flake URL, a sops-encrypted value, an age secret key, an address in 100.64.0.0/10, and an e-mail address at a domain the tree does not already use. A hostname or a person’s name passes it, which is why the reviewer reads for those. The same scan is a pre-commit hook, which receives filenames so it also scans CI’s committed checkout. Running hygiene-scan without arguments scans staged contents, including renamed files. A file written by a shell command is not scanned before the write, and the pre-commit hook scans it when it is staged.
  • Formatting. After a write, the hook runs treefmt on the file.
  • Coverage. After a write in a session that edited a module, the hook runs module-coverage. If the branch changed a module and no check or no page, the session is told which is missing, once for each distinct report. The comparison is against main, and OTHRYS_COVERAGE_BASE names another branch for work stacked on one.
  • Main. Before a shell command, the hook reads each git call in it, including those inside a substitution, with its directory from git -C or an earlier cd. It refuses a call that records history where main is checked out, or after the same command switched to main. It also refuses one that deletes, renames, resets or copies onto main, rewrites refs/heads/main, fetches or pushes into it, or rebases it. A command it cannot read is refused when it calls git. After the command, the hook compares main with the commit it pointed at before. If it moved anyway, the session is told to stop and report both commits. These refusals need the dev shell. Outside it the settings let a shell command through, while a write is still refused.

The hook keeps what it needs between calls, which is the head of main and whether the session edited a module, in the repository’s git directory under othrys-agent/, and holds a lock on it while it reads and writes, since a session and its background sub-agents run hooks at the same time.

Limits

  • One evaluation at a time. check-one <name> builds a single check under one job and, where the user manager allows it, inside a memory-capped scope. It is the only route to an evaluation, and nix build, nix eval, nix flake check, nix develop, nix-build, nixos-rebuild and just are denied. The defaults are one job, four cores and 16G, and OTHRYS_CHECK_JOBS, OTHRYS_CHECK_CORES and OTHRYS_CHECK_MEMORY change them.
  • main stays put. A refusal from the hook stops a call before permission rules are read, so no allow rule in a user’s own settings lets through a git command the hook refuses.
  • Landing. Pushing, tagging, signing and merging are not configured here. They follow each user’s own settings, and every commit on main still carries a maintainer’s signature, which the Commit signatures job checks.

just is denied because a recipe is a line of shell in a file the session can edit. check-one and othrys-agent-hook are store paths, so an edit made during a session cannot change what they run.

The denied commands are a guard against the ordinary case and are not a sandbox. A shell can reach nix in ways no pattern lists, and the signature check on main is what holds when the patterns do not.

Checks

agent-config reads the configuration as files. It fails when the settings file is not valid JSON, when a permission list holds anything but rules, when a hook runs othrys-agent-hook without the dev-shell test in front of it, and when no hook refuses a write outside the dev shell. It fails when that gate does not cover every tool that writes or runs the wrong step of the hook, and when no hook runs the hook on shell commands or after a call. It also fails when a skill’s name does not match its directory, when an agent, a skill or a command has no description or carries a key Claude Code does not read, when an agent names a tool or a skill that does not exist, and when a command names an agent that does not exist. It then runs the tests under pytest, which cover each refusal above, the reconstruction of edits, the coverage reminder, broken copies of the settings and the agents, and the staged-rename and clean-index cases of hygiene-scan.

Justfile Commands

Each repository carries its own justfile. This one covers library development, while a consuming fleet’s covers host management. Run just in either repo to see available commands.

othrys.nix (this repository)

CommandDescription
just checknix flake check, which runs every check, the VM tests included
just check-one NAMEOne named check, under one job and a memory cap
just fmtFormat the repo (treefmt)
just lintFormat check + statix + deadnix
just cilint + flake check
just update [input]Update flake inputs
just docs [build|serve|clean]MdBook documentation
just dev [shell]Enter dev shell
just replOpen Nix REPL
just cleanRemove build artifacts
just yubikey-onboard [args]Onboard/rotate YubiKey(s) (options)
just release [bump]Run just ci, then bump the version with commitizen, write CHANGELOG.md and tag the release
CommandDescription
just build [host]Build a host (defaults to current hostname)
just test [host]Test configuration (reverts on reboot)
just switch [host]Apply configuration permanently
just boot [host]Set configuration for next boot
just diff [host]Show diff between current and new configuration
just update [input]Update flake inputs (incl. secrets, othrys)
just checkValidate flake (hosts must evaluate)
just fmtFormat (treefmt, re-exported from othrys.nix)
just gc [age] / just maintain [age]Garbage collect / GC + optimize
just disk <host> / just install <host>Fresh-install workflow
just luks-enrollEnroll a YubiKey into the LUKS keyslot
just cilint + check + build every host

Upgrade Pattern

The test, switch, and boot commands accept an upgrade argument to update inputs first:

just switch <hostname> upgrade

Module Options

Every othrys.* option, generated from the module tree. Do not edit by hand. Each option names the platforms that declare it, and one declared on nix-darwin is in darwinModules.default or one of the darwin adapters.

othrys.apps.ai.claude-code.enable

Whether to enable Claude Code AI assistant.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.ai.claude-code.package

The Claude Code package. The default tracks Anthropic’s releases within hours and comes from cache.numtide.com, which the host then trusts. A package set here is used as given, and disableTelemetry no longer applies to it.

Platforms: NixOS and nix-darwin.

Type: package

Default: the claude-code package of the llm-agents flake this library locks, built with disableTelemetry

Example:

pkgs.claude-code

Declared by:

othrys.apps.ai.claude-code.agents

Agent markdown files for .claude/agents/.

Platforms: NixOS and nix-darwin.

Type: attribute set of (string or absolute path)

Default:

{ }

Declared by:

othrys.apps.ai.claude-code.commands

Command markdown files for .claude/commands/.

Platforms: NixOS and nix-darwin.

Type: attribute set of (string or absolute path)

Default:

{ }

Declared by:

othrys.apps.ai.claude-code.disableTelemetry

Build the default package with telemetry and non-essential traffic turned off, through its own disableTelemetry argument.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.apps.ai.claude-code.hooks

Hook scripts for .claude/hooks/.

Platforms: NixOS and nix-darwin.

Type: attribute set of string

Default:

{ }

Declared by:

othrys.apps.ai.claude-code.permissions.defaultMode

Claude Code’s permission mode. “default” prompts before each edit. “acceptEdits” applies file writes without asking, in whichever repository the session was started from, so it is opt-in per host rather than a library default.

Platforms: NixOS and nix-darwin.

Type: one of “default”, “acceptEdits”, “plan”, “bypassPermissions”

Default:

"default"

Declared by:

othrys.apps.ai.claude-code.permissions.extraAllow

Additional permission rules appended to the curated allow-list.

Platforms: NixOS and nix-darwin.

Type: list of string

Default:

[ ]

Example:

[ "Bash(cargo test:*)" ]

Declared by:

othrys.apps.ai.claude-code.permissions.extraDeny

Additional permission rules appended to the curated deny-list.

Platforms: NixOS and nix-darwin.

Type: list of string

Default:

[ ]

Declared by:

othrys.apps.ai.claude-code.rules

Rule markdown files for .claude/rules/.

Platforms: NixOS and nix-darwin.

Type: attribute set of (string or absolute path)

Default:

{ }

Declared by:

othrys.apps.ai.claude-code.skills

Skill files for .claude/skills/, for Claude Code alone. They are written beside othrys.apps.ai.skills, and an entry of the same name here replaces the shared one for this tool.

Platforms: NixOS and nix-darwin.

Type: attribute set of (string or absolute path)

Default:

{ }

Declared by:

othrys.apps.ai.claude-code.theme

Claude Code UI theme. The daltonized pair is adjusted for colour blindness, and the ansi pair draws with the terminal’s own sixteen colours.

Platforms: NixOS and nix-darwin.

Type: one of “dark”, “light”, “dark-daltonized”, “light-daltonized”, “dark-ansi”, “light-ansi”

Default:

"dark"

Declared by:

othrys.apps.ai.claude-desktop.enable

Whether to enable Claude Desktop.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.ai.claude-desktop.package

The Claude Desktop package. The default repackages Anthropic’s own Linux build and comes from cache.numtide.com, which the host then trusts.

Platforms: NixOS only.

Type: package

Default: the claude-desktop package of the llm-agents flake this library locks

Declared by:

othrys.apps.ai.codex.enable

Whether to enable OpenAI Codex CLI.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.ai.codex.package

The Codex package. The default tracks OpenAI’s releases within hours and comes from cache.numtide.com, which the host then trusts.

Platforms: NixOS and nix-darwin.

Type: package

Default: the codex package of the llm-agents flake this library locks

Example:

pkgs.codex

Declared by:

othrys.apps.ai.codex.disableTelemetry

Turn off Codex’s analytics, its metrics exporter, /feedback uploads and the startup check for a newer release.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.apps.ai.codex.permissions.denyRead

Paths and globs, relative to the workspace root, that sandboxed commands may not read. The list matches Claude Code’s read denials. Codex marks the permission profiles that carry it as Beta, and a command run outside the sandbox, through an allow rule or an approved escalation, is not bound by it.

Platforms: NixOS and nix-darwin.

Type: list of string

Default:

[
  ".env"
  ".env.*"
  "secrets/**"
]

Declared by:

othrys.apps.ai.codex.permissions.extraRules

Lines appended to the module’s command rules, in Codex’s Starlark rule syntax. An allow rule runs its command outside the sandbox.

Platforms: NixOS and nix-darwin.

Type: strings concatenated with “\n”

Default:

""

Example:

"prefix_rule(pattern = [\"cargo\", \"test\"], decision = \"allow\")"

Declared by:

othrys.apps.ai.codex.permissions.mode

How freely Codex works, named after Claude Code’s modes. “default” keeps the workspace read-only, so every edit asks first. “acceptEdits” lets Codex edit the workspace without asking, and it also runs commands without asking, inside a sandbox with no network that writes only to the workspace. Codex has no mode that applies edits freely while prompting for every command. Either way, leaving the sandbox asks first.

Platforms: NixOS and nix-darwin.

Type: one of “default”, “acceptEdits”

Default:

"default"

Declared by:

othrys.apps.ai.codex.settings

Settings for config.toml, merged over what the module writes and winning over it.

Platforms: NixOS and nix-darwin.

Type: TOML value

Default:

{ }

Example:

{ model = "gpt-5"; }

Declared by:

othrys.apps.ai.codex.skills

Skills for Codex alone. They are written beside othrys.apps.ai.skills, and an entry of the same name here replaces the shared one for this tool.

Platforms: NixOS and nix-darwin.

Type: attribute set of (string or absolute path)

Default:

{ }

Declared by:

othrys.apps.ai.context.extra

The host’s own lines, appended to the global context of every enabled assistant.

Platforms: NixOS and nix-darwin.

Type: strings concatenated with “\n”

Default:

""

Example:

''
  # House rules
  
  Commit messages follow Conventional Commits.
''

Declared by:

othrys.apps.ai.context.nixos.enable

Whether to enable the text that tells an assistant it runs on NixOS, and what that rules out.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

!pkgs.stdenv.hostPlatform.isDarwin

Example:

true

Declared by:

othrys.apps.ai.context.text

The global context every enabled assistant receives (derived; do not set).

Platforms: NixOS and nix-darwin.

Type: string (read only)

Default: the text of nixos-context.md beside this module while context.nixos.enable is on, with a line about the root wipe added when othrys.system.impermanence.enable is set, an option only NixOS declares, followed by context.extra

Declared by:

othrys.apps.ai.mcp.context7.enable

Whether to enable Context7 MCP server.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.ai.ollama.enable

Whether to enable Ollama local LLM server.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.ai.ollama.acceleration

GPU acceleration backend for Ollama, which picks the package. The default follows the host’s GPU. Vulkan runs on AMD and Intel cards alike, and an AMD host that wants ROCm names it here. nix-darwin takes "cpu" alone.

Platforms: NixOS and nix-darwin.

Type: one of “cuda”, “rocm”, “vulkan”, “cpu”

Default: "cuda" when othrys.hardware.nvidia is enabled, "vulkan" on any other host with hardware.graphics.enable, and "cpu" otherwise, which is every nix-darwin host

Declared by:

othrys.apps.ai.ollama.host

Address the server listens on. The default keeps it to this host. "0.0.0.0" or "::" serves every address, and Ollama asks for no credentials, so anything that reaches the port can run models. On NixOS the port stays closed while networking.firewall.enable is on, until the host opens it. On nix-darwin nothing closes the port, so an address other than loopback is reachable from the network at once.

Platforms: NixOS and nix-darwin.

Type: string

Default:

"127.0.0.1"

Example:

"0.0.0.0"

Declared by:

othrys.apps.ai.ollama.loadModels

Models to pull automatically on service start. NixOS only, since Home Manager’s ollama agent on nix-darwin pulls none.

Platforms: NixOS and nix-darwin.

Type: list of string

Default:

[ ]

Example:

[
  "llama3.1"
  "codellama"
]

Declared by:

othrys.apps.ai.ollama.port

Port the server listens on.

Platforms: NixOS and nix-darwin.

Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default:

11434

Declared by:

othrys.apps.ai.orca.enable

Whether to enable Orca, a desktop app for running coding agents side by side.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.ai.orca.package

The Orca package. The default repackages upstream’s own Linux build and comes from cache.numtide.com, which the host then trusts.

Platforms: NixOS only.

Type: package

Default: the orca package of the llm-agents flake this library locks

Declared by:

othrys.apps.ai.orca.disableTelemetry

Wrap the package so that Orca starts with ORCA_TELEMETRY_DISABLED set, which turns its usage telemetry off.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.apps.ai.orca.tailscale.enable

Whether to enable reaching Orca’s runtime port over the tailnet, for pairing another device. The port opens on Tailscale’s interface and on no other, and Orca’s network pairing must also be turned on in the app.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.ai.orca.tailscale.port

Orca’s runtime port, which is Orca’s own default.

Platforms: NixOS only.

Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default:

6768

Declared by:

othrys.apps.ai.paseo.enable

Whether to enable Paseo, a self-hosted daemon and CLI for orchestrating coding agents.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.ai.paseo.package

The Paseo package, which holds the paseo CLI, the paseo-server daemon and the web UI the daemon serves.

Platforms: NixOS and nix-darwin.

Type: package

Default:

pkgs.paseo

Declared by:

othrys.apps.ai.paseo.desktop.enable

Whether to enable the Paseo desktop app. Without service.enable the app starts a daemon of its own, which reads none of the options below.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.ai.paseo.desktop.package

The Paseo desktop package, which holds Paseo.app on darwin.

Platforms: NixOS and nix-darwin.

Type: package

Default:

pkgs.paseo.desktop

Declared by:

othrys.apps.ai.paseo.direnv.enable

The paseo-direnv plugin in the daemon othrys runs. It loads the direnv environment of each agent’s directory before the agent starts, and offers to allow a blocked .envrc in the app. A new git worktree inherits trust as othrys.apps.ai.projectEnvironment.trustWorktrees says, and the plugin’s own toggle shows that value disabled.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

othrys.apps.ai.paseo.service.enable && othrys.apps.ai.projectEnvironment.enable

Declared by:

othrys.apps.ai.paseo.direnv.package

The paseo-direnv plugin, a directory holding its manifest and its TypeScript source, which Paseo compiles when it loads it.

Platforms: NixOS and nix-darwin.

Type: package

Default: the default package of the paseo-direnv flake this library locks

Declared by:

othrys.apps.ai.paseo.hostnames

Hostnames the daemon accepts in the Host header besides its own addresses, such as the name a reverse proxy serves it under. The daemon refuses any other name, which guards against DNS rebinding. "tailscale" adds the host’s MagicDNS name on its own.

Platforms: NixOS and nix-darwin.

Type: list of string

Default:

[ ]

Example:

[
  "paseo.example.com"
]

Declared by:

othrys.apps.ai.paseo.listen

Where the daemon listens. "loopback" keeps it to this host. "lan" binds every address and on NixOS opens port in the firewall. "tailscale" binds the host’s tailnet address alone, admits the host’s MagicDNS name in the Host header and on NixOS opens port on Tailscale’s interface. Every peer that reaches the port can connect unless passwordFile is set.

Platforms: NixOS and nix-darwin.

Type: one of “loopback”, “lan”, “tailscale”

Default:

"loopback"

Declared by:

othrys.apps.ai.paseo.passwordFile

A file holding the daemon’s password, read when the daemon starts, so the password stays out of the store. It takes precedence over a hash that paseo daemon set-password wrote to ~/.paseo/config.json.

Platforms: NixOS and nix-darwin.

Type: null or string

Default:

null

Example:

"/run/secrets/paseo-password"

Declared by:

othrys.apps.ai.paseo.port

Port the daemon listens on, which is upstream’s own default.

Platforms: NixOS and nix-darwin.

Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default:

6767

Declared by:

othrys.apps.ai.paseo.relay.enable

Whether to enable the hosted relay at relay.paseo.sh, through which a client outside the network reaches the daemon. The daemon then keeps an outbound connection to that server, and the traffic over it is end-to-end encrypted.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.ai.paseo.service.enable

Whether to enable the Paseo daemon as a user service, a systemd unit on NixOS and a launchd agent on darwin. The desktop app attaches to this daemon instead of starting its own.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.ai.paseo.webUi.enable

Whether to enable the browser UI the daemon serves on its own port, beside its API and WebSocket. The page itself loads without the password, while the API behind it asks for one.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.ai.projectEnvironment.enable

Start claude and codex through direnv exec when the directory they start in has an allowed .envrc, so their hooks and commands see the project’s environment whichever program started them. A directory without an .envrc and an environment direnv already loaded leave the agent unchanged.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.apps.ai.projectEnvironment.trustWorktrees

When an agent starts in a git worktree, run direnv allow on its .envrc when it is identical to the allowed .envrc at the same place in the main checkout. The allow is written to the user’s direnv allow store, so it outlasts the agent and a shell in the worktree loads the file too. When false, a new worktree’s .envrc stays blocked until the user allows it. Has no effect while enable is off.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.apps.ai.skills

Skills handed to every enabled assistant, keyed by skill name. A value is the text of a SKILL.md, the path of one, or the path of a directory that holds one. The name is the directory the skill is written to, so it is lower-case letters, digits and single hyphens, at most 64 characters, and matches the name in the frontmatter.

A skill for one tool alone goes to that tool’s own option, such as othrys.apps.ai.claude-code.skills.

Platforms: NixOS and nix-darwin.

Type: attribute set of (string or absolute path)

Default:

{ }

Example:

{
  release-notes = ./skills/release-notes;
  commit = ''
    ---
    name: commit
    description: Write a commit message for the staged change.
    ---
    Read the staged diff and write the message.
  '';
}

Declared by:

othrys.apps.ai.t3code.enable

Whether to enable T3 Code, a control surface for coding agents.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.ai.t3code.package

The T3 Code package, whose out output holds the t3 server and whose desktop output holds the desktop app. The default comes from cache.numtide.com, which the host then trusts. Upstream’s own default puts five agents ahead of the user’s PATH, three of them unfree. A package set here is used as given.

Platforms: NixOS and nix-darwin.

Type: package

Default: the t3code package of the llm-agents flake this library locks, with the packages of othrys.apps.ai.codex and othrys.apps.ai.claude-code as its agents, each one while its module is on

Declared by:

othrys.apps.ai.t3code.disableTelemetry

Start t3 and the desktop app with T3CODE_TELEMETRY_ENABLED set to false, which turns off the product events T3 Code sends.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.apps.ai.t3code.listen

Where the headless server listens. "loopback" keeps it to this host. "lan" binds every address and drops any peer outside loopback, the private ranges and the tailnet, and on NixOS opens port in the firewall. "tailscale" binds the host’s tailnet address alone and on NixOS opens port on Tailscale’s interface. Every mode but loopback asks a new client to pair, with a link from t3 pair.

Platforms: NixOS and nix-darwin.

Type: one of “loopback”, “lan”, “tailscale”

Default:

"loopback"

Declared by:

othrys.apps.ai.t3code.mode

"headless" installs t3 and runs t3 serve as a user service, a systemd unit on NixOS and a launchd agent on darwin. "desktop" installs the desktop app, which starts its own server while a window is open, beside t3. The two cannot share one ~/.t3, since the second server finds the first one’s lock and exits, so a host picks one.

Platforms: NixOS and nix-darwin.

Type: null or one of “headless”, “desktop”

Default:

null

Declared by:

othrys.apps.ai.t3code.port

Port the headless server listens on, which is upstream’s own default.

Platforms: NixOS and nix-darwin.

Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default:

3773

Declared by:

othrys.apps.chromium.enable

Whether to enable Ungoogled Chromium browser.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.chromium.package

The ungoogled-chromium package to use. A replacement must support Home Manager’s Chromium wrapper and use Chromium’s profile directory layout.

Platforms: NixOS only.

Type: package

Default:

pkgs.ungoogled-chromium

Declared by:

othrys.apps.chromium.commandLineArgs

Launch arguments passed through Home Manager’s Chromium package wrapper. Empty leaves browser and GPU detection unchanged.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "--ozone-platform=wayland"
]

Declared by:

othrys.apps.chromium.extensions

Extensions installed from local signed CRX files, keyed by their 32-character IDs using the letters a through p. Each is fetched at build time from url and checked against hash, so the URL must keep serving that exact file. A release asset or a versioned path does, and a content delivery link that the publisher replaces on each upload does not.

Platforms: NixOS only.

Type: attribute set of (submodule)

Default:

{ }

Example:

{
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa = {
    url = "https://example.com/extensions/example-1.0.crx";
    hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
    version = "1.0";
  };
}

Declared by:

othrys.apps.chromium.extensions.<name>.hash

SHA-256 SRI hash of the CRX file at url.

Platforms: NixOS only.

Type: string matching the pattern sha256-[A-Za-z0-9+/]{43}=

Example:

"sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="

Declared by:

othrys.apps.chromium.extensions.<name>.url

Download URL of a signed CRX artifact at a fixed version.

Platforms: NixOS only.

Type: string matching the pattern https://.+

Example:

"https://example.com/extensions/example-1.0.crx"

Declared by:

othrys.apps.chromium.extensions.<name>.version

Version in the CRX manifest, with one to four components between 0 and 65535 and at least one nonzero component.

Platforms: NixOS only.

Type: string matching the pattern (0|[1-9][0-9]*)(\.(0|[1-9][0-9]*)){0,3}

Example:

"1.0"

Declared by:

othrys.apps.comma.enable

Whether to enable Comma and nix-index-database.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.development.enable

Whether to enable Development tools.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.discord.enable

Whether to enable Discord official client.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.floorp.enable

Whether to enable Floorp browser.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.floorp.builtinPasswordManager

Firefox’s own password manager. Off, since Bitwarden is in the default extension set and two managers prompt on every form.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.apps.floorp.extensions

Extensions force-installed from the Nix store, keyed by extension id. Each is fetched at build time by URL and hash, so the set a host runs is the set its configuration names. A definition replaces the default set, so a host that adds one extension merges it over options.othrys.apps.floorp.extensions.default, as the example does for Violentmonkey.

A userscript manager such as Violentmonkey is left to the host. Every script it installs runs with page access on the sites it matches, can make cross-origin requests and updates itself from its own URL, which is more code execution than the rest of the set together.

Platforms: NixOS only.

Type: attribute set of (submodule)

Default: Sidebery, Bitwarden and uBlock Origin at pinned versions

Example:

options.othrys.apps.floorp.extensions.default
// {
  "{aecec67f-0d10-4fa7-b7c7-609a2db280cf}" = {
    url = "https://addons.mozilla.org/firefox/downloads/file/5009389/violentmonkey-2.49.0.xpi";
    hash = "sha256-dh6moyzueMMmPRm72CHq/U6gci8Q/zWOy6JznFv/dvs=";
  };
}

Declared by:

othrys.apps.floorp.extensions.<name>.default_area

Where the extension’s button is placed, as the policy’s default_area.

Platforms: NixOS only.

Type: null or string

Default:

null

Example:

"navbar"

Declared by:

othrys.apps.floorp.extensions.<name>.hash

SRI hash of the file at url.

Platforms: NixOS only.

Type: string

Example:

"sha256-6KCktVarfdU2iXwYFq+dCRgDAiMGjqZoOgQ3YQOmyvI="

Declared by:

othrys.apps.floorp.extensions.<name>.url

Versioned download URL of the signed .xpi.

Platforms: NixOS only.

Type: string

Example:

"https://addons.mozilla.org/firefox/downloads/file/4903712/sidebery-5.6.1.xpi"

Declared by:

othrys.apps.floorp.extraExtensions

Raw extension policies merged over the set built from extensions, for an entry that needs a policy shape the typed option does not cover.

Platforms: NixOS only.

Type: attribute set of attribute set of anything

Default:

{ }

Example:

{
  "search@kagi.com" = {
    install_url = "https://addons.mozilla.org/firefox/downloads/latest/kagi-search-for-firefox/latest.xpi";
    installation_mode = "force_installed";
  };
}

Declared by:

othrys.apps.floorp.search.default

Default search engine (home-manager engine id or a key from extraEngines).

Platforms: NixOS only.

Type: string

Default:

"ddg"

Example:

"Kagi"

Declared by:

othrys.apps.floorp.search.extraEngines

Custom search engines merged over the curated Nix/NixOS set. Each engine is an attribute set of JSON values, in the shape of Home Manager’s programs.firefox.profiles.<name>.search.engines.

Platforms: NixOS only.

Type: attribute set of attribute set of (JSON value)

Default:

{ }

Example:

{
  "Kagi" = {
    urls = [{template = "https://kagi.com/search?q={searchTerms}";}];
    definedAliases = ["@k"];
  };
}

Declared by:

othrys.apps.floorp.trackingProtectionExemptions

Sites exempt from tracking protection and social-tracking blocking. Empty, so a host names its own exceptions.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "*.example.com"
]

Declared by:

othrys.apps.floorp.vaapiDriver

Value for LIBVA_DRIVER_NAME used for hardware video decode. Null (the default) leaves it unset so the system-wide VA-API default applies; set “nvidia” on NVIDIA hosts (which also enables the nvidia-vaapi direct backend).

Platforms: NixOS only.

Type: null or string

Default:

null

Example:

"nvidia"

Declared by:

othrys.apps.gaming.gamemode.enable

Whether to enable gamemode configuration for gaming optimization.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.gaming.gamemode.settings

Extra programs.gamemode.settings, merged over the curated defaults. Those are written at mkDefault, so overriding one leaf leaves its siblings in place and lib.mkForce replaces a leaf outright.

The shape is that of gamemode.ini, a section name over keys whose values are a string, a number, a boolean or a list of those.

One default deserves a decision. gpu.apply_gpu_optimisations = "accept-responsibility" lets gamemode change GPU power settings as root at every game start, for members of the gamemode group, which this module adds the primary user to. On an othrys.hardware.nvidia host it sets the PowerMizer mode to maximum performance on an X11 session, and on any other host the AMD power_dpm_force_performance_level to high. The NVIDIA step goes through nvidia-settings, which needs an X display and Coolbits, so it does nothing under a Wayland compositor. The value is spelled that way upstream because gamemode documents these GPU settings as able to damage hardware, and writing it accepts that. A host that does not want it sets gpu.apply_gpu_optimisations = 0, which leaves the GPU alone and keeps the CPU and scheduling changes.

Platforms: NixOS only.

Type: attribute set of section of an INI file (attrs of INI atom (null, bool, int, float or string) or a list of them for duplicate keys)

Default:

{ }

Example:

{
  general.renice = 10;
  gpu.amd_performance_level = "high";
}

Declared by:

othrys.apps.gaming.mangohud.enable

Whether to enable MangoHud performance overlay.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.gaming.mangohud.enableSessionWide

Enable MangoHud for all Vulkan applications via environment variable.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.apps.gaming.mangohud.settings

MangoHud settings merged over (and overriding) the curated defaults.

Platforms: NixOS only.

Type: attribute set of anything

Default:

{ }

Example:

{
  position = "top-left";
  fps_limit = 60;
  gpu_temp = false;
}

Declared by:

othrys.apps.gaming.osu.enable

Whether to enable osu!lazer with low-latency optimizations.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.gaming.osu.package

osu!lazer package to use (wrapped with latency optimizations).

Platforms: NixOS only.

Type: package

Default: pkgs.osu-lazer behind a wrapper that sets the PipeWire latency, and starts it through gamemoderun when othrys.apps.gaming.gamemode is enabled

Declared by:

othrys.apps.gaming.prismlauncher.enable

Whether to enable PrismLauncher Minecraft launcher.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.gaming.prismlauncher.package

PrismLauncher package to use.

Platforms: NixOS only.

Type: package

Default:

pkgs.prismlauncher

Declared by:

othrys.apps.gaming.r2modman.enable

Whether to enable r2modman Thunderstore mod manager.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.gaming.r2modman.package

r2modman package to use (wrapped for Wayland by default).

Platforms: NixOS only.

Type: package

Default: pkgs.r2modman with the Ozone Wayland flags added to its launcher

Declared by:

othrys.apps.gaming.steam.enable

Whether to enable Steam with gaming optimizations.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.gaming.steam.package

The Steam package as installed, after nixpkgs adds the graphics drivers, fonts, and compatibility tool paths to the FHS environment. Read this when wrapping Steam, since a package taken before that step starts without a working GPU driver.

Platforms: NixOS only.

Type: package (read only)

Default:

config.programs.steam.package

Declared by:

othrys.apps.gaming.steam.dedicatedServer.openFirewall

Open firewall ports for Source Dedicated Server, TCP and UDP 27015. Off by default, as the other two firewall options are.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.apps.gaming.steam.devConfig

Additional Steam console variables written to ~/.local/share/Steam/steam_dev.cfg, one name value per line. These are the variables accepted by the Steam console at steam://open/console, applied at every client start. The shaderPrecache options render into the same file and take precedence over a duplicate key here.

Platforms: NixOS only.

Type: attribute set of (signed integer or string or boolean)

Default:

{ }

Example:

{
  "@nClientDownloadEnableHTTP2PlatformLinux" = 0;
  "@fDownloadRateImprovementToAddAnotherConnection" = "1.0";
}

Declared by:

othrys.apps.gaming.steam.extraCompatPackages

Additional Proton compatibility packages to add to the defaults (proton-ge-bin).

Platforms: NixOS only.

Type: list of package

Default:

[ ]

Example:

with pkgs; [ ]

Declared by:

othrys.apps.gaming.steam.extraPkgs

Extra packages to include in Steam’s FHS runtime environment.

Platforms: NixOS only.

Type: function that evaluates to a(n) list of package

Default:

<function>

Declared by:

othrys.apps.gaming.steam.gamescopeSession.enable

Enable GameScope session for Steam Deck-like experience.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.apps.gaming.steam.localNetworkGameTransfers.openFirewall

Open the firewall for Steam Local Network Game Transfers, which copies an installed game from another Steam client on the network instead of downloading it. It opens TCP 27040 for the transfer and UDP 27036 for peer discovery on every interface. Off by default, so a host that shares its library turns it on.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.apps.gaming.steam.remotePlay.openFirewall

Open the firewall for Steam Remote Play, which streams a game from this host to another device. It opens TCP 27036 and 27037 and UDP 10400, 10401 and 27031 to 27036 on every interface. Off by default, so a host that streams turns it on.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.apps.gaming.steam.shaderPrecache.backgroundThreads

CPU threads given to Steam’s fossilize shader pre-caching while it runs in the background, written as unShaderBackgroundProcessingThreads in steam_dev.cfg. The pass only runs while “Allow background processing of Vulkan shaders” is enabled in Steam under Settings, Downloads. That toggle is off by default and lives in Steam’s own registry, which this module cannot declare. Null leaves Steam’s heuristic in place. The value is a host sizing decision, since a desktop can spare most of nproc while a laptop wants a fraction of it.

Platforms: NixOS only.

Type: null or (positive integer, meaning >0)

Default:

null

Example:

12

Declared by:

othrys.apps.gaming.steam.shaderPrecache.highPriorityThreads

CPU threads for the “Processing Vulkan shaders” pass that blocks a game launch, written as unShaderHighPriorityProcessingThreads in steam_dev.cfg. Steam deletes every compiled cache when the GPU driver version changes, so each game pays this pass once after a driver update. With the variable unset the pass was measured at about 16 pipelines per second on a 32-thread desktop, where the same replay reaches 223 per second at 28 threads. Valve documents neither variable. The background one is confirmed by wide use, while this one is known only from the client binary, where its name places it on the pre-launch pass. Null leaves Steam’s default.

Platforms: NixOS only.

Type: null or (positive integer, meaning >0)

Default:

null

Example:

24

Declared by:

othrys.apps.gh.enable

Whether to install and configure the GitHub CLI. The module does not log in. gh auth login runs GitHub’s OAuth device flow and stores the token in the Secret Service keyring when one is running, which othrys.desktop.keyring provides on a graphical host. Without a keyring it falls back to a plain file under ~/.config/gh, which is persisted at mode 0700 under impermanence. A host with no browser and no keyring sets tokenFile instead.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.gh.aliases

Short names for gh commands, written to aliases in config.yml. The value is the command line without the leading gh.

Platforms: NixOS and nix-darwin.

Type: attribute set of string

Default:

{ }

Example:

{
  co = "pr checkout";
  pv = "pr view";
}

Declared by:

othrys.apps.gh.claudeCode.allowReadOnly

Whether read-only gh commands are added to the Claude Code allow-list when othrys.apps.ai.claude-code.enable is on, so an agent reads issues, pull requests, workflow runs, repositories, releases and search results without a prompt. Commands that write to GitHub stay prompted, and so does gh api, since it sends any request.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Example:

false

Declared by:

othrys.apps.gh.codex.allowReadOnly

Whether read-only gh commands are allowed for Codex when othrys.apps.ai.codex.enable is on. An allowed command runs outside Codex’s sandbox, which has no network, so this is what lets Codex read issues, pull requests and workflow runs without asking.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Example:

false

Declared by:

othrys.apps.gh.credentialHelper.enable

Whether git asks gh for credentials on the hosts listed in credentialHelper.hosts, so that a clone, fetch or push over HTTPS uses the gh login and no second credential is stored. A remote reached over SSH is not affected.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Example:

false

Declared by:

othrys.apps.gh.credentialHelper.hosts

URLs git uses the gh credential helper for. Each becomes a credential.<url>.helper entry in the user’s git configuration.

Platforms: NixOS and nix-darwin.

Type: list of string

Default:

[
  "https://github.com"
  "https://gist.github.com"
]

Example:

[
  "https://github.com"
  "https://github.example.com"
]

Declared by:

othrys.apps.gh.editor

Editor gh opens for an issue or pull request body, written to editor. Null leaves the choice to gh, which then reads GIT_EDITOR, VISUAL and EDITOR from the environment.

Platforms: NixOS and nix-darwin.

Type: null or string

Default:

config.othrys.system.defaultEditor

Example:

"nvim"

Declared by:

othrys.apps.gh.extensions

gh extensions to install, each a package. They are linked under ~/.local/share/gh/extensions, where gh looks for them.

Platforms: NixOS and nix-darwin.

Type: list of package

Default:

[ ]

Example:

[ pkgs.gh-dash ]

Declared by:

othrys.apps.gh.gitProtocol

Protocol gh uses for the git operations it runs itself, such as gh repo clone and gh pr checkout. It is written to git_protocol.

Platforms: NixOS and nix-darwin.

Type: one of “ssh”, “https”

Default:

"ssh"

Example:

"https"

Declared by:

othrys.apps.gh.settings

Further config.yml keys, merged over the ones this module writes. A key set here replaces the module’s key of the same name whole, which includes aliases, editor, git_protocol and prompt.

Platforms: NixOS and nix-darwin.

Type: attribute set of (YAML 1.1 value)

Default:

{ }

Example:

{
  pager = "less -FRX";
  prompt = "disabled";
}

Declared by:

othrys.apps.gh.tokenFile

Runtime path to a file holding a GitHub token, for a host with no browser and no keyring. The file is written by a secrets provider and has to be readable by the primary user.

gh reads a token only from the GH_TOKEN environment variable, so when this is set the gh on the user’s PATH is a wrapper. It reads the file into GH_TOKEN in its own process and then becomes the real gh. The token is in the environment of that gh and of the programs it starts, and it is not in the Nix store, the environment of the shell or a process argument. A GH_TOKEN that is already set is kept. When the file is missing or unreadable the wrapper says so on stderr and runs gh without it.

Platforms: NixOS and nix-darwin.

Type: null or absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Default:

null

Example:

"/run/secrets/gh-token"

Declared by:

othrys.apps.ghostty.enable

Whether to enable Ghostty terminal emulator.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.ghostty.batSyntax

Whether to enable Ghostty config syntax highlighting for bat.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.ghostty.copyOnSelect

Whether to enable automatic copy to clipboard on text selection.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

Whether the cursor blinks.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Declared by:

othrys.apps.ghostty.cursor.style

Cursor shape style.

Platforms: NixOS and nix-darwin.

Type: one of “block”, “bar”, “underline”

Default:

"block"

Declared by:

othrys.apps.ghostty.extraSettings

Additional Ghostty settings merged into the configuration. A value is a string, a number, a boolean, or a list of those for a key that repeats.

Platforms: NixOS and nix-darwin.

Type: attribute set of (null or boolean or signed integer or floating point number or string or list of (null or boolean or signed integer or floating point number or string))

Default:

{ }

Example:

{
  bold-is-bright = false;
  confirm-close-surface = false;
}

Declared by:

othrys.apps.ghostty.keybindings.enable

Whether to enable custom Ghostty keybindings.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.ghostty.keybindings.clearDefaults

Whether to enable clearing all default keybindings.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.ghostty.keybindings.extra

Additional keybindings in Ghostty format (trigger=action).

Platforms: NixOS and nix-darwin.

Type: list of string

Default:

[ ]

Example:

[
  "ctrl+shift+f=toggle_fullscreen"
  "ctrl+shift+z=toggle_split_zoom"
]

Declared by:

othrys.apps.ghostty.mouseHideWhileTyping

Whether to enable hiding mouse cursor while typing.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.ghostty.scrollbackLimit

Scrollback each terminal surface retains, in bytes. A line of 80 plain characters takes roughly 80 bytes.

Platforms: NixOS and nix-darwin.

Type: unsigned integer, meaning >=0

Default:

10000000

Example:

50000000

Declared by:

othrys.apps.ghostty.shellIntegration.bash

Whether to enable Bash shell integration.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.ghostty.shellIntegration.zsh

Whether to enable Zsh shell integration.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.ghostty.vimSyntax

Whether to enable Ghostty config syntax highlighting for Vim.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.ghostty.window.decoration

Whether to show window decorations (CSD).

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Declared by:

othrys.apps.ghostty.window.gtkTitlebar

Whether to show the GTK titlebar.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Declared by:

othrys.apps.ghostty.window.padding.x

Horizontal window padding in pixels.

Platforms: NixOS and nix-darwin.

Type: signed integer

Default:

8

Declared by:

othrys.apps.ghostty.window.padding.y

Vertical window padding in pixels.

Platforms: NixOS and nix-darwin.

Type: signed integer

Default:

8

Declared by:

othrys.apps.idea.enable

Whether to enable IntelliJ IDEA.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.idea.package

IDEA distribution. JetBrains discontinued the Community edition in 2025 and folded Ultimate into a single unfree build that a licence unlocks at runtime, so pkgs.jetbrains.idea is the current release and pkgs.jetbrains.idea-community no longer exists. Set pkgs.jetbrains.idea-oss for the free source build, which lags the unified one by a release or two.

Platforms: NixOS and nix-darwin.

Type: package

Default:

pkgs.jetbrains.idea

Declared by:

othrys.apps.idea.extraPlugins

Plugins outside the curated catalogue, as derivations rather than names. nixpkgs removed resolution by plugin id and addPlugins throws on anything that is not a derivation, so each one is pinned by its marketplace URL and hash.

Anything used on more than one host belongs in the catalogue in idea.nix instead, so the pin lives in one place.

Platforms: NixOS and nix-darwin.

Type: list of package

Default:

[ ]

Example:

[
  (pkgs.fetchurl {
    executable = true; # a plugin shipping a bare JAR
    url = "https://plugins.jetbrains.com/files/7425/760442/WakaTime.jar";
    hash = "sha256-DobKZKokueqq0z75d2Fo3BD8mWX9+LpGdT9C7Eu2fHc=";
  })
]

Declared by:

othrys.apps.idea.plugins.develocity

Develocity 1.3.1. Gradle and Maven build scans from inside the IDE…

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Declared by:

othrys.apps.idea.plugins.ideavim

IdeaVim 2.46.2. Vim emulation…

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Declared by:

othrys.apps.idea.plugins.key-promoter-x

Key Promoter X 2026.1.2. Shows the keyboard shortcut for whatever was just clicked…

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Declared by:

othrys.apps.idea.plugins.nixidea

NixIDEA 0.4.0.22. Nix language support: highlighting, navigation, completion…

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Declared by:

othrys.apps.idea.plugins.spring-debugger

Spring Debugger 262.8665.176. Spring-aware debugging: beans, contexts, conditional config…

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Declared by:

othrys.apps.kitty.enable

Whether to enable Kitty terminal emulator.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.kitty.extraSettings

Additional kitty.conf settings, merged over the defaults this module writes, so a key set here wins.

Platforms: NixOS and nix-darwin.

Type: attribute set of anything

Default:

{ }

Example:

{
  scrollback_lines = "50000";
  tab_bar_style = "fade";
}

Declared by:

othrys.apps.languages.bash.enable

Whether to enable Bash language support (shared toolchain + editor wiring).

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.languages.bash.extraTools

Additional Bash tooling installed alongside the toolchain (linters, build tools, runtimes).

Platforms: NixOS and nix-darwin.

Type: list of package

Default:

[pkgs.shellcheck]

Declared by:

othrys.apps.languages.bash.formatter

Canonical Bash formatter, installed on the user’s PATH and named by store path in every editor. A replacement is run under the formatter definition that matches its executable name.

Platforms: NixOS and nix-darwin.

Type: package

Default:

pkgs.shfmt

Declared by:

othrys.apps.languages.bash.server

Canonical Bash language server, installed on the user’s PATH and named by store path in every editor that takes an external server. Null leaves the language without a standalone server, and an editor then configures none.

Platforms: NixOS and nix-darwin.

Type: null or package

Default:

pkgs.bash-language-server

Declared by:

othrys.apps.languages.go.enable

Whether to enable Go language support (shared toolchain + editor wiring).

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.languages.go.extraTools

Additional Go tooling installed alongside the toolchain (linters, build tools, runtimes).

Platforms: NixOS and nix-darwin.

Type: list of package

Default:

[]

Declared by:

othrys.apps.languages.go.formatter

Canonical Go formatter, installed on the user’s PATH and named by store path in every editor. A replacement is run under the formatter definition that matches its executable name.

Platforms: NixOS and nix-darwin.

Type: package

Default:

pkgs.go

Declared by:

othrys.apps.languages.go.server

Canonical Go language server, installed on the user’s PATH and named by store path in every editor that takes an external server. Null leaves the language without a standalone server, and an editor then configures none.

Platforms: NixOS and nix-darwin.

Type: null or package

Default:

pkgs.gopls

Declared by:

othrys.apps.languages.java.enable

Whether to enable Java language support (shared toolchain + editor wiring).

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.languages.java.extraTools

Additional Java tooling installed alongside the toolchain (linters, build tools, runtimes).

Platforms: NixOS and nix-darwin.

Type: list of package

Default:

[pkgs.jdk21 pkgs.maven pkgs.gradle]

Declared by:

othrys.apps.languages.java.formatter

Canonical Java formatter, installed on the user’s PATH and named by store path in every editor. A replacement is run under the formatter definition that matches its executable name.

Platforms: NixOS and nix-darwin.

Type: package

Default:

pkgs.google-java-format

Declared by:

othrys.apps.languages.java.server

Canonical Java language server, installed on the user’s PATH and named by store path in every editor that takes an external server. Null leaves the language without a standalone server, and an editor then configures none.

Platforms: NixOS and nix-darwin.

Type: null or package

Default:

null

Declared by:

othrys.apps.languages.json.enable

Whether to enable JSON language support (shared toolchain + editor wiring).

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.languages.json.extraTools

Additional JSON tooling installed alongside the toolchain (linters, build tools, runtimes).

Platforms: NixOS and nix-darwin.

Type: list of package

Default:

[]

Declared by:

othrys.apps.languages.json.formatter

Canonical JSON formatter, installed on the user’s PATH and named by store path in every editor. A replacement is run under the formatter definition that matches its executable name.

Platforms: NixOS and nix-darwin.

Type: package

Default:

pkgs.prettier

Declared by:

othrys.apps.languages.json.server

Canonical JSON language server, installed on the user’s PATH and named by store path in every editor that takes an external server. Null leaves the language without a standalone server, and an editor then configures none.

Platforms: NixOS and nix-darwin.

Type: null or package

Default:

pkgs.vscode-langservers-extracted

Declared by:

othrys.apps.languages.lua.enable

Whether to enable Lua language support (shared toolchain + editor wiring).

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.languages.lua.extraTools

Additional Lua tooling installed alongside the toolchain (linters, build tools, runtimes).

Platforms: NixOS and nix-darwin.

Type: list of package

Default:

[]

Declared by:

othrys.apps.languages.lua.formatter

Canonical Lua formatter, installed on the user’s PATH and named by store path in every editor. A replacement is run under the formatter definition that matches its executable name.

Platforms: NixOS and nix-darwin.

Type: package

Default:

pkgs.stylua

Declared by:

othrys.apps.languages.lua.server

Canonical Lua language server, installed on the user’s PATH and named by store path in every editor that takes an external server. Null leaves the language without a standalone server, and an editor then configures none.

Platforms: NixOS and nix-darwin.

Type: null or package

Default:

pkgs.lua-language-server

Declared by:

othrys.apps.languages.nix.enable

Whether to enable Nix language support (shared toolchain + editor wiring).

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.languages.nix.extraTools

Additional Nix tooling installed alongside the toolchain (linters, build tools, runtimes).

Platforms: NixOS and nix-darwin.

Type: list of package

Default:

[]

Declared by:

othrys.apps.languages.nix.formatter

Canonical Nix formatter, installed on the user’s PATH and named by store path in every editor. A replacement is run under the formatter definition that matches its executable name.

Platforms: NixOS and nix-darwin.

Type: package

Default:

pkgs.alejandra

Declared by:

othrys.apps.languages.nix.server

Canonical Nix language server, installed on the user’s PATH and named by store path in every editor that takes an external server. Null leaves the language without a standalone server, and an editor then configures none.

Platforms: NixOS and nix-darwin.

Type: null or package

Default:

pkgs.nil

Declared by:

othrys.apps.languages.python.enable

Whether to enable Python language support (shared toolchain + editor wiring).

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.languages.python.extraTools

Additional Python tooling installed alongside the toolchain (linters, build tools, runtimes).

Platforms: NixOS and nix-darwin.

Type: list of package

Default:

[]

Declared by:

othrys.apps.languages.python.formatter

Canonical Python formatter, installed on the user’s PATH and named by store path in every editor. A replacement is run under the formatter definition that matches its executable name.

Platforms: NixOS and nix-darwin.

Type: package

Default:

pkgs.ruff

Declared by:

othrys.apps.languages.python.server

Canonical Python language server, installed on the user’s PATH and named by store path in every editor that takes an external server. Null leaves the language without a standalone server, and an editor then configures none.

Platforms: NixOS and nix-darwin.

Type: null or package

Default:

pkgs.basedpyright

Declared by:

othrys.apps.languages.rust.enable

Whether to enable Rust language support (shared toolchain + editor wiring).

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.languages.rust.extraTools

Additional Rust tooling installed alongside the toolchain (linters, build tools, runtimes).

Platforms: NixOS and nix-darwin.

Type: list of package

Default:

[]

Declared by:

othrys.apps.languages.rust.formatter

Canonical Rust formatter, installed on the user’s PATH and named by store path in every editor. A replacement is run under the formatter definition that matches its executable name.

Platforms: NixOS and nix-darwin.

Type: package

Default:

pkgs.rustfmt

Declared by:

othrys.apps.languages.rust.server

Canonical Rust language server, installed on the user’s PATH and named by store path in every editor that takes an external server. Null leaves the language without a standalone server, and an editor then configures none.

Platforms: NixOS and nix-darwin.

Type: null or package

Default:

pkgs.rust-analyzer

Declared by:

othrys.apps.languages.typescript.enable

Whether to enable TypeScript language support (shared toolchain + editor wiring).

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.languages.typescript.extraTools

Additional TypeScript tooling installed alongside the toolchain (linters, build tools, runtimes).

Platforms: NixOS and nix-darwin.

Type: list of package

Default:

[pkgs.typescript]

Declared by:

othrys.apps.languages.typescript.formatter

Canonical TypeScript formatter, installed on the user’s PATH and named by store path in every editor. A replacement is run under the formatter definition that matches its executable name.

Platforms: NixOS and nix-darwin.

Type: package

Default:

pkgs.prettier

Declared by:

othrys.apps.languages.typescript.server

Canonical TypeScript language server, installed on the user’s PATH and named by store path in every editor that takes an external server. Null leaves the language without a standalone server, and an editor then configures none.

Platforms: NixOS and nix-darwin.

Type: null or package

Default:

pkgs.typescript-language-server

Declared by:

othrys.apps.languages.yaml.enable

Whether to enable YAML language support (shared toolchain + editor wiring).

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.languages.yaml.extraTools

Additional YAML tooling installed alongside the toolchain (linters, build tools, runtimes).

Platforms: NixOS and nix-darwin.

Type: list of package

Default:

[]

Declared by:

othrys.apps.languages.yaml.formatter

Canonical YAML formatter, installed on the user’s PATH and named by store path in every editor. A replacement is run under the formatter definition that matches its executable name.

Platforms: NixOS and nix-darwin.

Type: package

Default:

pkgs.prettier

Declared by:

othrys.apps.languages.yaml.server

Canonical YAML language server, installed on the user’s PATH and named by store path in every editor that takes an external server. Null leaves the language without a standalone server, and an editor then configures none.

Platforms: NixOS and nix-darwin.

Type: null or package

Default:

pkgs.yaml-language-server

Declared by:

othrys.apps.localsend.enable

Whether to enable LocalSend file sharing.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.localsend.openFirewall

Open TCP and UDP 53317, which LocalSend uses for peer discovery and transfers. Unlike most othrys firewall toggles this defaults to true, since a LocalSend host that other devices cannot reach does nothing at all. Set it to false on a host that only sends.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.apps.mpv.enable

Whether to enable mpv media player.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.nixvim.enable

Whether to enable NixVim editor.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.nixvim.dashboard.subHeader

Text lines shown under the start-screen logo (e.g. a personalized ASCII wordmark). Empty omits the block.

Platforms: NixOS and nix-darwin.

Type: list of string

Default:

[ ]

Declared by:

othrys.apps.nixvim.extraConfigLua

Additional Lua configuration appended after the curated config.

Platforms: NixOS and nix-darwin.

Type: strings concatenated with “\n”

Default:

""

Declared by:

othrys.apps.nixvim.extraPlugins

Additional vim plugins appended to the curated set.

Platforms: NixOS and nix-darwin.

Type: list of package

Default:

[ ]

Example:

[pkgs.vimPlugins.vim-sleuth]

Declared by:

othrys.apps.nixvim.presets.dashboard

Enable the snacks.dashboard start screen preset.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.apps.nixvim.presets.diagnostics

Enable the Trouble diagnostics UI + todo-comments (<leader>x*) preset.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.apps.nixvim.presets.fileTree

Enable the snacks.explorer file tree (<leader>e) preset.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.apps.nixvim.presets.git

Enable the gitsigns change indicators preset.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.apps.nixvim.presets.notifications

Enable the nvim-notify + dressing UI polish preset.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.apps.nixvim.presets.picker

Enable the snacks.picker fuzzy finding (<leader>f*) preset.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.apps.nixvim.presets.sessions

Enable the persistence.nvim session management (<leader>q*) preset.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.apps.nixvim.presets.statusline

Enable the lualine statusline preset.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.apps.obs.enable

Whether to enable OBS Studio with virtual camera.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.picard.enable

Whether to enable MusicBrainz Picard music tagger.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.plexamp.enable

Whether to enable Plexamp music player.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.remmina.enable

Whether to enable Remmina remote desktop client.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.rustdesk.enable

Whether to enable RustDesk remote desktop client.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.rustdesk.forceX11

Start the client from its desktop entry with GDK_BACKEND=x11, so it runs as an X11 client through XWayland in a Wayland session. For setups where the client behaves better that way than as a native Wayland window.

Only the launcher changes. The rustdesk binary on the PATH is left as it is, so a command such as rustdesk --get-id is unaffected. The session has to provide XWayland, which Hyprland starts itself and niri gets from xwayland-satellite.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.apps.rustdesk.openFirewall

Open TCP 21118, which the client listens on for direct IP access. Only needed when peers connect to this host by address instead of through a rendezvous server, so it stays off by default.

This module installs the client. A rendezvous and relay server is services.rustdesk-server, which othrys does not wrap, and its ports are not opened here.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.apps.senpai.enable

Whether to enable the senpai IRC client.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.senpai.address

Server senpai connects to, as host[:port] or an ircs://, irc:// or irc+insecure:// URL. A bare host uses TLS on port 6697. With othrys.services.soju on the same host, the default is soju’s plaintext listener on loopback.

Platforms: NixOS and nix-darwin.

Type: null or string

Default:

"irc+insecure://127.0.0.1:${port}" when othrys.services.soju.enable is on, null otherwise

Example:

"irc.example.com:6697"

Declared by:

othrys.apps.senpai.nickname

Nickname senpai registers with. senpai also uses it as the SASL user name unless settings.username is set, which is the soju account name when the server is a soju bouncer.

Platforms: NixOS and nix-darwin.

Type: null or string

Default:

null

Example:

"alice"

Declared by:

othrys.apps.senpai.passwordFile

Runtime path to a file holding the SASL password, readable by the primary user. senpai reads its first line through password-cmd each time it connects, so the password stays out of the Nix store and the configuration file.

Platforms: NixOS and nix-darwin.

Type: null or absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Default:

null

Example:

"/run/secrets/senpai-password"

Declared by:

othrys.apps.senpai.settings

Further senpai.scfg directives, merged over the ones this module writes. See senpai(5). password and password-cmd are refused here, since passwordFile covers both without writing the secret into the store.

Platforms: NixOS and nix-darwin.

Type: attribute set of anything

Default:

{ }

Example:

{
  channel = [
    "#nixos"
  ];
  highlight = [
    "alice"
  ];
  username = "alice";
}

Declared by:

othrys.apps.signal.enable

Whether to enable Signal Desktop messenger.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.tmux.enable

Whether to enable tmux terminal multiplexer.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.vesktop.enable

Whether to enable Vesktop Discord client.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.vesktop.settings

Extra Vesktop settings.json values, merged over the module defaults (override any default by re-declaring its key). Any JSON value is accepted.

Platforms: NixOS only.

Type: attribute set of (JSON value)

Default:

{ }

Example:

{ startMinimized = true; }

Declared by:

othrys.apps.vscode.enable

Whether to enable VSCodium editor.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.apps.vscode.extraExtensions

Additional extensions to install.

Platforms: NixOS and nix-darwin.

Type: list of package

Default:

[ ]

Declared by:

othrys.apps.vscode.mutableExtensionsDir

Whether ~/.vscode-oss/extensions is a directory the editor can write. With true, Home Manager’s own default, the extensions named here are linked into it and anything installed by hand from Open VSX sits beside them, persists with .vscode-oss and updates itself. With false the directory is a link into the Nix store, so the extension set is exactly what the configuration names and an install from the editor fails. A host switching to false removes the existing directory first, since Home Manager does not replace a directory it did not create.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Example:

false

Declared by:

othrys.apps.vscode.neovimIntegration.enable

Embed neovim as the editor core via vscode-neovim, using nixvim’s neovim package. Follows nixvim by default; disable for a standalone VSCodium (vscode no longer hard-requires nixvim).

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

config.othrys.apps.nixvim.enable

Declared by:

othrys.apps.vscode.userSettings

Additional user settings to merge.

Platforms: NixOS and nix-darwin.

Type: attribute set of anything

Default:

{ }

Declared by:

othrys.apps.yazi.enable

Whether to enable Yazi terminal file manager.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.desktop.ashell.enable

Whether to enable Ashell status bar.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.desktop.ashell.package

The ashell package the bar’s unit starts and the user’s profile installs.

Platforms: NixOS only.

Type: package

Default: the default package of the ashell flake this library locks

Example:

pkgs.ashell

Declared by:

othrys.desktop.ashell.airplaneButton

Show the airplane mode button in the settings menu.

Platforms: NixOS only.

Type: boolean

Default:

config.othrys.hardware.laptop.enable

Declared by:

othrys.desktop.ashell.animations

Animate the bar. ashell then slides menus and toasts in and out and resizes modules and workspace buttons gradually. Each animation lasts 100 ms and draws a frame per refresh of the output, so it shows stutter on a renderer that misses frames, as Vulkan does on NVIDIA (see renderer). The default is ashell’s own, which is off.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.desktop.ashell.bar.opacity

Opacity of the bar surface. Below 1.0 ashell also asks the compositor to blur what is behind the bar, since its blur setting defaults to auto. The request needs ext-background-effect-v1, and a compositor without it draws no blur.

Platforms: NixOS only.

Type: floating point number

Default:

1.0

Example:

0.92

Declared by:

othrys.desktop.ashell.bar.surface

Where ashell paints the bar background. transparent leaves the bar see-through and paints each module group instead, giving the “islands” look; solid paints the whole bar as one continuous surface. Defaults to ashell’s own default rather than a preference.

Platforms: NixOS only.

Type: one of “transparent”, “solid”

Default:

"transparent"

Example:

"solid"

Declared by:

othrys.desktop.ashell.clipboard.enable

Keep a clipboard history with cliphist, and show the bar button and bind the Mod+Shift+V chord that pick from it through othrys.desktop.dmenuCommand. The history is a plain file under ~/.cache/cliphist holding everything copied, apart from entries a password manager marks as sensitive. It is capped at maxItems, wiped each time the session locks through othrys.desktop.lockCommand and wiped again when the graphical session ends.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.desktop.ashell.clipboard.maxItems

Entries the clipboard history keeps before the oldest is dropped.

Platforms: NixOS only.

Type: positive integer, meaning >0

Default:

100

Declared by:

othrys.desktop.ashell.clockFormat

strftime format of the clock. A format with seconds makes the bar redraw once a second, which a laptop on battery pays for, so the default leaves them out there.

Platforms: NixOS only.

Type: string

Default:

"%a %b %d  %I:%M:%S %p", and without the seconds when
othrys.hardware.laptop.enable is set

Declared by:

othrys.desktop.ashell.indicators

The indicators in the settings group at the right of the bar, in the order given. The default follows the host. A desktop gets the idle inhibitor, audio, the microphone and peripheral batteries. A host with othrys.hardware.laptop.enable also gets its own battery, the screen brightness and the network, and Bluetooth and the power profile when it runs those services.

Battery reads UPower, which the laptop module enables. Network reads NetworkManager or iwd. PowerProfile reads power-profiles-daemon, so it is left out on a host that uses TLP.

Platforms: NixOS only.

Type: list of (one of “IdleInhibitor”, “PowerProfile”, “Audio”, “Microphone”, “Network”, “Vpn”, “Bluetooth”, “Battery”, “PeripheralBattery”, “Brightness”)

Default:

["IdleInhibitor" "PeripheralBattery" "Audio" "Microphone"], and with
othrys.hardware.laptop.enable also "Brightness", "Network" and
"Battery", plus "Bluetooth" and "PowerProfile" when the host runs
bluetooth and power-profiles-daemon

Example:

[
  "Audio"
  "Network"
  "Battery"
]

Declared by:

othrys.desktop.ashell.region

The locale ashell takes its unit system from, which decides the weather’s temperature and wind speed. en_US is imperial, so °F and mph, and nearly every other locale is metric. With null the key is left out and ashell follows LC_MEASUREMENT and then the login locale.

Platforms: NixOS only.

Type: null or string matching the pattern [a-z]{2,3}_[A-Z]{2}

Default:

"en_US"

Example:

"de_DE"

Declared by:

othrys.desktop.ashell.renderer

The graphics API ashell draws with, written to WGPU_BACKEND on the unit. Vulkan is ashell’s default. On the NVIDIA driver it presents frames late, and animations stutter while OpenGL draws them smoothly, so an NVIDIA host gets "gl".

Platforms: NixOS only.

Type: one of “vulkan”, “gl”

Default: "gl" when othrys.hardware.nvidia.enable is set, and "vulkan" otherwise

Declared by:

othrys.desktop.ashell.systemTemperatureUnit

The unit of the sensor temperature in the system information module, which is set apart from region. Hardware temperatures are quoted in °C, so that is the default while the weather follows the region. With null the reading follows the region as well.

Platforms: NixOS only.

Type: null or one of “Celsius”, “Fahrenheit”

Default:

"Celsius"

Declared by:

othrys.desktop.ashell.weatherLocation

Where the clock’s weather is for. A string is a city name, which ashell looks up, and an attribute set of latitude and longitude is a point. The module renders either as the weather_location value ashell reads. The bar fetches the forecast over the network. With null the key is left out, the bar shows no weather and makes no request. The location is identity-shaped, so the consuming host sets it.

Platforms: NixOS only.

Type: null or string matching the pattern [^{}=]+ or (submodule)

Default:

null

Example:

{
  latitude = 40.7128;
  longitude = -74.006;
}

Declared by:

othrys.desktop.compositors.hyprland.enable

Whether to enable Hyprland window manager.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.desktop.compositors.hyprland.package

The Hyprland package, used by the NixOS module and by the Home Manager module alike. The default is built by upstream against its own nixpkgs, which is what hyprland.cachix.org serves. Set portalPackage from the same source, since the portal is built against the compositor it ships with.

Platforms: NixOS only.

Type: package

Default: the hyprland package of the Hyprland flake this library locks

Example:

pkgs.hyprland

Declared by:

othrys.desktop.compositors.hyprland.binds.browser

Key chord for launch the browser; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"$mainMod + F"

Declared by:

othrys.desktop.compositors.hyprland.binds.exit

Key chord for exit Hyprland; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"$mainMod + SHIFT + E"

Declared by:

othrys.desktop.compositors.hyprland.binds.focusDown

Key chord for focus window down; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"$mainMod + J"

Declared by:

othrys.desktop.compositors.hyprland.binds.focusLeft

Key chord for focus window left; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"$mainMod + H"

Declared by:

othrys.desktop.compositors.hyprland.binds.focusRight

Key chord for focus window right; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"$mainMod + L"

Declared by:

othrys.desktop.compositors.hyprland.binds.focusUp

Key chord for focus window up; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"$mainMod + K"

Declared by:

othrys.desktop.compositors.hyprland.binds.fullscreen

Key chord for toggle fullscreen; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"$mainMod + M"

Declared by:

othrys.desktop.compositors.hyprland.binds.killActive

Key chord for close the active window; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"$mainMod + Q"

Declared by:

othrys.desktop.compositors.hyprland.binds.moveToSpecialWorkspace

Key chord for move window to the special workspace; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"$mainMod + SHIFT + S"

Declared by:

othrys.desktop.compositors.hyprland.binds.pin

Key chord for pin window; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"$mainMod + Y"

Declared by:

othrys.desktop.compositors.hyprland.binds.pseudo

Key chord for toggle pseudotiling; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"$mainMod + P"

Declared by:

othrys.desktop.compositors.hyprland.binds.screenshot

Key chord for screenshot the full screen; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"Print"

Declared by:

othrys.desktop.compositors.hyprland.binds.screenshotRegion

Key chord for screenshot a region; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"$mainMod + Print"

Declared by:

othrys.desktop.compositors.hyprland.binds.screenshotRegionToClipboard

Key chord for screenshot a region to the clipboard; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"$mainMod + SHIFT + Print"

Declared by:

othrys.desktop.compositors.hyprland.binds.specialWorkspace

Key chord for toggle the special workspace; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"$mainMod + S"

Declared by:

othrys.desktop.compositors.hyprland.binds.swapDown

Key chord for swap window down; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"$mainMod + SHIFT + J"

Declared by:

othrys.desktop.compositors.hyprland.binds.swapLeft

Key chord for swap window left; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"$mainMod + SHIFT + H"

Declared by:

othrys.desktop.compositors.hyprland.binds.swapRight

Key chord for swap window right; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"$mainMod + SHIFT + L"

Declared by:

othrys.desktop.compositors.hyprland.binds.swapUp

Key chord for swap window up; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"$mainMod + SHIFT + K"

Declared by:

othrys.desktop.compositors.hyprland.binds.terminal

Key chord for launch the terminal; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"$mainMod + Return"

Declared by:

othrys.desktop.compositors.hyprland.binds.toggleFloating

Key chord for toggle floating; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"$mainMod + V"

Declared by:

othrys.desktop.compositors.hyprland.binds.workspaceNext

Key chord for next workspace; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"$mainMod + CTRL + right"

Declared by:

othrys.desktop.compositors.hyprland.binds.workspacePrev

Key chord for previous workspace; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"$mainMod + CTRL + left"

Declared by:

othrys.desktop.compositors.hyprland.browser

Browser command bound to the browser Lua local. Defaults to the shared othrys.desktop.defaultBrowser. Set this for a Hyprland-specific override without changing Niri’s browser shortcut.

Platforms: NixOS only.

Type: string

Default:

config.othrys.desktop.defaultBrowser

Declared by:

othrys.desktop.compositors.hyprland.extraBinds

Extra keybindings (e.g., monitor focus for multi-monitor).

Platforms: NixOS only.

Type: list of (submodule)

Default:

[ ]

Declared by:

othrys.desktop.compositors.hyprland.extraBinds.*.dispatcher

Raw Lua dispatcher expression handed to hl.bind().

Platforms: NixOS only.

Type: string

Example:

"hl.dsp.focus({ monitor = \"DP-1\" })"

Declared by:

othrys.desktop.compositors.hyprland.extraBinds.*.key

Key chord; $mainMod expands to the mainMod option.

Platforms: NixOS only.

Type: string

Example:

"$mainMod + CTRL + 1"

Declared by:

othrys.desktop.compositors.hyprland.extraBinds.*.opts

hl.bind() option table (locked, repeating, mouse, description, …).

Platforms: NixOS only.

Type: attribute set of (Hyprland configuration value.)

Default:

{ }

Declared by:

othrys.desktop.compositors.hyprland.input.keyboardLayout

XKB keyboard layout.

Platforms: NixOS only.

Type: string

Default:

"us"

Declared by:

othrys.desktop.compositors.hyprland.mainMod

Modifier bound to the mainMod Lua local used by all default keybindings.

Platforms: NixOS only.

Type: string

Default:

"SUPER"

Declared by:

othrys.desktop.compositors.hyprland.monitors

hl.monitor() specs. Freeform keys (vrr, transform, mirror, disabled, …) pass through.

Platforms: NixOS only.

Type: list of (open submodule of attribute set of (Hyprland configuration value.))

Default:

[
  {
    output = "";
  }
]

Example:

[
  {
    mode = "1920x1080@360";
    output = "DP-1";
    position = "0x0";
    scale = "1";
  }
  {
    mode = "1920x1080@144";
    output = "HDMI-A-1";
    position = "-1920x0";
    scale = "1";
  }
]

Declared by:

othrys.desktop.compositors.hyprland.monitors.*.mode

Resolution and refresh rate.

Platforms: NixOS only.

Type: string

Default:

"preferred"

Example:

"1920x1080@360"

Declared by:

othrys.desktop.compositors.hyprland.monitors.*.output

Connector name, or “” for the catch-all rule covering every unnamed output.

Platforms: NixOS only.

Type: string

Example:

"DP-1"

Declared by:

othrys.desktop.compositors.hyprland.monitors.*.position

Position in the monitor layout.

Platforms: NixOS only.

Type: string

Default:

"auto"

Example:

"0x0"

Declared by:

othrys.desktop.compositors.hyprland.monitors.*.scale

Scale factor.

Platforms: NixOS only.

Type: string

Default:

"auto"

Example:

"1"

Declared by:

othrys.desktop.compositors.hyprland.numberedWorkspaceBinds

Generate $mainMod+1…0 workspace switch and $mainMod+SHIFT+1…0 move binds.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.desktop.compositors.hyprland.portalPackage

The desktop portal for Hyprland, passed to programs.hyprland.portalPackage.

Platforms: NixOS only.

Type: package

Default: the xdg-desktop-portal-hyprland package of the Hyprland flake this library locks

Example:

pkgs.xdg-desktop-portal-hyprland

Declared by:

othrys.desktop.compositors.hyprland.screenshots.directory

Directory the screenshot binds save into.

Platforms: NixOS only.

Type: string

Default:

"~/Pictures/Screenshots"

Declared by:

othrys.desktop.compositors.hyprland.terminal

Terminal emulator command bound to the terminal Lua local.

Platforms: NixOS only.

Type: string

Default:

"kitty"

Declared by:

othrys.desktop.compositors.hyprland.touchpad.enable

Whether to enable Touchpad support (for laptops).

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.desktop.compositors.hyprland.windowRules.extra

Additional hl.window_rule() specs appended after presets.

Platforms: NixOS only.

Type: list of attribute set of (Hyprland configuration value.)

Default:

[ ]

Declared by:

othrys.desktop.compositors.hyprland.windowRules.presets.floatCommonDialogs

Float utility dialogs (pavucontrol, nm-connection-editor, calculator).

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.desktop.compositors.hyprland.windowRules.presets.jetbrains

Focus/centering fixes for JetBrains IDE popup windows.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.desktop.compositors.hyprland.windowRules.presets.pictureInPicture

Float, pin, and corner-position Picture-in-Picture windows.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.desktop.compositors.hyprland.windowRules.presets.steam

Float Steam dialogs (Friends List, Settings, Steam Guard, …) and tile the main window.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.desktop.compositors.hyprland.windowRules.workspaceAssignments

hl.window_rule() specs pinning applications to workspaces, a per-fleet workflow choice, so no defaults.

Platforms: NixOS only.

Type: list of attribute set of (Hyprland configuration value.)

Default:

[ ]

Example:

[
  {
    match = {
      class = "^(code-url-handler)$";
    };
    workspace = "3 silent";
  }
  {
    match = {
      class = "^(discord)$";
    };
    workspace = "6 silent";
  }
]

Declared by:

othrys.desktop.compositors.hyprland.workspaces

hl.workspace_rule() specs (auto-generated from monitors if empty).

Platforms: NixOS only.

Type: list of (open submodule of attribute set of (Hyprland configuration value.))

Default:

[ ]

Example:

[
  {
    default = true;
    monitor = "DP-1";
    workspace = "1";
  }
]

Declared by:

othrys.desktop.compositors.hyprland.workspaces.*.workspace

Workspace the rule applies to; Hyprland requires a string selector.

Platforms: NixOS only.

Type: string

Example:

"1"

Declared by:

othrys.desktop.compositors.niri.enable

Whether to enable Niri scrollable-tiling Wayland compositor.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.desktop.compositors.niri.binds.browser

Key chord for launch the browser; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"Mod+F"

Declared by:

othrys.desktop.compositors.niri.binds.exit

Key chord for quit niri; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"Mod+Shift+E"

Declared by:

othrys.desktop.compositors.niri.binds.focusDown

Key chord for focus window down; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"Mod+J"

Declared by:

othrys.desktop.compositors.niri.binds.focusLeft

Key chord for focus column left; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"Mod+H"

Declared by:

othrys.desktop.compositors.niri.binds.focusRight

Key chord for focus column right; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"Mod+L"

Declared by:

othrys.desktop.compositors.niri.binds.focusUp

Key chord for focus window up; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"Mod+K"

Declared by:

othrys.desktop.compositors.niri.binds.fullscreen

Key chord for toggle fullscreen; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"Mod+M"

Declared by:

othrys.desktop.compositors.niri.binds.killActive

Key chord for close the active window; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"Mod+Q"

Declared by:

othrys.desktop.compositors.niri.binds.maximizeColumn

Key chord for maximize the column; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"Mod+P"

Declared by:

othrys.desktop.compositors.niri.binds.moveDown

Key chord for move window down; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"Mod+Shift+J"

Declared by:

othrys.desktop.compositors.niri.binds.moveLeft

Key chord for move column left; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"Mod+Shift+H"

Declared by:

othrys.desktop.compositors.niri.binds.moveRight

Key chord for move column right; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"Mod+Shift+L"

Declared by:

othrys.desktop.compositors.niri.binds.moveUp

Key chord for move window up; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"Mod+Shift+K"

Declared by:

othrys.desktop.compositors.niri.binds.overview

Key chord for toggle the overview; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"Mod+S"

Declared by:

othrys.desktop.compositors.niri.binds.screenshot

Key chord for open the interactive screenshot UI; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"Print"

Declared by:

othrys.desktop.compositors.niri.binds.screenshotScreen

Key chord for screenshot the full screen; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"Mod+Print"

Declared by:

othrys.desktop.compositors.niri.binds.screenshotWindow

Key chord for screenshot the focused window; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"Mod+Shift+Print"

Declared by:

othrys.desktop.compositors.niri.binds.terminal

Key chord for launch the terminal; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"Mod+Return"

Declared by:

othrys.desktop.compositors.niri.binds.toggleFloating

Key chord for toggle floating; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"Mod+V"

Declared by:

othrys.desktop.compositors.niri.binds.workspaceNext

Key chord for next workspace; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"Mod+Ctrl+Right"

Declared by:

othrys.desktop.compositors.niri.binds.workspacePrev

Key chord for previous workspace; null disables the bind.

Platforms: NixOS only.

Type: null or string

Default:

"Mod+Ctrl+Left"

Declared by:

othrys.desktop.compositors.niri.browser

Browser the browser bind spawns. Defaults to the shared othrys.desktop.defaultBrowser. Set this for a Niri-specific override without changing Hyprland’s browser shortcut.

Platforms: NixOS only.

Type: string

Default:

config.othrys.desktop.defaultBrowser

Declared by:

othrys.desktop.compositors.niri.extraBinds

Additional binds in programs.niri.settings.binds format, merged over the generated set.

Platforms: NixOS only.

Type: attribute set of attribute set of anything

Default:

{ }

Example:

{
  "Mod+T".action.spawn = "thunderbird";
}

Declared by:

othrys.desktop.compositors.niri.numberedWorkspaceBinds

Generate Mod+1…9 workspace focus and Mod+Shift+1…9 move binds.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.desktop.compositors.niri.outputs

Monitor configuration (programs.niri.settings.outputs). Empty lets niri auto-configure.

Platforms: NixOS only.

Type: attribute set of attribute set of (JSON value)

Default:

{ }

Example:

{
  "DP-1" = {
    mode = {
      width = 1920;
      height = 1080;
      refresh = 144.0;
    };
    position = {
      x = 0;
      y = 0;
    };
  };
}

Declared by:

othrys.desktop.compositors.niri.screenshots.directory

Directory niri’s built-in screenshot UI saves into.

Platforms: NixOS only.

Type: string

Default:

"~/Pictures/Screenshots"

Declared by:

othrys.desktop.compositors.niri.settings

Extra programs.niri.settings, merged over the generated config (use lib.mkForce to override an already-set leaf).

Platforms: NixOS only.

Type: attribute set of anything

Default:

{ }

Declared by:

othrys.desktop.compositors.niri.terminal

Terminal emulator the terminal bind spawns.

Platforms: NixOS only.

Type: string

Default:

"kitty"

Declared by:

othrys.desktop.compositors.niri.touchpad.enable

Whether to enable touchpad tuning (tap-to-click, natural scroll) for laptops.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.desktop.compositors.niri.xwayland.enable

Install xwayland-satellite so X11 applications run (niri detects and manages it automatically).

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.desktop.defaultBrowser

Browser command the browser shortcut of Hyprland and Niri runs, unless a compositor’s own browser option is set. The default follows the browser module that is enabled. firefox is installed by no othrys module, so a host with another browser names it here. This selects a command only and sets no default application for links.

Platforms: NixOS only.

Type: non-empty string

Default: "floorp" when othrys.apps.floorp is enabled, "chromium" when othrys.apps.chromium is, and "firefox" otherwise

Example:

"chromium"

Declared by:

othrys.desktop.dmenuCommand

A menu that reads choices on standard input and prints the chosen line. ashell’s clipboard button and its Mod+Shift+V chord pipe the cliphist history through it.

Platforms: NixOS only.

Type: non-empty (list of string)

Default: vicinae dmenu when othrys.desktop.vicinae is enabled, and ["wofi" "--dmenu"] otherwise

Example:

[
  "fuzzel"
  "--dmenu"
]

Declared by:

othrys.desktop.emojiCommand

The emoji picker as a program and its arguments, run by ashell’s Mod+E chord on Niri and Hyprland. With null the chord is not bound.

Platforms: NixOS only.

Type: null or (non-empty (list of string))

Default: Vicinae’s emoji search when othrys.desktop.vicinae is enabled, and rofimoji through wofi, typing with wtype, otherwise

Example:

[
  "rofimoji"
  "--action"
  "copy"
]

Declared by:

othrys.desktop.fileSearchCommand

A file search, bound by ashell to Mod+Shift+F. With null the chord is not bound.

Platforms: NixOS only.

Type: null or (non-empty (list of string))

Default: Vicinae’s file search when othrys.desktop.vicinae is enabled, and null otherwise

Declared by:

othrys.desktop.graphical

Whether this host runs a graphical session. Set automatically by othrys compositor modules (e.g. compositors.hyprland); set it manually when the host runs a desktop othrys doesn’t manage.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.desktop.idle.enable

Whether to enable staged idle management (dim, lock, screen off, suspend) via hypridle.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.desktop.idle.lockBeforeSleep

Lock the session before the host sleeps, so it does not resume into an open session. With enable set this is the idle daemon’s before-sleep command. Without it, a host that runs one of the othrys compositors still starts hypridle for this alone, with no idle stage, and gets the locker and its PAM service. Set it to false on a host that should resume unlocked, such as one with no keyboard.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.desktop.idle.lockCommand

Command the lock stage runs (and before-sleep lock).

Platforms: NixOS only.

Type: string

Default:

config.othrys.desktop.lockCommand

Declared by:

othrys.desktop.idle.timeouts.dim

Seconds of idle before dimming the backlight (brightnessctl); null disables the stage.

Platforms: NixOS only.

Type: null or (positive integer, meaning >0)

Default:

null

Example:

240

Declared by:

othrys.desktop.idle.timeouts.lock

Seconds of idle before locking; null disables the stage.

Platforms: NixOS only.

Type: null or (positive integer, meaning >0)

Default:

300

Declared by:

othrys.desktop.idle.timeouts.screenOff

Seconds of idle before turning displays off; null disables the stage.

Platforms: NixOS only.

Type: null or (positive integer, meaning >0)

Default:

330

Declared by:

othrys.desktop.idle.timeouts.suspend

Seconds of idle before suspending; null disables the stage (desktops usually want null, laptops a value).

Platforms: NixOS only.

Type: null or (positive integer, meaning >0)

Default:

null

Example:

1800

Declared by:

othrys.desktop.keyring.enable

Whether to run a Secret Service provider in the graphical session, which provider selects. Browsers, mail clients and tray applications store credentials in the Secret Service, and without a provider they fall back to a plain file or ask again on every start. It is on by default on a graphical host. A host that runs another provider, such as KeePassXC or KWallet, turns it off, since two providers compete for the same D-Bus name.

Platforms: NixOS only.

Type: boolean

Default:

config.othrys.desktop.graphical

Example:

false

Declared by:

othrys.desktop.keyring.allowUnencryptedDisk

Accept passwordless on a host that declares no LUKS device in boot.initrd.luks.devices. Every stored secret then sits on the disk in plain files, readable by whoever holds the disk.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.desktop.keyring.pass.directory

The password store, relative to the primary user’s home directory. pass and pass-secret-service are both pointed at it, and it is persisted at mode 0700 under impermanence.

Platforms: NixOS only.

Type: string matching the pattern [A-Za-z0-9.-]+(/[A-Za-z0-9.-]+)*

Default:

".local/share/password-store"

Example:

".password-store"

Declared by:

othrys.desktop.keyring.pass.gpgKey

Key id or fingerprint of the OpenPGP key the password store is encrypted to. Required with provider = "pass". A new store is initialised for it by writing its .gpg-id file, and a store that already has one is left alone. The public key has to be in the user’s GnuPG keyring and trusted, which the module does not arrange.

Platforms: NixOS only.

Type: null or string matching the pattern (0x)?[0-9A-Fa-f]{8,64}

Default:

null

Example:

"0123456789ABCDEF0123456789ABCDEF01234567"

Declared by:

othrys.desktop.keyring.passwordless

Whether to create the gnome-keyring store with no password, so that nothing ever asks to unlock it. It applies to the gnome-keyring provider only.

The store is then plain files under ~/.local/share/keyrings. File permissions protect it from other accounts, and disk encryption protects it from someone holding the powered-off machine. Nothing else does, so any program running as the user and anyone who can read the mounted disk reads every secret. The module refuses the option on a host with no encrypted disk unless allowUnencryptedDisk is set.

The keyring file is written when Home Manager activates and neither login.keyring nor Default_keyring.keyring exists. A keyring that already exists is never replaced, so a host that had a keyring with a password keeps it until its owner removes it.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.desktop.keyring.provider

Which program serves the Secret Service.

gnome-keyring encrypts its store with a password and unlocks it from the login password through PAM. It asks for that password the first time a secret is read unless the login passed one that matches, or passwordless created the store without one. A login with a hardware key alone passes no password, and a touch yields a signature and no secret, so nothing can unlock the store there.

pass runs pass-secret-service for the primary user over a pass password store, where each secret is a file encrypted to the OpenPGP key named in pass.gpgKey. With that key on a hardware token, reading a secret needs the token, its PIN once for each agent session, and a touch on each read when the token’s touch policy for decryption is set to always. gnome-keyring is turned off, since only one provider can own the D-Bus name. Home Manager has to manage the primary user, and the host needs a gpg-agent with a pinentry, which othrys.services.security.yubikey sets up.

Platforms: NixOS only.

Type: one of “gnome-keyring”, “pass”

Default:

"gnome-keyring"

Example:

"pass"

Declared by:

othrys.desktop.launcherCommand

The launcher as a program and its arguments. Niri spawns the list as it is, and Hyprland and the bar’s launcher button run it through the shell with each element quoted.

Platforms: NixOS only.

Type: non-empty (list of string)

Default: ["<vicinae>/bin/vicinae" "toggle"] when othrys.desktop.vicinae is enabled with launcher on, and ["wofi" "--show" "drun"] otherwise

Example:

[
  "fuzzel"
]

Declared by:

othrys.desktop.lockCommand

Command that locks the session; one authority for every lock consumer.

Platforms: NixOS only.

Type: string

Default:

"hyprlock" in a Hyprland session, "swaylock" otherwise

Declared by:

othrys.desktop.login.enable

Whether to enable graphical login manager (greetd).

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.desktop.login.autoLogin

Skip the greeter and start the session as the primary user (tuigreet only). Anyone at the console gets the session, so the host must lock it on idle and before sleep, which othrys.desktop.idle provides, and the module refuses the option without it.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.desktop.login.defaultDesktop

Wayland session the default sessionCommand launches via uwsm start (e.g. hyprland-uwsm.desktop). The hyprland module sets it. Unused when sessionCommand is set explicitly and ignored by cosmic-greeter, which lists the installed sessions instead.

Platforms: NixOS only.

Type: null or string

Default:

null

Declared by:

othrys.desktop.login.greeter

Greeter frontend. Both run on greetd.

Platforms: NixOS only.

Type: one of “tuigreet”, “cosmic-greeter”

Default:

"tuigreet"

Declared by:

othrys.desktop.login.sessionCommand

Command the greeter runs to start the session. The default launches defaultDesktop through uwsm when a compositor registered one, which hyprland does, and niri-session on a niri host. A host running a desktop othrys does not manage sets it directly.

Platforms: NixOS only.

Type: string

Default:

"uwsm start ${defaultDesktop}" when a compositor sets defaultDesktop, "niri-session" on a niri host, otherwise required

Declared by:

othrys.desktop.nightLight.enable

Whether to enable night light (color temperature shifting) via gammastep.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.desktop.nightLight.geoclue.enable

Resolve the location through geoclue when no coordinates are set. This enables services.geoclue2 for the whole host. With the nixpkgs defaults geoclue scans for nearby Wi-Fi networks, sends their hardware addresses to an online location service on every query, and answers any application that asks for the location. It is off by default for that reason, and a host with fixed coordinates does not need it.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.desktop.nightLight.latitude

Latitude for sunrise/sunset calculation. Identity-shaped, set from the consuming host together with longitude.

Platforms: NixOS only.

Type: null or floating point number

Default:

null

Example:

43.7

Declared by:

othrys.desktop.nightLight.longitude

Longitude for sunrise/sunset calculation, set together with latitude.

Platforms: NixOS only.

Type: null or floating point number

Default:

null

Example:

-79.4

Declared by:

othrys.desktop.nightLight.temperature.day

Daytime color temperature in Kelvin.

Platforms: NixOS only.

Type: positive integer, meaning >0

Default:

6500

Declared by:

othrys.desktop.nightLight.temperature.night

Nighttime color temperature in Kelvin.

Platforms: NixOS only.

Type: positive integer, meaning >0

Default:

4000

Declared by:

othrys.desktop.runCommand

A prompt that runs a command typed into it, bound by ashell to Mod+Shift+D. With null the chord is not bound.

Platforms: NixOS only.

Type: null or (non-empty (list of string))

Default: null when othrys.desktop.vicinae is enabled, and ["wofi" "--show" "run"] otherwise

Declared by:

othrys.desktop.uwsm.enable

Whether to enable UWSM Wayland session management.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.desktop.vicinae.enable

Whether to enable the Vicinae launcher.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.desktop.vicinae.package

The vicinae package to use.

Platforms: NixOS only.

Type: package

Default:

pkgs.vicinae

Declared by:

othrys.desktop.vicinae.exchangeRates.hourlyRefresh

Let the calculator fetch currency exchange rates from api.vicinae.com every hour. With false the server still fetches them once when it starts, which no setting of Vicinae prevents, and currency conversions use those rates for the rest of the session.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.desktop.vicinae.extensions

Extensions to install, passed to Home Manager’s programs.vicinae.extensions. Home Manager’s config.lib.vicinae builds them, and that attribute exists only inside the user’s Home Manager configuration.

Platforms: NixOS only.

Type: list of package

Default:

[ ]

Example:

[
  (config.lib.vicinae.mkRayCastExtension {
    name = "gif-search";
    rev = "4d417c2dfd86a5b2bea202d4a7b48d8eb3dbaeb1";
    sha256 = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
  })
]

Declared by:

othrys.desktop.vicinae.inputServer.enable

Run Vicinae’s input helper, which pastes into the focused window and expands snippets. The helper reads every keyboard of the host and injects keys through uinput, so it is installed as a security wrapper with cap_dac_override, which any local account can run, and the uinput kernel module is loaded. With false Vicinae copies to the clipboard where it would paste, and snippets do not expand.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.desktop.vicinae.keybinding

The keybinding preset Vicinae navigates with, one of the three it ships. It is written to the keybinding setting at mkDefault, so settings.keybinding still wins.

Platforms: NixOS only.

Type: one of “default”, “vim”, “emacs”

Default:

"default"

Example:

"vim"

Declared by:

othrys.desktop.vicinae.launcher

Make vicinae toggle the desktop launcher by setting othrys.desktop.launcherCommand. The chord that runs it, Mod+D on Niri and $mainMod + D on Hyprland, and the launcher button of the bar both belong to othrys.desktop.ashell, so a host without the bar binds the command itself. With false the launcher stays wofi. The emoji, clipboard menu, file search and run signals beside it follow Vicinae either way, and a host sets any of them to keep its own.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.desktop.vicinae.settings

Vicinae settings, merged over the curated defaults. Those are written at mkDefault, so a key set here replaces that key alone and its siblings stay. The shape is that of ~/.config/vicinae/settings.json, and vicinae config default prints every key with its upstream value.

The curated defaults turn telemetry off, set favicon_service to "none", set pop_to_root_on_close to true and set input_server.enabled from inputServer.enable. With a palette in othrys.theme both theme names are "othrys", and with othrys.theme.fonts.sansSerif set the interface font is that font. With othrys.theme.opacity set, the launcher window takes the opacity of popups. On a host with Hyprland the layer-shell keyboard mode is "on_demand", since the exclusive default leaves popups inside the window without mouse input there. While ashell keeps its cliphist history, providers.clipboard.preferences.monitoring is false, so Vicinae records no second history that the wipe at lock would miss. On a host without that history Vicinae records the clipboard itself.

The declared settings are merged over the file Vicinae writes from its settings window, key by key, each time the server loads them. A change made in the window to a key declared here has no effect.

Platforms: NixOS only.

Type: JSON value

Default:

{ }

Example:

{
  favicon_service = "twenty";
  search_files_in_root = true;
  launcher_window.layer_shell.keyboard_interactivity = "on_demand";
}

Declared by:

othrys.desktop.wallpaper.enable

Whether to draw othrys.theme.wallpaper with wpaperd, as a user service of the graphical session. It is on by default wherever an othrys compositor runs and a wallpaper is declared. A host that draws its wallpaper with another program turns it off, since two programs would draw over each other.

Platforms: NixOS only.

Type: boolean

Default: true on a graphical host with an othrys compositor module enabled and a wallpaper declared, in othrys.theme.wallpaper.source or for a monitor in othrys.theme.wallpaper.outputs

Example:

false

Declared by:

othrys.hardware.audio.enable

Whether to enable PipeWire audio stack.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.hardware.audio.lowLatency

Halve the PipeWire graph quantum, from the stock 1024 frames to 512. At 48 kHz that is 10.7 ms of buffering per cycle in place of 21.3 ms. A client can still ask for less, down to the PipeWire minimum.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.hardware.audio.usbDuplexProfile

Pin every USB audio device to the output:analog-stereo+input:mono-fallback profile, which suits a headset that WirePlumber otherwise brings up output-only. A device without that profile, such as a multichannel interface, is left with no profile and stays silent, so this is off unless a host asks for it.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.hardware.cpu.vendor

The processor’s vendor, on a host that runs on its own hardware. It turns on microcode updates for that vendor, the redistributable firmware the microcode and most devices load, and the vendor’s KVM module. null writes nothing, which suits a virtual machine, where the hypervisor owns the microcode.

Platforms: NixOS only.

Type: null or one of “intel”, “amd”

Default:

null

Example:

"intel"

Declared by:

othrys.hardware.graphics.shaderCache.enable

Whether to enable persistent, size-tuned GPU shader disk caches.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.hardware.graphics.shaderCache.nvidiaSizeGiB

NVIDIA shader disk cache cap (__GL_SHADER_DISK_CACHE_SIZE). The driver default is 1 GiB, under which it evicts previously compiled shaders, undoing Steam’s shader pre-caching and forcing per-launch recompiles in large Vulkan titles. Size for the shader footprint of the games actually played; eviction is also disabled outright via __GL_SHADER_DISK_CACHE_SKIP_CLEANUP, so a host that stops playing a title reclaims its space by deleting ~/.cache/nvidia.

Platforms: NixOS only.

Type: positive integer, meaning >0

Default:

12

Declared by:

othrys.hardware.laptop.enable

Whether to enable Laptop-specific features.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.hardware.laptop.powerspec-1710.enable

Whether to enable PowerSpec 1710 hardware optimizations.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.hardware.laptop.tlp.enable

Enable TLP power management.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.hardware.laptop.touchpad.enable

Enable touchpad support.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.hardware.ntsync.enable

Load the ntsync driver and give the active session’s user access to /dev/ntsync. Proton 10 and later use it for Windows synchronization primitives when the device is present and writable, which lowers the CPU cost of games that wait on many objects. Any Wine build with ntsync support uses it the same way, so it serves Lutris, Heroic or Bottles as well as Steam. The kernel ships the driver from 6.14 as a module that nothing loads, and no udev rule grants access to it. othrys.apps.gaming.steam turns it on by default on such a kernel.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.hardware.nvidia.enable

Whether to enable NVIDIA GPU.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.hardware.nvidia.package

The driver to install, taken from the host’s kernel packages so its kernel modules match the running kernel.

The stable driver no longer drives every card. The 580 branch is the last that supports Maxwell, Pascal and Volta, and nixpkgs ships it as nvidiaPackages.legacy_580. Older cards have legacy_470 and legacy_390. A driver that does not support the card fails the same way the wrong openModules does, with nvidia-smi unable to communicate with the driver and NVRM lines in dmesg naming the branch the card needs.

Platforms: NixOS only.

Type: package

Default:

config.boot.kernelPackages.nvidiaPackages.stable

Example:

config.boot.kernelPackages.nvidiaPackages.legacy_580

Declared by:

othrys.hardware.nvidia.blacklistIntel

Blacklist the i915 kernel module, so the Intel iGPU never binds and the NVIDIA card is the only display device. Leave it off on a host whose monitors are wired to the motherboard outputs, or that uses the iGPU for Quick Sync or as a second display adapter. PRIME needs the iGPU, so the two together are refused.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.hardware.nvidia.containerToolkit.enable

Run the NVIDIA container toolkit, which writes a CDI specification for the card at boot. Podman reads it with --device nvidia.com/gpu=all, and Docker, rootful or rootless, with --gpus all or the same --device flag. The option was othrys.services.containerization.docker.nvidia.enable before.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.hardware.nvidia.earlyLoad

Put the NVIDIA kernel modules in the initrd, so the NVIDIA card can draw the disk-unlock prompt and the boot splash. With this off the modules are loaded from the root filesystem once it is mounted.

Early loading puts the driver and its firmware in every initrd, and the initrd size decides how many generations a boot partition holds.

A PRIME host defaults to off, since its Intel GPU drives the panel during boot and i915 stays in the initrd for that.

Platforms: NixOS only.

Type: boolean

Default:

!config.othrys.hardware.nvidia.prime.enable

Declared by:

othrys.hardware.nvidia.openModules

Use NVIDIA’s open kernel modules. They support Turing and newer, which is GTX 16 and RTX 20 onward, and NVIDIA recommends them there.

A Maxwell, Pascal or Volta card, which is GTX 900, GTX 10 and Titan V, needs false here together with a package from the 580 branch. With the open modules the kernel module never binds to such a card, and nvidia-smi reports that it cannot communicate with the driver.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.hardware.nvidia.prime.enable

Whether to enable PRIME offload (hybrid GPU).

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.hardware.nvidia.prime.finegrainedPowerManagement

Enable fine-grained power management (experimental).

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.hardware.nvidia.prime.intelBusId

PCI bus ID of the Intel iGPU. lspci | grep VGA prints the address in hexadecimal as 00:02.0, and the option takes it in decimal as PCI:0:2:0. The address differs between boards, and a wrong one boots to a black screen, which is why there is no default.

Platforms: NixOS only.

Type: null or string

Default: none, and PRIME refuses to evaluate until it is set

Example:

"PCI:0:2:0"

Declared by:

othrys.hardware.nvidia.prime.nvidiaBusId

PCI bus ID of the NVIDIA GPU, read from lspci | grep NVIDIA and written the same way as intelBusId.

Platforms: NixOS only.

Type: null or string

Default: none, and PRIME refuses to evaluate until it is set

Example:

"PCI:1:0:0"

Declared by:

othrys.hardware.scanner.enable

Whether to enable scanner support (SANE + network scanner discovery).

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.hardware.scanner.extraBackends

Additional SANE backends (vendor drivers) beyond the airscan default.

Platforms: NixOS only.

Type: list of package

Default:

[ ]

Example:

[pkgs.hplipWithPlugin]

Declared by:

othrys.hardware.smart.enable

Whether to enable disk health monitoring (smartd, auto-detected devices).

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.hardware.smart.extraOptions

Extra options passed to smartd.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Declared by:

othrys.hardware.tablet.enable

Whether to enable pen tablet support through OpenTabletDriver.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.hardware.ups.enable

Whether to enable UPS monitoring and clean shutdown (NUT, standalone).

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.hardware.ups.driver

NUT driver for the attached UPS (usbhid-ups covers most USB models).

Platforms: NixOS only.

Type: string

Default:

"usbhid-ups"

Declared by:

othrys.hardware.ups.passwordFile

Path to a runtime file holding the NUT monitor password (a secrets-provider path). Mandatory, with no default.

Platforms: NixOS only.

Type: absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Example:

config.sops.secrets."ups/password".path

Declared by:

othrys.hardware.ups.port

Driver port (‘auto’ scans USB).

Platforms: NixOS only.

Type: string

Default:

"auto"

Declared by:

othrys.hardware.usb.enable

Whether to enable USB hardware support and utilities.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.hardware.webcam.enable

Whether to enable Webcam support.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.hardware.wireless.bluetooth.enable

Whether to enable Bluetooth support.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.hardware.wireless.bluetooth.experimental

Whether to enable BlueZ experimental features (e.g. device battery reporting); exposes experimental D-Bus interfaces.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.hardware.wireless.bluetooth.powerOnBoot

Power on Bluetooth adapter at boot.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.hardware.wireless.wifi.enable

Whether to enable NetworkManager WiFi networking.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.hardware.wireless.wifi.environmentFile

Path to environment file containing WiFi passwords. Format: WIFI_PSK_<NETWORK_NAME>=password Example: WIFI_PSK_HOME=mysecretpassword

The name is the key under networks in upper case, with every character other than a letter, a digit or an underscore replaced by an underscore, so guest-5g.lan reads WIFI_PSK_GUEST_5G_LAN.

Platforms: NixOS only.

Type: null or absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Default:

null

Example:

config.sops.secrets."networking/wifi/env".path

Declared by:

othrys.hardware.wireless.wifi.networks

Declarative WiFi networks (passwords via environmentFile).

Platforms: NixOS only.

Type: attribute set of (submodule)

Default:

{ }

Example:

{
  home = { ssid = "MyHomeNetwork"; };
  work = { ssid = "WorkNetwork"; autoconnect = false; };
}

Declared by:

othrys.hardware.wireless.wifi.networks.<name>.autoconnect

Automatically connect to this network.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.hardware.wireless.wifi.networks.<name>.ssid

WiFi network SSID.

Platforms: NixOS only.

Type: string

Declared by:

othrys.services.alerting.enable

Whether to enable alert rule evaluation (vmalert) with ntfy delivery.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.alerting.checkRules

Parse the rendered rule file with vmalert -dryRun at build time, so a rule that does not parse fails the build instead of the service. Set to false where vmalert cannot run on the build host.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.alerting.datasourceUrl

Prometheus-compatible datasource rules are evaluated against. Auto-discovered from the enabled othrys metrics store.

Platforms: NixOS only.

Type: null or string

Default:

the local VictoriaMetrics instance when enabled, else the local Prometheus, else null

Declared by:

othrys.services.alerting.listenAddress

Address vmalert’s HTTP interface listens on.

Platforms: NixOS only.

Type: string

Default:

"127.0.0.1"

Declared by:

othrys.services.alerting.notifierUrls

Alertmanager endpoints alerts are sent to. Empty with othrys.services.notify enabled runs the internal alertmanager -> ntfy delivery chain.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "http://127.0.0.1:9093"
]

Declared by:

othrys.services.alerting.port

Port vmalert’s HTTP interface listens on.

Platforms: NixOS only.

Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default:

8880

Declared by:

othrys.services.alerting.ruleGroups

Additional Prometheus-style rule groups appended to the starter set.

Platforms: NixOS only.

Type: list of attribute set of anything

Default:

[ ]

Declared by:

othrys.services.alerting.starterRules

Include the curated starter rules (instance down, disk space, memory pressure).

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.automount.enable

Whether to enable USB automounting via udiskie.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.automount.notify

Show mount/unmount notifications (needs a notification daemon; off on headless hosts).

Platforms: NixOS only.

Type: boolean

Default:

config.othrys.desktop.graphical

Declared by:

othrys.services.automount.tray

udiskie tray icon mode (needs a StatusNotifier host; off on headless hosts).

Platforms: NixOS only.

Type: one of “auto”, “always”, “never”

Default:

"auto" on graphical hosts (othrys.desktop.graphical), "never" otherwise

Declared by:

othrys.services.containerization.docker.enable

Whether to enable Docker container runtime.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.containerization.docker.autoPrune.enable

Periodically prune unused Docker resources.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.containerization.docker.autoPrune.dates

systemd calendar expression for the prune timer.

Platforms: NixOS only.

Type: string

Default:

"weekly"

Declared by:

othrys.services.containerization.docker.autoPrune.flags

Flags passed to docker system prune. The default deliberately omits --volumes: it deletes anonymous volumes of every container not currently running, which silently destroys data belonging to stopped or on-demand containers. Opt in explicitly if you want it.

Platforms: NixOS only.

Type: list of string

Default:

[
  "--all"
]

Example:

[
  "--all"
  "--volumes"
]

Declared by:

othrys.services.containerization.docker.compose.enable

Install docker-compose.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.containerization.docker.daemon.settings

Additional Docker daemon settings (merged with defaults).

Platforms: NixOS only.

Type: attribute set of anything

Default:

{ }

Example:

{
  dns = [ "1.1.1.1" "8.8.8.8" ];
  registry-mirrors = [ "https://mirror.gcr.io" ];
}

Declared by:

othrys.services.containerization.docker.extraPackages

Additional packages to install alongside Docker.

Platforms: NixOS only.

Type: list of package

Default:

[ ]

Example:

with pkgs; [ dive ]

Declared by:

othrys.services.containerization.docker.rootless.enable

Run Docker in rootless mode for improved security.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.containerization.docker.rootless.setSocketVariable

Set DOCKER_HOST environment variable for rootless mode.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.containerization.k3s.enable

Whether to enable k3s lightweight Kubernetes.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.containerization.k3s.package

Override the k3s package (e.g. to pin a Kubernetes version).

Platforms: NixOS only.

Type: null or package

Default:

pkgs.k3s

Declared by:

othrys.services.containerization.k3s.clusterInit

Initialize a highly-available cluster with an embedded etcd datastore. Set on the first server only; further servers join it via serverAddr.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.services.containerization.k3s.disable

Bundled components to disable (e.g. to bring your own ingress/LB).

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "traefik"
  "servicelb"
]

Declared by:

othrys.services.containerization.k3s.disableAgent

Server only: run the control plane without scheduling workloads on this node.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.services.containerization.k3s.extraFlags

Extra flags appended to the k3s command, after the ones hardenedFlags contributes.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "--flannel-backend=wireguard-native"
]

Declared by:

othrys.services.containerization.k3s.extraKubeletConfig

Extra kubelet configuration (forwarded to services.k3s.extraKubeletConfig).

Platforms: NixOS only.

Type: attribute set of anything

Default:

{ }

Declared by:

othrys.services.containerization.k3s.gracefulShutdown

Drain pods gracefully when the node shuts down.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.containerization.k3s.hardenedFlags

Server only. Start k3s with --write-kubeconfig-mode=0600 and --secrets-encryption, ahead of extraFlags. The first keeps the admin kubeconfig readable by root alone, and the second encrypts Secrets at rest in the datastore.

k3s requires every server of a cluster to agree on secrets encryption, so the servers of one cluster take the same value here. A cluster created without encryption sets this to false and turns encryption on with k3s secrets-encrypt, as the k3s documentation describes. An agent takes neither flag.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.containerization.k3s.installTools

Install cluster tooling (kubectl, helm, k9s) system-wide.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.containerization.k3s.manifests

Auto-deploying manifests (forwarded to services.k3s.manifests). Server only.

Platforms: NixOS only.

Type: attribute set of anything

Default:

{ }

Declared by:

othrys.services.containerization.k3s.nodeLabels

Labels to register the kubelet with.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "node-role=worker"
]

Declared by:

othrys.services.containerization.k3s.nodeName

Override the node name (defaults to the hostname).

Platforms: NixOS only.

Type: null or string

Default:

null

Declared by:

othrys.services.containerization.k3s.nodeTaints

Taints to register the kubelet with.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "CriticalAddonsOnly=true:NoExecute"
]

Declared by:

othrys.services.containerization.k3s.openFirewall

Open the k3s ports in the firewall on every interface: the kubelet (10250) and the flannel tunnel (UDP 8472) on every node, the API (6443) on a server, and embedded etcd (2379, 2380) on a server that initialises or joins a cluster. Off by default like every other network module; a single node reached over loopback or a private network needs none of them open.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.services.containerization.k3s.role

Whether this node runs the control plane (server) or joins as a worker (agent).

Platforms: NixOS only.

Type: one of “server”, “agent”

Default:

"server"

Declared by:

othrys.services.containerization.k3s.serverAddr

URL of the server to join. Required for agents and for additional HA servers.

Platforms: NixOS only.

Type: string

Default:

""

Example:

"https://10.0.0.1:6443"

Declared by:

othrys.services.containerization.k3s.tokenFile

Path to the cluster join token, a secrets-provider path. Required on an agent and on a server that joins another, since both authenticate to the cluster with it. A single server that initialises its own cluster needs none.

Platforms: NixOS only.

Type: null or absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Default:

null

Example:

config.sops.secrets."k3s/token".path

Declared by:

othrys.services.containerization.podman.enable

Whether to enable Podman container runtime.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.containerization.podman.enableDns

Enable DNS for default network (required for podman-compose).

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.containerization.podman.autoPrune.enable

Periodically prune unused Podman resources.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.containerization.podman.autoPrune.dates

systemd calendar expression for the prune timer.

Platforms: NixOS only.

Type: string

Default:

"weekly"

Declared by:

othrys.services.containerization.podman.autoPrune.flags

Flags passed to podman system prune. --all removes every image without a running container; hosts that pre-pull pinned images should override this.

Platforms: NixOS only.

Type: list of string

Default:

[
  "--all"
]

Declared by:

othrys.services.containerization.podman.compose.enable

Install podman-compose for docker-compose compatibility.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.containerization.podman.distrobox.enable

Enable Distrobox for running containers as if they were native apps.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.services.containerization.podman.dockerCompat

Create docker alias pointing to podman for drop-in replacement.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.containerization.podman.extraPackages

Additional packages to install alongside Podman.

Platforms: NixOS only.

Type: list of package

Default:

[ ]

Example:

with pkgs; [ skopeo buildah ]

Declared by:

othrys.services.ddns.enable

Whether to enable dynamic DNS updates (inadyn).

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.ddns.credentialsFile

Path to a runtime file included into the provider block, since inadyn.conf syntax, typically a single password = <token> line. A secrets-provider path; never inline the token. Must be set when this module is enabled.

inadyn opens the file at run time as its own user inside a private user namespace, so a file that is root-owned and mode 0400 is unreadable and the service fails at its first update. With sops-nix set owner = "inadyn" on the secret.

Platforms: NixOS only.

Type: null or absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Default: none, and an assertion rejects an unset value once the module is enabled

Example:

config.sops.secrets."ddns/credentials".path

Declared by:

othrys.services.ddns.extraSettings

Extra per-provider inadyn settings merged into the provider block.

Platforms: NixOS only.

Type: attribute set of anything

Default:

{ }

Declared by:

othrys.services.ddns.hostnames

Hostnames to keep updated. Identity-shaped, set from the consuming host. Must be non-empty when this module is enabled.

Platforms: NixOS only.

Type: list of string

Default: none, and an assertion rejects an empty list once the module is enabled

Example:

[
  "home.example.com"
]

Declared by:

othrys.services.ddns.provider

DDNS provider, one of the names inadyn registers (inadyn -L lists them). Either the full name, such as default@cloudflare.com or ipv6@dynv6.com, or the service name after the @, which inadyn resolves to the first plugin that carries it. Must be set when this module is enabled.

Platforms: NixOS only.

Type: null or one of “default@3322.org”, “dyndns@3322.org”, “ipv6@3322.org”, “default@all-inkl.com”, “ipv6@all-inkl.com”, “default@changeip.com”, “default@cloudflare.com”, “ipv6@cloudflare.com”, “default@cloudxns.net”, “default@core-networks.de”, “ipv6@core-networks.de”, “default@ddnss.de”, “default@desec.io”, “ipv6@desec.io”, “default@dhis.org”, “ipv6@dhis.org”, “default@dnsever.com”, “default@dnsexit.com”, “ipv6@dnsexit.com”, “default@dnshome.de”, “ipv6@dnshome.de”, “default@dnsmadeeasy.com”, “default@dnsmax.com”, “default@dnsomatic.com”, “ipv6@dnsomatic.com”, “default@dnspod.cn”, “ipv6@dnspod.cn”, “default@do.de”, “ipv6@do.de”, “default@domaindiscount24.com”, “default@domains.google.com”, “ipv6@domains.google.com”, “default@domene.shop”, “default@domopoli”, “ipv6@domopoli”, “default@duckdns.org”, “ipv6@duckdns.org”, “default@duiadns.net”, “ipv6@duiadns.net”, “default@dy.fi”, “ipv6@dy.fi”, “default@dyndns.it”, “default@dyndns.org”, “default@dynu.com”, “ipv6@dynu.com”, “default@dynv6.com”, “ipv4@dynv6.com”, “ipv6@dynv6.com”, “default@easydns.com”, “ipv6@easydns.com”, “default@freedns.afraid.org”, “ipv6@freedns.afraid.org”, “default@freemyip.com”, “default@gira.de”, “ipv6@gira.de”, “default@goip.de”, “ipv6@goip.de”, “default@he.net”, “dyndns@he.net”, “ipv6@he.net”, “ipv6tb@he.net”, “default@infomaniak.com”, “ipv6@infomaniak.com”, “default@inwx.com”, “ipv6@inwx.com”, “default@ipv4.dynv6.com”, “default@ipv64.net”, “ipv4@ipv64.net”, “ipv6@ipv64.net”, “default@itsdns.de”, “ipv6@itsdns.de”, “default@joker.com”, “default@loopia.com”, “default@moniker.com”, “default@mydns.jp”, “ipv6@mydns.jp”, “default@myonlineportal.net”, “ipv6@myonlineportal.net”, “default@namecheap.com”, “default@no-ip.com”, “ipv6@no-ip.com”, “default@noip.com”, “ipv6@noip.com”, “ipv4@nsupdate.info”, “ipv6@nsupdate.info”, “default@opendns.com”, “ipv6@opendns.com”, “default@oray.com”, “default@ovh.com”, “ipv6@ovh.com”, “default@pdd.yandex.ru”, “default@porkbun.com”, “ipv6@porkbun.com”, “default@regfish.de”, “ipv6@regfish.de”, “default@schokokeks.org”, “ipv6@schokokeks.org”, “default@selfhost.de”, “ipv6@selfhost.de”, “default@simply.com”, “default@sitelutions.com”, “default@spdyn.de”, “ipv6@spdyn.de”, “default@strato.com”, “ipv6@strato.com”, “default@thatip.com”, “default@tunnelbroker.net”, “default@twodns.de”, “default@udmedia.de”, “ipv6@udmedia.de”, “default@variomedia.de”, “ipv6@variomedia.de”, “default@zoneedit.com”, “ipv6@zoneedit.com”, “3322.org”, “all-inkl.com”, “changeip.com”, “cloudflare.com”, “cloudxns.net”, “core-networks.de”, “ddnss.de”, “desec.io”, “dhis.org”, “dnsever.com”, “dnsexit.com”, “dnshome.de”, “dnsmadeeasy.com”, “dnsmax.com”, “dnsomatic.com”, “dnspod.cn”, “do.de”, “domaindiscount24.com”, “domains.google.com”, “domene.shop”, “domopoli”, “duckdns.org”, “duiadns.net”, “dy.fi”, “dyndns.it”, “dyndns.org”, “dynu.com”, “dynv6.com”, “easydns.com”, “freedns.afraid.org”, “freemyip.com”, “gira.de”, “goip.de”, “he.net”, “infomaniak.com”, “inwx.com”, “ipv4.dynv6.com”, “ipv64.net”, “itsdns.de”, “joker.com”, “loopia.com”, “moniker.com”, “mydns.jp”, “myonlineportal.net”, “namecheap.com”, “no-ip.com”, “noip.com”, “nsupdate.info”, “opendns.com”, “oray.com”, “ovh.com”, “pdd.yandex.ru”, “porkbun.com”, “regfish.de”, “schokokeks.org”, “selfhost.de”, “simply.com”, “sitelutions.com”, “spdyn.de”, “strato.com”, “thatip.com”, “tunnelbroker.net”, “twodns.de”, “udmedia.de”, “variomedia.de”, “zoneedit.com”

Default: none, and an assertion rejects an unset value once the module is enabled

Example:

"cloudflare.com"

Declared by:

othrys.services.ddns.username

Provider username/account (for Cloudflare: the zone name). Null for token-only providers.

Platforms: NixOS only.

Type: null or string

Default:

null

Example:

"example.com"

Declared by:

othrys.services.docs.enable

Whether to enable MdBook documentation server.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.docs.package

The built documentation package to serve. Required when this module is imported on its own through nixosModules.docs, where no flake source is injected to build the default from.

Platforms: NixOS only.

Type: package

Default: the MdBook built from docs/ of the flake source that nixosModules.default injects

Declared by:

othrys.services.docs.desktopEntry

Create a desktop entry to open docs in the default browser.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.services.docs.interface

Interface to bind to (use 0.0.0.0 for all interfaces).

Platforms: NixOS only.

Type: string

Default:

"127.0.0.1"

Declared by:

othrys.services.docs.openFirewall

Open firewall port for documentation server.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.services.docs.port

Port to serve documentation on.

Platforms: NixOS only.

Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default:

3000

Declared by:

othrys.services.firewall.enable

Whether to enable Base firewall.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.grafana.enable

Whether to enable Grafana dashboards (datasources auto-provisioned from enabled othrys metrics stores).

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.grafana.adminPasswordFile

Path to a runtime file holding the admin password (a secrets-provider path). Grafana reads it as the grafana user, so with sops-nix set owner = "grafana" on the secret. The value is applied when the database is first created and ignored afterwards, and the password of an existing instance changes with grafana cli admin reset-admin-password. Null keeps the stock admin/admin credential, which the module warns about on loopback and refuses when listenAddress is not loopback or openFirewall is on.

Platforms: NixOS only.

Type: null or absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Default:

null

Example:

config.sops.secrets."grafana/admin-password".path

Declared by:

othrys.services.grafana.dashboardsDir

Directory of dashboard JSON files to provision (fleet-provided).

Platforms: NixOS only.

Type: null or absolute path

Default:

null

Declared by:

othrys.services.grafana.extraDatasources

Datasources provisioned in addition to the auto-detected othrys metrics stores.

Platforms: NixOS only.

Type: list of attribute set of anything

Default:

[ ]

Declared by:

othrys.services.grafana.listenAddress

Address Grafana listens on. Loopback by default, expecting a reverse proxy in front.

Platforms: NixOS only.

Type: string

Default:

"127.0.0.1"

Declared by:

othrys.services.grafana.openFirewall

Open port in the firewall. Leave off when a reverse proxy fronts Grafana (the default).

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.services.grafana.port

Port Grafana listens on (3001, since the docs server claims 3000 by default).

Platforms: NixOS only.

Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default:

3001

Declared by:

othrys.services.grafana.rootUrl

Public URL Grafana is reached at, written to server.root_url. Redirects, OIDC callbacks and the secure flag on the session cookie follow it, so it must be set when listenAddress is not loopback. Null keeps Grafana’s default, which names localhost.

Platforms: NixOS only.

Type: null or string

Default:

null

Example:

"https://grafana.example.com/"

Declared by:

othrys.services.grafana.secretKeyFile

Path to a runtime file holding Grafana’s secret_key (encrypts stored credentials, so generate a random string). Must be set when this module is enabled, since upstream no longer ships a default. Use a secrets-provider path, readable by the grafana user, which with sops-nix is owner = "grafana" on the secret.

Platforms: NixOS only.

Type: null or absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Default: none, and an assertion rejects an unset value once the module is enabled

Example:

config.sops.secrets."grafana/secret-key".path

Declared by:

othrys.services.headscale.enable

Whether to enable Headscale self-hosted Tailscale control server.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.headscale.address

Address Headscale listens on. Defaults to loopback, expecting a reverse proxy in front; set to 0.0.0.0 to expose it directly.

Platforms: NixOS only.

Type: string

Default:

"127.0.0.1"

Declared by:

othrys.services.headscale.baseDomain

MagicDNS base domain (settings.dns.base_domain), an FQDN without a trailing dot. Must differ from the serverUrl host. Null leaves it unset.

Platforms: NixOS only.

Type: null or string

Default:

null

Example:

"tailnet.example.com"

Declared by:

othrys.services.headscale.magicDns

Enable MagicDNS (settings.dns.magic_dns).

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.headscale.nameservers

Global nameservers pushed to clients (settings.dns.nameservers.global).

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "1.1.1.1"
  "9.9.9.9"
]

Declared by:

othrys.services.headscale.oidc.enable

Whether to enable OIDC authentication for node registration.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.headscale.oidc.allowedDomains

Email domains whose accounts may register (settings.oidc.allowed_domains).

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "example.com"
]

Declared by:

othrys.services.headscale.oidc.allowedGroups

Groups whose members may register (settings.oidc.allowed_groups). The issuer has to put a groups claim in the token for this to apply.

With none of the three lists set, every account the issuer knows can register a node, and the module warns about it.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "tailnet"
]

Declared by:

othrys.services.headscale.oidc.allowedUsers

Accounts that may register (settings.oidc.allowed_users).

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "alice@example.com"
]

Declared by:

othrys.services.headscale.oidc.clientId

OIDC client ID (settings.oidc.client_id).

Platforms: NixOS only.

Type: string

Default:

""

Example:

"headscale"

Declared by:

othrys.services.headscale.oidc.clientSecretFile

Path to a runtime file holding the OIDC client secret (a secrets-provider path). Never inline the secret. Headscale reads it as its own user, so the file must be readable by headscale; with sops-nix that is owner = "headscale" on the secret.

Platforms: NixOS only.

Type: null or absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Default:

null

Example:

config.sops.secrets."headscale/oidc-secret".path

Declared by:

othrys.services.headscale.oidc.issuer

OIDC issuer URL (settings.oidc.issuer).

Platforms: NixOS only.

Type: string

Default:

""

Example:

"https://auth.example.com/realms/main"

Declared by:

othrys.services.headscale.openFirewall

Open port in the firewall. Leave off when a reverse proxy fronts Headscale (the default).

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.services.headscale.policy

The tailnet ACL policy (settings.policy), as a path to a HuJSON file or as an attribute set written out as JSON. Null leaves Headscale on its default, which lets every node reach every other node. The policy is not a secret and lives in the store.

Platforms: NixOS only.

Type: null or absolute path or attribute set of anything

Default:

null

Example:

{
  acls = [
    {
      action = "accept";
      src = ["group:admins"];
      dst = ["*:*"];
    }
  ];
  groups."group:admins" = ["alice@example.com"];
}

Declared by:

othrys.services.headscale.port

Port Headscale listens on.

Platforms: NixOS only.

Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default:

8080

Declared by:

othrys.services.headscale.serverUrl

Public URL clients register against (settings.server_url). Mandatory, with no default. Must resolve to this host (typically via a TLS-terminating reverse proxy) and must differ from the MagicDNS baseDomain.

Platforms: NixOS only.

Type: string

Example:

"https://headscale.example.com"

Declared by:

othrys.services.headscale.settings

Extra config.yaml settings, deep-merged over (and overriding) the generated config.

Platforms: NixOS only.

Type: attribute set of anything

Default:

{ }

Declared by:

othrys.services.headscale.ui.enable

Whether to enable Headplane web UI for this Headscale instance (server-side API-key custody, OIDC SSO).

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.headscale.ui.package

Headplane package override. Null uses pkgs.headplane (the nixpkgs default for services.headplane).

Platforms: NixOS only.

Type: null or package

Default:

pkgs.headplane

Declared by:

othrys.services.headscale.ui.apiKeyFile

Path to a runtime file holding a Headscale API key (from headscale apikeys create). Written to Headplane’s headscale.api_key_path, which it uses server-side to mint OIDC sessions, so it is required when ui.oidc is enabled. Without it, Headplane authenticates via its in-browser API-key login and this is unused. Use a secrets-provider path readable by the headscale user, which Headplane runs as.

Platforms: NixOS only.

Type: null or absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Default:

null

Example:

config.sops.secrets."headscale/headplane-apikey".path

Declared by:

othrys.services.headscale.ui.configPath

Path to the Headscale config.yaml Headplane reads. Null uses the NixOS-generated config file for this instance.

Platforms: NixOS only.

Type: null or absolute path

Default:

config.services.headscale.configFile

Declared by:

othrys.services.headscale.ui.cookieSecretFile

Path to a runtime file holding the cookie-signing secret (a random string). Required when the UI is enabled. Use a secrets-provider path readable by the headscale user.

Platforms: NixOS only.

Type: null or absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Default:

null

Example:

config.sops.secrets."headscale/headplane-cookie".path

Declared by:

othrys.services.headscale.ui.host

Address Headplane listens on. Loopback by default, expecting a reverse proxy in front.

Platforms: NixOS only.

Type: string

Default:

"127.0.0.1"

Declared by:

othrys.services.headscale.ui.oidc.enable

Whether to enable OIDC SSO for Headplane admin login.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.headscale.ui.oidc.clientId

OIDC client ID for Headplane.

Platforms: NixOS only.

Type: string

Default:

""

Example:

"headplane"

Declared by:

othrys.services.headscale.ui.oidc.clientSecretFile

Path to a runtime file holding Headplane’s OIDC client secret. Never inline the secret. Readable by the headscale user.

Platforms: NixOS only.

Type: null or absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Default:

null

Example:

config.sops.secrets."headscale/headplane-oidc".path

Declared by:

othrys.services.headscale.ui.oidc.disableApiKeyLogin

Disable the fallback API-key login form once OIDC is configured, enforcing SSO-only admin access.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.headscale.ui.oidc.issuer

OIDC issuer URL for Headplane login.

Platforms: NixOS only.

Type: string

Default:

""

Example:

"https://auth.example.com/realms/main"

Declared by:

othrys.services.headscale.ui.openFirewall

Open the UI port in the firewall. Leave off when a reverse proxy fronts Headplane (the default).

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.services.headscale.ui.port

Port Headplane listens on.

Platforms: NixOS only.

Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default:

3000

Declared by:

othrys.services.headscale.ui.settings

Extra Headplane settings, deep-merged over (and overriding) the generated config.

Platforms: NixOS only.

Type: attribute set of anything

Default:

{ }

Declared by:

othrys.services.kea.enable

Whether to enable Kea DHCP server.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.kea.dhcp4.enable

Enable the Kea DHCP4 server.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.kea.dhcp4.interfaces

Interfaces the DHCP4 server listens on.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "br-lan"
]

Declared by:

othrys.services.kea.dhcp4.leasesFile

memfile lease database path.

Platforms: NixOS only.

Type: string

Default:

"/var/lib/kea/dhcp4.leases"

Declared by:

othrys.services.kea.dhcp4.settings

Kea DHCP4 settings, deep-merged over the defaults (put subnet4/reservations/option-data here).

Platforms: NixOS only.

Type: attribute set of anything

Default:

{ }

Example:

{
  subnet4 = [
    {
      id = 1;
      subnet = "10.0.0.0/24";
      pools = [{ pool = "10.0.0.100 - 10.0.0.240"; }];
      option-data = [{ name = "routers"; data = "10.0.0.1"; }];
    }
  ];
}

Declared by:

othrys.services.kea.dhcp6.enable

Enable the Kea DHCP6 server.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.services.kea.dhcp6.interfaces

Interfaces the DHCP6 server listens on.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "br-lan"
]

Declared by:

othrys.services.kea.dhcp6.leasesFile

memfile lease database path.

Platforms: NixOS only.

Type: string

Default:

"/var/lib/kea/dhcp6.leases"

Declared by:

othrys.services.kea.dhcp6.settings

Kea DHCP6 settings, deep-merged over the defaults (put subnet6/reservations/option-data here).

Platforms: NixOS only.

Type: attribute set of anything

Default:

{ }

Example:

{
  subnet6 = [
    {
      id = 1;
      subnet = "10.0.0.0/24";
      pools = [{ pool = "10.0.0.100 - 10.0.0.240"; }];
      option-data = [{ name = "routers"; data = "10.0.0.1"; }];
    }
  ];
}

Declared by:

othrys.services.monitoring.enable

Whether to enable Prometheus monitoring.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.monitoring.extraCollectors

Node-exporter collectors enabled in addition to the curated base set.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "ethtool"
  "smartctl"
]

Declared by:

othrys.services.monitoring.listenAddress

Address Prometheus and the node exporter bind to.

Platforms: NixOS only.

Type: string

Default:

"127.0.0.1"

Declared by:

othrys.services.monitoring.nodePort

Node exporter port.

Platforms: NixOS only.

Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default:

9100

Declared by:

othrys.services.monitoring.openFirewall

Open firewall ports for external Grafana access.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.services.monitoring.port

Prometheus server port.

Platforms: NixOS only.

Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default:

9090

Declared by:

othrys.services.monitoring.retentionTime

Prometheus metric retention (dedicated monitoring hosts usually want more than the 15d default).

Platforms: NixOS only.

Type: string

Default:

"15d"

Example:

"90d"

Declared by:

othrys.services.mosh.enable

Whether to enable Mosh server and client.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.mosh.openFirewall

Open UDP 60000 to 61000, the range mosh-server picks its port from, in the NixOS firewall. A host that only connects out to other hosts turns it off. nix-darwin’s firewall takes no port list, so it is unread there.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.services.mounts.cifs.enable

Whether to enable CIFS/SMB network share mounts.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.mounts.cifs.shares

CIFS/SMB shares to mount, keyed by mount name.

Platforms: NixOS only.

Type: attribute set of (submodule)

Default:

{ }

Declared by:

othrys.services.mounts.cifs.shares.<name>.credentialsFile

Path to a runtime credentials file (username=x\npassword=y). Use a sops template path, not a /nix/store path.

Platforms: NixOS only.

Type: absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Declared by:

othrys.services.mounts.cifs.shares.<name>.gid

Group of the mounted files, as a gid or a group name. Null takes the primary user’s group on a host that manages its account. A host without one has to set this.

Platforms: NixOS only.

Type: null or unsigned integer, meaning >=0, or string

Default: the primary user’s group on a host with othrys.system.users.enable

Example:

100

Declared by:

othrys.services.mounts.cifs.shares.<name>.mountPoint

Local mount point.

Platforms: NixOS only.

Type: string

Default:

"/mnt/shares/<name>"

Declared by:

othrys.services.mounts.cifs.shares.<name>.remotePath

Remote CIFS/SMB path.

Platforms: NixOS only.

Type: string

Example:

"//192.168.1.100/media"

Declared by:

othrys.services.mounts.cifs.shares.<name>.seal

Encrypt the session with seal. Authentication protects the password and nothing else, so without it file contents cross the network in the clear. Encryption needs SMB 3.0 or newer on both ends, and a share on an older dialect sets this to false.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.mounts.cifs.shares.<name>.sec

Authentication mode, one of the values mount.cifs accepts for sec=. The i variants also sign every packet.

Platforms: NixOS only.

Type: one of “none”, “krb5”, “krb5i”, “ntlmv2”, “ntlmv2i”, “ntlmssp”, “ntlmsspi”

Default:

"ntlmssp"

Declared by:

othrys.services.mounts.cifs.shares.<name>.uid

Owner of the mounted files, as a uid or a user name. Null takes the primary user of a host that manages its account. A host without one has to set this.

Platforms: NixOS only.

Type: null or unsigned integer, meaning >=0, or string

Default: the primary user, othrys.system.user.name, on a host with othrys.system.users.enable

Example:

1000

Declared by:

othrys.services.mounts.cifs.shares.<name>.vers

SMB protocol version passed as vers=. The default pins the newest dialect, so a server cannot negotiate the mount down to an older one. default hands the choice back to the kernel, and an old NAS needs the dialect it speaks named here.

Platforms: NixOS only.

Type: one of “1.0”, “2.0”, “2.1”, “3”, “3.0”, “3.0.2”, “3.1.1”, “default”

Default:

"3.1.1"

Example:

"3.0"

Declared by:

othrys.services.mounts.disks.enable

Whether to enable additional disk mounts.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.mounts.disks.devices

Disk mount configurations.

Platforms: NixOS only.

Type: attribute set of (submodule)

Default:

{ }

Example:

{
  data = {
    device = "/dev/disk/by-uuid/0123456789ABCDEF";
    mountPoint = "/mnt/data";
    fsType = "ntfs-3g";
  };
  backup = {
    device = "/dev/disk/by-uuid/abcd1234-5678-90ab-cdef";
    mountPoint = "/mnt/backup";
    fsType = "ext4";
  };
}

Declared by:

othrys.services.mounts.disks.devices.<name>.allowDev

Mount without nodev, so device nodes on the disk are usable. Off for every filesystem type.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.services.mounts.disks.devices.<name>.allowSuid

Mount without nosuid, so setuid and setgid bits on the disk take effect. Off for every filesystem type, since a data disk has no use for them.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.services.mounts.disks.devices.<name>.automount

Auto-mount on access with nofail.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.mounts.disks.devices.<name>.device

Device path (use /dev/disk/by-uuid/ or /dev/disk/by-partuuid/).

Platforms: NixOS only.

Type: string

Example:

"/dev/disk/by-uuid/0123456789ABCDEF"

Declared by:

othrys.services.mounts.disks.devices.<name>.deviceTimeout

Timeout in seconds if device not found.

Platforms: NixOS only.

Type: signed integer

Default:

10

Declared by:

othrys.services.mounts.disks.devices.<name>.dmask

Directory permission mask in octal, three or four digits (NTFS and vfat).

Platforms: NixOS only.

Type: string matching the pattern [0-7]{3,4}

Default:

"022"

Declared by:

othrys.services.mounts.disks.devices.<name>.extraOptions

Extra mount options.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Declared by:

othrys.services.mounts.disks.devices.<name>.fmask

File permission mask in octal, three or four digits (NTFS and vfat).

Platforms: NixOS only.

Type: string matching the pattern [0-7]{3,4}

Default:

"133"

Declared by:

othrys.services.mounts.disks.devices.<name>.fsType

Filesystem type (ntfs-3g = FUSE driver, ntfs3 = in-kernel driver).

Platforms: NixOS only.

Type: one of “ntfs-3g”, “ntfs3”, “ext4”, “btrfs”, “xfs”, “vfat”

Default:

"ext4"

Declared by:

othrys.services.mounts.disks.devices.<name>.gid

Group ID that owns the files (NTFS and vfat).

Platforms: NixOS only.

Type: unsigned integer, meaning >=0

Default:

100

Declared by:

othrys.services.mounts.disks.devices.<name>.mountPoint

Mount point path.

Platforms: NixOS only.

Type: string

Example:

"/mnt/data"

Declared by:

othrys.services.mounts.disks.devices.<name>.uid

User ID that owns the files (NTFS and vfat, which store no owner).

Platforms: NixOS only.

Type: unsigned integer, meaning >=0

Default:

1000

Declared by:

othrys.services.notify.enable

Whether to enable host notification dispatch (othrys-notify + systemd failure hooks).

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.notify.tokenFile

Path to a runtime file holding an ntfy access token (a secrets-provider path). Null sends unauthenticated.

Platforms: NixOS only.

Type: null or absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Default:

null

Example:

config.sops.secrets."notify/token".path

Declared by:

othrys.services.notify.topic

ntfy topic notifications are published to (on public instances the topic is effectively a password, so use tokenFile or a private server).

Platforms: NixOS only.

Type: string

Default:

"alerts"

Declared by:

othrys.services.notify.url

ntfy endpoint notifications are published to. Follows the local ntfy server by default; point it at a fleet-central instance otherwise.

Platforms: NixOS only.

Type: null or string

Default:

the local othrys.services.ntfy instance when enabled, else null

Example:

"https://ntfy.example.com"

Declared by:

othrys.services.ntfy.enable

Whether to enable self-hosted ntfy push-notification server.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.ntfy.access

Access rules, one user:topic:permission entry each (auth-access), where the user is a name from users or * for anonymous clients.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "fleet:alerts:write-only"
  "alice:*:read-write"
]

Declared by:

othrys.services.ntfy.baseUrl

Base URL (upstream requires it; used for attachments and web-app links). The loopback default serves internal notify hosts. Set the public URL when a reverse proxy fronts it.

Platforms: NixOS only.

Type: string

Default:

"http://${listenAddress}:${port}"

Example:

"https://ntfy.example.com"

Declared by:

othrys.services.ntfy.defaultAccess

What a client with no credentials may do on any topic (auth-default-access). ntfy’s own default is read-write, which lets anyone who reaches the port publish to and read every topic, the alert topic included. Access is granted through users, access and tokensFile, or through ntfy user and ntfy access on the host.

Platforms: NixOS only.

Type: one of “deny-all”, “read-only”, “write-only”, “read-write”

Default:

"deny-all"

Declared by:

othrys.services.ntfy.listenAddress

Address ntfy listens on. Loopback by default, expecting a reverse proxy in front; set to 0.0.0.0 to expose it directly.

Platforms: NixOS only.

Type: string

Default:

"127.0.0.1"

Declared by:

othrys.services.ntfy.openFirewall

Open port in the firewall. Leave off when a reverse proxy fronts ntfy (the default).

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.services.ntfy.port

Port ntfy listens on.

Platforms: NixOS only.

Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default:

2586

Declared by:

othrys.services.ntfy.settings

Extra services.ntfy-sh settings (server.yml), deep-merged over (and overriding) the generated config.

Platforms: NixOS only.

Type: attribute set of anything

Default:

{ }

Declared by:

othrys.services.ntfy.tokensFile

Environment file holding NTFY_AUTH_TOKENS=user:tk_token:label,..., which provisions access tokens for the accounts in users. A token is a credential, so it comes from a secrets provider and never from the store. The publishers then set othrys.services.notify.tokenFile to a file holding their token.

Platforms: NixOS only.

Type: null or absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Default:

null

Example:

config.sops.secrets."ntfy/tokens".path

Declared by:

othrys.services.ntfy.users

Accounts to provision, one name:bcrypt-hash:role entry each (auth-users). The hash comes from ntfy user hash, and the role is user or admin. A hash is not a password, so it may sit in the store; the password itself never goes here.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "alice:$2a$10$examplehash:user"
  "fleet:$2a$10$otherhash:user"
]

Declared by:

othrys.services.printing.enable

Whether to enable CUPS printing service.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.printing.avahi

Whether to enable Avahi for network printer discovery.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.printing.listenAddresses

Addresses and ports CUPS listens on (services.printing.listenAddresses). The default is loopback only. A print server reached from other hosts lists an address here and also sets services.printing.allowFrom, which stays at upstream’s localhost.

Platforms: NixOS only.

Type: list of string

Default:

[
  "localhost:631"
]

Example:

[
  "*:631"
]

Declared by:

othrys.services.printing.openFirewall

Open the TCP ports named in listenAddresses in the firewall (services.printing.openFirewall).

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.services.restic.enable

Whether to enable Restic backups.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.restic.backups

Named restic backups (maps to services.restic.backups.<name>).

Platforms: NixOS only.

Type: attribute set of (submodule)

Default:

{ }

Declared by:

othrys.services.restic.backups.<name>.backupCleanupCommand

Script run after the backup (e.g. resume the service quiesced in backupPrepareCommand).

Platforms: NixOS only.

Type: null or strings concatenated with “\n”

Default:

null

Declared by:

othrys.services.restic.backups.<name>.backupPrepareCommand

Script run before the backup (e.g. quiesce a service or dump a database for a consistent snapshot).

Platforms: NixOS only.

Type: null or strings concatenated with “\n”

Default:

null

Declared by:

othrys.services.restic.backups.<name>.checkOpts

Options for restic check (when runCheck is set). Plain check verifies repository structure only, and never reads pack contents, so in-place bit corruption passes silently. The default reads a random 5% of the pack data on each run, which costs a twentieth of the repository in backend reads. Raise the percentage, or use --read-data to read everything on every run, where reads are cheap. An empty list gives the structure-only check.

Platforms: NixOS only.

Type: list of string

Default:

[
  "--read-data-subset=5%"
]

Example:

[
  "--read-data"
]

Declared by:

othrys.services.restic.backups.<name>.environmentFile

systemd EnvironmentFile with backend credentials (e.g. AWS_/B2_ keys). Use a secrets-provider path.

Platforms: NixOS only.

Type: null or absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Default:

null

Example:

config.sops.secrets."backup/env".path

Declared by:

othrys.services.restic.backups.<name>.exclude

Restic exclude patterns.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Declared by:

othrys.services.restic.backups.<name>.extraBackupArgs

Extra arguments passed to restic backup.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Declared by:

othrys.services.restic.backups.<name>.initialize

Create the repository on first run when none exists at the location. Where several hosts back up into one repository, leave this on for one host and set it to false on the rest. Two first runs can otherwise both initialise the repository, and a host pointed at the wrong location creates an empty repository there instead of failing.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.restic.backups.<name>.passwordFile

Path to a runtime file containing the repository password (a secrets-provider path). Omit only if the password is supplied via environmentFile (RESTIC_PASSWORD).

Platforms: NixOS only.

Type: null or absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Default:

null

Example:

config.sops.secrets."backup/repo-password".path

Declared by:

othrys.services.restic.backups.<name>.paths

Paths to back up. Empty makes a prune-only job.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "/var/lib/something"
  "/home/alice/Documents"
]

Declared by:

othrys.services.restic.backups.<name>.pruneOpts

Retention options for restic forget --prune, run after each backup.

Platforms: NixOS only.

Type: list of string

Default:

[
  "--keep-daily 7"
  "--keep-weekly 4"
  "--keep-monthly 6"
]

Declared by:

othrys.services.restic.backups.<name>.rcloneConfigFile

Path to an rclone config file for rclone backends. Use a secrets-provider path.

Platforms: NixOS only.

Type: null or absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Default:

null

Declared by:

othrys.services.restic.backups.<name>.repository

Repository location for non-sensitive targets (e.g. a local path). The value is written to the unit file in the store, so a URL that carries a credential is rejected. That covers user:password@ under any scheme, anything before the @ of an http or https URL, a lone token included, and a query parameter named for a token, a key, a secret, a password or a signature. Use repositoryFile when the URL carries a host or credentials.

Platforms: NixOS only.

Type: null or string

Default:

null

Example:

"/mnt/backup/restic"

Declared by:

othrys.services.restic.backups.<name>.repositoryFile

Path to a runtime file containing the repository URL (a secrets-provider path). Mutually exclusive with repository.

Platforms: NixOS only.

Type: null or absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Default:

null

Example:

config.sops.secrets."backup/repo-url".path

Declared by:

othrys.services.restic.backups.<name>.runCheck

Run restic check after the backup, so a damaged repository fails the backup unit instead of being found at restore time. The check reads from the repository backend on every run. Set this to false where that read is not wanted.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.restic.backups.<name>.timerConfig

systemd.timer schedule; null runs only when started manually.

Platforms: NixOS only.

Type: null or (attribute set of anything)

Default:

{
  OnCalendar = "daily";
  Persistent = true;
  RandomizedDelaySec = "1h";
}

Declared by:

othrys.services.restic.backups.<name>.user

User the backup runs as (must be able to read paths).

Platforms: NixOS only.

Type: string

Default:

"root"

Declared by:

othrys.services.router.enable

Whether to enable L3 router firewall + NAT (nftables).

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.router.extraForwardRules

Raw nftables rules appended to the filter forward chain (e.g. port forwards, inter-VLAN policy).

Platforms: NixOS only.

Type: strings concatenated with “\n”

Default:

""

Declared by:

othrys.services.router.extraInputRules

Raw nftables rules appended to the filter input chain. A port that a module opens through openFirewall needs nothing here, since the firewall’s port lists are rendered into this chain for every interface but the WAN. A port that must reach the WAN is opened with networking.firewall.interfaces.<wan>.allowedTCPPorts or the UDP list, which this chain renders for that interface alone.

Platforms: NixOS only.

Type: strings concatenated with “\n”

Default:

""

Declared by:

othrys.services.router.extraNat

Raw nftables rules appended to the NAT postrouting chain, after the masquerade, for source rewrites such as an exception to it. A dnat verb is invalid in this chain: nft --check accepts it, the kernel refuses the whole ruleset at load, and the router comes up with no firewall at all. Port forwards go in portForwards or extraPrerouting.

Platforms: NixOS only.

Type: strings concatenated with “\n”

Default:

""

Example:

"oifname \"enp1s0f0\" ip saddr 10.0.0.42 snat to 203.0.113.42"

Declared by:

othrys.services.router.extraPrerouting

Raw nftables rules appended to the NAT prerouting chain, where a dnat or redirect verb belongs. A connection rewritten here still needs its accept in extraForwardRules unless portForwards made it.

Platforms: NixOS only.

Type: strings concatenated with “\n”

Default:

""

Declared by:

othrys.services.router.forwarding

Enable IP forwarding and rp_filter anti-spoofing sysctls.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.router.ipv6

Forward IPv6 as well. There is no NATv6, so the LAN needs a routed prefix of its own. This module forwards and filters IPv6 and configures no addressing. Requesting a delegated prefix from the uplink and sending router advertisements on the LAN are the host’s job, through systemd-networkd’s DHCPPrefixDelegation and IPv6SendRA, or through dhcpcd and radvd.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.router.lan.interfaces

Trusted (LAN) interfaces: their input is accepted and they are forwarded to the WAN.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "br-lan"
]

Declared by:

othrys.services.router.logDrops

Log every packet the input and forward chains drop, through the kernel log with a router input drop: or router forward drop: prefix. The counters on those rules are always on; this adds the packets themselves, which is useful while bringing a host up and noisy on a WAN link afterwards.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.services.router.nat.enable

IPv4 masquerade (SNAT) for traffic leaving the WAN interface.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.router.portForwards

Connections arriving on the WAN interface that are sent on to a LAN host. Each entry renders the dnat rule in the NAT prerouting chain and the accept in the forward chain that the rewritten connection needs, through Suricata when the IPS hook is on.

Platforms: NixOS only.

Type: list of (submodule)

Default:

[ ]

Example:

[
  {
    port = 25565;
    destination = "10.0.0.42";
  }
]

Declared by:

othrys.services.router.portForwards.*.destination

LAN address the connections are sent to.

Platforms: NixOS only.

Type: string

Example:

"10.0.0.42"

Declared by:

othrys.services.router.portForwards.*.destinationPort

Port on the destination. The WAN port when null.

Platforms: NixOS only.

Type: null or 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default:

null

Declared by:

othrys.services.router.portForwards.*.port

Port on the WAN interface the connections arrive on.

Platforms: NixOS only.

Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Declared by:

othrys.services.router.portForwards.*.protocol

Transport protocol of the forwarded connections.

Platforms: NixOS only.

Type: one of “tcp”, “udp”

Default:

"tcp"

Declared by:

othrys.services.router.suricata.enable

Send forwarded traffic to Suricata via NFQUEUE. Pair with othrys.services.suricata (mode = “nfqueue”).

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.services.router.suricata.queues

NFQUEUE count; must match othrys.services.suricata.nfqueue.queues.

Platforms: NixOS only.

Type: positive integer, meaning >0

Default:

1

Declared by:

othrys.services.router.wan.interface

Uplink (WAN) interface. Input is default-drop except established/related; LAN is masqueraded out this interface.

Platforms: NixOS only.

Type: string

Example:

"enp1s0f0"

Declared by:

othrys.services.scrutiny.enable

Whether to enable the Scrutiny hub: web UI + InfluxDB, and a collector for this host’s own disks.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.scrutiny.collector.enable

Run the smartctl collector on this host. Follows enable (a hub watches its own disks); set alone on satellite hosts, with endpoint.

Platforms: NixOS only.

Type: boolean

Default:

config.othrys.services.scrutiny.enable

Declared by:

othrys.services.scrutiny.collector.endpoint

Scrutiny API base URL the collector reports to. Null means the local web UI, which suits a hub, and a satellite must set it. The value is written to the collector’s unit and configuration in the store, so a URL with a user, password or token before the host is refused. A hub behind a proxy that asks for credentials is reached through environmentFile.

Platforms: NixOS only.

Type: null or string

Default:

null

Example:

"https://scrutiny.example.com"

Declared by:

othrys.services.scrutiny.collector.environmentFile

Environment file read by the collector unit, a secrets-provider path. A line COLLECTOR_API_ENDPOINT=https://user:password@scrutiny.example.com in it replaces endpoint at run time, which is how the collector authenticates to a hub behind a proxy without the credentials entering the store. Upstream types the endpoint as a plain string and has no file form for it.

Platforms: NixOS only.

Type: null or absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Default:

null

Example:

config.sops.secrets."scrutiny/collector-env".path

Declared by:

othrys.services.scrutiny.collector.hostId

Label the web UI groups this host’s disks under.

Platforms: NixOS only.

Type: string

Default:

config.networking.hostName

Declared by:

othrys.services.scrutiny.collector.schedule

systemd calendar expression for collector runs. Daily is enough, since smartd covers the fast alarms and this feeds the trend history.

Platforms: NixOS only.

Type: string

Default:

"daily"

Declared by:

othrys.services.scrutiny.listenAddress

Address the web UI listens on. Loopback by default, expecting a reverse proxy in front; satellites then report in through the proxied URL.

Platforms: NixOS only.

Type: string

Default:

"127.0.0.1"

Declared by:

othrys.services.scrutiny.notifyUrls

shoutrrr URLs Scrutiny pushes device-failure notifications to. Follows the fleet notify channel by default. A token-authenticated notify endpoint is NOT auto-wired (the token would end up world-readable in the rendered config). Pass an explicit URL instead. Nothing is wired either when notify points at the ntfy server on this host with no token while that server denies anonymous clients, since every push would be refused.

Platforms: NixOS only.

Type: list of string

Default:

the othrys.services.notify endpoint as a shoutrrr ntfy URL, when notify is enabled, unauthenticated and not refused by the ntfy server on this host; else []

Example:

[
  "ntfy://ntfy.example.com/alerts"
]

Declared by:

othrys.services.scrutiny.openFirewall

Open port in the firewall. Leave off when a reverse proxy fronts the web UI (the default).

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.services.scrutiny.port

Port the web UI (and collector API) listens on.

Platforms: NixOS only.

Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default:

8080

Declared by:

othrys.services.security.crowdsec.enable

Whether to enable CrowdSec security engine + firewall bouncer.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.security.crowdsec.acquisitions

Log sources CrowdSec parses (see the CrowdSec data-sources docs). Setting this replaces the curated default outright, including the sshd journal source, so list every source the host should watch rather than only the ones being added. Traefik’s access log is added beside this list on a host with othrys.services.traefik, and the module turns that log on. Tailscale SSH has no CrowdSec parser and is not watched.

Platforms: NixOS only.

Type: list of attribute set of anything

Default:

[
  {
    journalctl_filter = [
      "_SYSTEMD_UNIT=sshd.service"
    ];
    labels = {
      type = "syslog";
    };
    source = "journalctl";
  }
]

Declared by:

othrys.services.security.crowdsec.autoUpdate

Run cscli hub update daily.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.security.crowdsec.collections

CrowdSec hub collections to install (bundle parsers + scenarios).

Platforms: NixOS only.

Type: list of string

Default:

[
  "crowdsecurity/linux"
  "crowdsecurity/sshd"
]

Declared by:

othrys.services.security.crowdsec.firewallBouncer.enable

Enable the nftables firewall bouncer that enforces CrowdSec decisions (auto-registered with the local engine).

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.security.crowdsec.openFirewall

Open the CrowdSec LAPI port in the firewall.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.services.security.fail2ban.enable

Whether to enable Fail2ban intrusion prevention.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.security.fail2ban.bantime

Base ban duration, escalated by bantime-increment up to 48h. A number of seconds, or a number with one of the suffixes s, m, h, d, w, mo and y.

Platforms: NixOS only.

Type: string matching the pattern [0-9]+(s|m|h|d|w|mo|y)?

Default:

"10m"

Example:

"1h"

Declared by:

othrys.services.security.fail2ban.ignoreIP

Addresses exempt from banning. Loopback only by default. Tailnet peers are NOT exempt, since exempting the Tailscale CGNAT range (100.64.0.0/10) would let every tailnet node bypass fail2ban (shared Headscale, third-party devices). Hosts that fully trust their tailnet can add it explicitly.

Platforms: NixOS only.

Type: list of string

Default:

[
  "127.0.0.1/8"
  "::1"
]

Example:

[
  "127.0.0.1/8"
  "::1"
  "100.64.0.0/10"
]

Declared by:

othrys.services.security.fail2ban.maxretry

Failures before a ban (applies to the base config and the sshd jail).

Platforms: NixOS only.

Type: positive integer, meaning >0

Default:

5

Declared by:

othrys.services.security.polkit.enable

Whether to enable Polkit privilege escalation.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.security.sudo.enable

Whether to enable Sudo configuration.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.security.sudo.execWheelOnly

Only allow users in the wheel group to run sudo at all.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.security.sudo.timestampTimeout

Minutes a successful authentication is reused for before sudo asks again (Defaults timestamp_timeout). sudo’s own default is 5, and 0 asks every time.

Platforms: NixOS only.

Type: unsigned integer, meaning >=0

Default:

5

Declared by:

othrys.services.security.yubikey.enable

Whether to enable YubiKey authentication (U2F + GPG + SSH).

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.security.yubikey.pinentryPackage

Pinentry program for GPG/SSH PIN prompts. A graphical pinentry on a headless host cannot render, silently breaking every GPG and SSH authentication, which is why the terminal fallback is the default.

Platforms: NixOS and nix-darwin.

Type: package

Default:

pkgs.pinentry-curses unless othrys.desktop.graphical, and on a graphical host pkgs.pinentry_mac on nix-darwin and pkgs.pinentry-qt otherwise

Declared by:

othrys.services.security.yubikey.sshKeygrips

GPG keygrips to authorize for SSH authentication.

Platforms: NixOS and nix-darwin.

Type: list of string

Default:

[ ]

Example:

[
  "0123456789ABCDEF0123456789ABCDEF01234567"
]

Declared by:

othrys.services.security.yubikey.u2fExemptUsers

Normal users that have no entry in u2fMappings on purpose. With u2fRequirePassword on, the module refuses a host where a normal user has no mapping, since that account fails every service in u2fServices. An account that never authenticates through them, such as one reached over SSH alone, is named here and the check passes it over. It stays locked out of those services.

Platforms: NixOS and nix-darwin.

Type: list of string

Default:

[ ]

Example:

[
  "deploy"
]

Declared by:

othrys.services.security.yubikey.u2fMappings

U2F key mappings per user. Generated with: pamu2fcfg -n -o pam://yubi

That command prints each credential with a leading colon, which joins it to a user’s line in a mappings file. Leave the colon out here, since each list entry is one credential.

Keys are stored in /nix/store (read-only) for security. Any non-empty mapping turns pam_u2f on for the services in u2fServices. NixOS only, and a darwin host refuses a mapping, since nix-darwin manages the sudo service alone and othrys puts no pam_u2f line there.

Platforms: NixOS and nix-darwin.

Type: attribute set of list of string matching the pattern [A-Za-z0-9+/=.-]+(,[A-Za-z0-9+/=.-]*)+

Default:

{ }

Example:

{
  alice = [
    "<KeyHandle1>,<UserKey1>,<CoseType1>,<Options1>"
    "<KeyHandle2>,<UserKey2>,<CoseType2>,<Options2>"
  ];
}

Declared by:

othrys.services.security.yubikey.u2fOrigin

U2F origin for cross-machine portability.

Platforms: NixOS and nix-darwin.

Type: string

Default:

"pam://yubi"

Declared by:

othrys.services.security.yubikey.u2fRequirePassword

Require a password in addition to the touch, rather than accepting the touch alone.

With this on, pam_u2f is inserted as required in every service in u2fServices, so both the password and the touch must succeed and the key is a second factor. The control applies to the whole PAM service and not to one user, so every account that authenticates through one of those services needs an enrolled credential, and an account with none is locked out of them while other accounts keep working. Enrol and test a key for every such account before turning it on. The module refuses the setting while any normal user of the host has no mapping, apart from the accounts named in u2fExemptUsers.

With this off, pam_u2f is sufficient: a touch on an enrolled key satisfies the service with no password, which is authentication by possession alone. Whoever holds the token holds root, and a token left in a laptop is a token in someone’s hand. An account with no mapping falls through to its password, so nothing is locked out.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.services.security.yubikey.u2fServices

PAM services that take the YubiKey, by their names under security.pam.services. Console login, sudo, the greeter, polkit prompts and the two screen lockers by default. su and sshd are left out on purpose: su is how root is reached from a console with no key at hand, and sshd authenticates with keys of its own. A service listed here that the host does not run is harmless.

Platforms: NixOS and nix-darwin.

Type: list of string

Default:

[
  "login"
  "sudo"
  "greetd"
  "polkit-1"
  "hyprlock"
  "swaylock"
]

Declared by:

othrys.services.soju.enable

Whether to enable the soju IRC bouncer.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.soju.extraConfig

Lines appended to soju.conf. See soju(1) for the directives.

Platforms: NixOS only.

Type: strings concatenated with “\n”

Default:

""

Example:

"max-user-networks 5"

Declared by:

othrys.services.soju.hostName

Name soju gives itself as an IRC server, in the prefix of its own messages and in its welcome replies. soju warns at start when the name has no dot. It is not compared with the TLS name a client uses.

Platforms: NixOS only.

Type: string

Default:

traefik.domain when traefik.enable is on, config.networking.hostName otherwise

Example:

"irc.example.com"

Declared by:

othrys.services.soju.messageStore

Where soju keeps message history. db writes it to the same sqlite database that holds the accounts, soju.db in the state directory, and gives soju’s message search. fs writes plain-text logs under logs in the state directory, and memory keeps nothing across a restart. Upstream NixOS defaults to fs, while soju itself defaults to db.

Platforms: NixOS only.

Type: one of “db”, “fs”, “memory”

Default:

"db"

Declared by:

othrys.services.soju.openFirewall

Open port 6697 for soju’s own TLS listener. It has an effect only with tls.certificateFile set. The plaintext listener is never opened, and the port Traefik listens on is opened by othrys.services.traefik.tcpRouters.soju.openFirewall.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.services.soju.port

Port of the plaintext listener on loopback, irc+insecure://, which a client on the same host uses and which Traefik forwards to. It is never opened in the firewall.

Platforms: NixOS only.

Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default:

6667

Declared by:

othrys.services.soju.tls.certificateFile

Runtime path to the certificate chain for soju’s own TLS listener, ircs:// on port 6697. Set together with tls.keyFile. The file is loaded into the service as a credential, so it can stay owned by root. A renewed certificate is read at the next restart of soju.service.

Platforms: NixOS only.

Type: null or absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Default:

null

Example:

"/var/lib/acme/irc.example.com/fullchain.pem"

Declared by:

othrys.services.soju.tls.keyFile

Runtime path to the private key for tls.certificateFile.

Platforms: NixOS only.

Type: null or absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Default:

null

Example:

"/var/lib/acme/irc.example.com/key.pem"

Declared by:

othrys.services.soju.traefik.enable

Whether to enable a Traefik TCP router for soju. Traefik terminates TLS on port 6697 with its ACME resolver and forwards to soju over [::1] with a PROXY protocol header, so soju sees each client’s own address .

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.soju.traefik.domain

Name clients connect to. Traefik requests its certificate and routes on it, and a client that sends no such name is not routed. It becomes the default of hostName.

Platforms: NixOS only.

Type: null or string

Default:

null

Example:

"irc.example.com"

Declared by:

othrys.services.ssh.enable

Whether to enable SSH server and client.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.ssh.includeForgeKeys

Add the published ed25519 host keys of github.com, gitlab.com, codeberg.org and git.sr.ht to the known hosts. They are public keys of public services. Turn this off to manage those entries yourself.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.services.ssh.knownHosts

Host keys every user on this host trusts, passed to programs.ssh.knownHosts and written to /etc/ssh/ssh_known_hosts. A host listed here is verified against the listed key on the first connection, so nobody is asked to accept it on trust. Each entry needs one of publicKey and publicKeyFile. Host names and keys are identity and belong in the host configuration.

Platforms: NixOS and nix-darwin.

Type: attribute set of (submodule)

Default:

{ }

Example:

{
  "nas.example.com".publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA...";
}

Declared by:

othrys.services.ssh.knownHosts.<name>.certAuthority

The key is a certificate authority that signs host keys.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Declared by:

othrys.services.ssh.knownHosts.<name>.extraHostNames

Further names and addresses beside the attribute name. Ignored when hostNames is set.

Platforms: NixOS and nix-darwin.

Type: list of string

Default:

[ ]

Declared by:

othrys.services.ssh.knownHosts.<name>.hostNames

Names and addresses the key is trusted for. The attribute name is included by default.

Platforms: NixOS and nix-darwin.

Type: list of string

Default:

[ <name> ] ++ extraHostNames

Declared by:

othrys.services.ssh.knownHosts.<name>.publicKey

The key type and the key, without any host name.

Platforms: NixOS and nix-darwin.

Type: null or string

Default:

null

Example:

"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA..."

Declared by:

othrys.services.ssh.knownHosts.<name>.publicKeyFile

A file holding one public key, read at build time and copied into the Nix store.

Platforms: NixOS and nix-darwin.

Type: null or absolute path

Default:

null

Declared by:

othrys.services.ssh.server.enable

Enable the inbound SSH server. Opt-in per host so exposure is explicit. On nix-darwin it turns on the macOS Remote Login service.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Declared by:

othrys.services.ssh.server.openFirewall

Open the server’s ports in the firewall. Unlike most othrys firewall toggles this defaults to true, since enabling the server is already the explicit decision to expose it. Turn it off on a host that opens the port on named interfaces only. The firewall nix-darwin manages filters by application and takes no port list, so the option has no effect there.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.services.ssh.server.ports

Ports the server listens on, passed to services.openssh.ports as a default. The firewall and the fail2ban sshd jail both read the upstream option, so a host that sets services.openssh.ports itself gets the same result. On nix-darwin the server is the macOS Remote Login service, which launchd starts on port 22 alone, so any other list is refused there.

Platforms: NixOS and nix-darwin.

Type: list of 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default:

[
  22
]

Example:

[
  2222
]

Declared by:

othrys.services.ssh.settings

Additional SSH client config blocks, merged with module defaults and written to ~/.ssh/config. Keys are literal OpenSSH directive names. A directive set under "*" replaces the module’s default for that directive and leaves the others in place.

The defaults keep StrictHostKeyChecking ask, so an unknown host still prompts and is never accepted silently. Once knownHosts lists every host this machine connects to, set "*".StrictHostKeyChecking = "yes", which refuses any host that is not listed and ends trust on first use.

Platforms: NixOS and nix-darwin.

Type: attribute set of attribute set of anything

Default:

{ }

Example:

{
  "myhost" = {
    Hostname = "myhost.example.com";
    User = "admin";
  };
}

Declared by:

othrys.services.suricata.enable

Whether to enable Suricata IDS/IPS.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.suricata.enabledSources

suricata-update rule sources to enable (sources needing a secret code are unsupported upstream).

Platforms: NixOS only.

Type: list of string

Default:

[
  "et/open"
]

Declared by:

othrys.services.suricata.package

Suricata package to use.

Platforms: NixOS only.

Type: null or package

Default:

pkgs.suricata

Declared by:

othrys.services.suricata.afPacket.clusterId

af-packet cluster-id (must be unique per Suricata instance on the host).

Platforms: NixOS only.

Type: positive integer, meaning >0

Default:

99

Declared by:

othrys.services.suricata.afPacket.clusterType

af-packet cluster-type, which decides how packets are spread over the capture threads.

Platforms: NixOS only.

Type: one of “cluster_flow”, “cluster_cpu”, “cluster_qm”, “cluster_ebpf”

Default:

"cluster_flow"

Declared by:

othrys.services.suricata.afPacket.copyInterface

Peer interface for the af-packet IPS bridge (posture = ips).

Platforms: NixOS only.

Type: null or string

Default:

null

Example:

"enp1s0f1"

Declared by:

othrys.services.suricata.afPacket.interface

Capture interface for af-packet mode.

Platforms: NixOS only.

Type: null or string

Default:

null

Example:

"enp1s0f0"

Declared by:

othrys.services.suricata.disabledRules

Rule SIDs/patterns to disable (noisy signatures).

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "2013504"
  "2100498"
]

Declared by:

othrys.services.suricata.dropRules

Rules that suricata-update turns from alert into drop, one drop.conf line each: a signature id, or a re: regular expression over the rule text. Only an IPS posture drops; in IDS they stay alerts.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "re:trojan"
  "2019401"
]

Declared by:

othrys.services.suricata.mode

Inline delivery. nfqueue keeps the box an L3 router/NAT (packets are queued to Suricata by an nftables queue rule). af-packet captures on an interface (a transparent L2 bridge when posture = ips).

Platforms: NixOS only.

Type: one of “nfqueue”, “af-packet”

Default:

"nfqueue"

Declared by:

othrys.services.suricata.nfqueue.failOpen

Suricata’s nfq.fail-open. Lets the kernel accept packets when the queue is full, which is the overloaded case, instead of dropping them.

This does not govern what happens when Suricata is not running. That is the bypass flag on the nftables queue verdict, which othrys.services.router sets unconditionally, so a dead IPS passes traffic regardless of this option. Setting it to false does not make a dead Suricata block the link.

Either way the failure mode is uninspected traffic rather than blocked traffic, which is deliberate for a router in the forwarding path.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.suricata.nfqueue.queues

Number of NFQUEUE queues (Suricata runs -q 0 .. -q N-1); pair with queue num 0-<N-1> in nftables and one worker per queue.

Platforms: NixOS only.

Type: positive integer, meaning >0

Default:

1

Declared by:

othrys.services.suricata.offloadInterfaces

Interfaces on which to disable NIC offloads (GRO/GSO/TSO/LRO) before Suricata starts. Required for inline correctness, since offloads create super-sized datagrams the inspection path drops.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "enp1s0f0"
  "enp1s0f1"
]

Declared by:

othrys.services.suricata.posture

IDS alerts only; IPS can drop. Start in IDS, tune, then flip to IPS.

Platforms: NixOS only.

Type: one of “ids”, “ips”

Default:

"ids"

Declared by:

othrys.services.suricata.settings

Extra suricata.yaml settings, deep-merged over (and overriding) the generated config, e.g. threading/affinity, outputs, mpm-algo.

Platforms: NixOS only.

Type: attribute set of anything

Default:

{ }

Example:

{
  mpm-algo = "hs";
  threading.set-cpu-affinity = true;
}

Declared by:

othrys.services.tailscale.enable

Whether to enable Tailscale VPN mesh networking.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.tailscale.acceptDns

Pass –accept-dns=true: let the tailnet control the host’s DNS configuration (MagicDNS). Set to false on hosts running their own resolver (unbound, the router module) or needing split-horizon DNS, since tailnet DNS would override it.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.services.tailscale.acceptRoutes

Pass –accept-routes: install subnet routes advertised by OTHER tailnet nodes. A trust decision, since a compromised or misconfigured peer can redirect this host’s traffic, which is why it is off until a host that needs advertised subnets turns it on.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Declared by:

othrys.services.tailscale.authKeyFile

Path to auth key file for automatic registration.

Platforms: NixOS and nix-darwin.

Type: null or absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Default:

null

Declared by:

othrys.services.tailscale.baseURL

Control server the node registers with, passed as --login-server to tailscale up by the automatic registration, which authKeyFile turns on. A host registered by hand passes the same URL to tailscale up itself, and the module warns when this is set with no key file so that is not forgotten.

Platforms: NixOS and nix-darwin.

Type: null or string

Default:

null

Example:

"https://headscale.example.com"

Declared by:

othrys.services.tailscale.ephemeral

Register as an ephemeral node (deregistered when offline). Usually false for persistent machines. Applies to a node on Tailscale’s own control plane, where it is a parameter of an OAuth client key; with baseURL set, the pre-auth key minted on that server decides.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Declared by:

othrys.services.tailscale.openFirewall

Open the Tailscale UDP port for direct (non-relayed) connections.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.services.tailscale.operator

User allowed to drive tailscale without root, passed as --operator. Null leaves the CLI to root.

Platforms: NixOS and nix-darwin.

Type: null or string

Default:

null

Example:

"alice"

Declared by:

othrys.services.tailscale.ssh

Whether to enable Tailscale SSH server (note: bypasses OpenSSH hardening and fail2ban).

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.traefik.enable

Whether to enable Traefik reverse proxy.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.traefik.acme.enable

Whether to enable automatic TLS via Let’s Encrypt (DNS-01).

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.traefik.acme.caServer

ACME directory URL written to the certificate resolver. Null leaves Traefik on the Let’s Encrypt production directory. Point it at the staging directory while bringing a host up, since production rate-limits failed orders.

Platforms: NixOS only.

Type: null or string

Default:

null

Example:

"https://acme-staging-v02.api.letsencrypt.org/directory"

Declared by:

othrys.services.traefik.acme.dnsProvider

lego DNS provider name. Its credentials are supplied via environmentFiles.

Platforms: NixOS only.

Type: string

Default:

""

Example:

"cloudflare"

Declared by:

othrys.services.traefik.acme.dnsResolvers

DNS servers used to check record propagation.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "1.1.1.1:53"
  "8.8.8.8:53"
]

Declared by:

othrys.services.traefik.acme.email

Contact email for the ACME account.

Platforms: NixOS only.

Type: string

Default:

""

Declared by:

othrys.services.traefik.acme.resolver

Name of the certificate resolver referenced by routers.

Platforms: NixOS only.

Type: string

Default:

"letsencrypt"

Declared by:

othrys.services.traefik.acme.storage

Path to acme.json. Defaults to <dataDir>/acme.json, and must stay under dataDir, which is the directory persisted under impermanence.

Platforms: NixOS only.

Type: null or string

Default:

null

Declared by:

othrys.services.traefik.dashboard.enable

Whether to enable the Traefik dashboard/API.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.traefik.dashboard.insecure

Expose the dashboard on :8080 without auth. Convenient but unsafe, so prefer a secured router. The firewall port stays closed whatever openFirewall says.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.services.traefik.dataDir

Persistent data directory (holds acme.json).

Platforms: NixOS only.

Type: absolute path

Default:

"/var/lib/traefik"

Declared by:

othrys.services.traefik.dynamicConfigOptions

Dynamic configuration (routers, services, middlewares, TLS), merged on top of the generated TLS options and headers middleware.

Platforms: NixOS only.

Type: attribute set of anything

Default:

{ }

Declared by:

othrys.services.traefik.environmentFiles

EnvironmentFiles for the service (e.g. the DNS provider token like CF_DNS_API_TOKEN). Substituted into the static config via envsubst.

Platforms: NixOS only.

Type: list of absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Default:

[ ]

Example:

[ config.sops.secrets."traefik/env".path ]

Declared by:

othrys.services.traefik.forwardedHeaders.trustedIPs

Addresses or CIDR ranges of the proxies in front of Traefik whose X-Forwarded-* headers are kept, written to the web and websecure entrypoints. With the list empty Traefik discards those headers from every peer, which is right for a host that faces the internet directly. Behind a CDN or a load balancer the list holds that proxy’s ranges and nothing wider, since a listed peer can state any client address it likes.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "192.0.2.0/24"
]

Declared by:

othrys.services.traefik.group

Group Traefik runs under (set to “docker” for the Docker provider).

Platforms: NixOS only.

Type: string

Default:

"traefik"

Declared by:

othrys.services.traefik.httpsRedirect

Redirect the web (:80) entrypoint to websecure (:443).

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.traefik.logLevel

Level of Traefik’s own log, written as log.level. Null leaves Traefik’s default of ERROR. This is the log of the proxy itself, and requests go to the access log, which is a separate setting.

Platforms: NixOS only.

Type: null or one of “TRACE”, “DEBUG”, “INFO”, “WARN”, “ERROR”, “FATAL”, “PANIC”

Default:

null

Example:

"INFO"

Declared by:

othrys.services.traefik.openFirewall

Open the web (:80) and websecure (:443) ports. It is also the default of tcpRouters.<name>.openFirewall. The API and dashboard port, :8080, is never opened here, since the insecure dashboard carries no authentication.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.traefik.securityHeaders.enable

Attach a headers middleware to the websecure entrypoint, so every router behind it sends the headers below. A router that needs different values sets its own headers middleware, which runs after this one and wins. Set to false to attach nothing.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.traefik.securityHeaders.contentTypeNosniff

Send X-Content-Type-Options: nosniff.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.traefik.securityHeaders.frameOptions

Value of the X-Frame-Options header. The default lets a site frame its own pages and stops other origins from framing them, which breaks a dashboard embedded from a different host name. null sends no such header.

Platforms: NixOS only.

Type: null or string

Default:

"SAMEORIGIN"

Example:

"DENY"

Declared by:

othrys.services.traefik.securityHeaders.hstsSeconds

max-age of the Strict-Transport-Security header, one year by default. Subdomains are not included and preload is not requested, since both reach past the hosts this proxy serves. 0 sends no HSTS header.

Platforms: NixOS only.

Type: unsigned integer, meaning >=0

Default:

31536000

Declared by:

othrys.services.traefik.staticConfigOptions

Extra static configuration, merged on top of the generated static config.

Platforms: NixOS only.

Type: attribute set of anything

Default:

{ }

Declared by:

othrys.services.traefik.tcpRouters

TCP services behind Traefik, each on an entrypoint of its own and reached by the TLS server name. Each entry writes an entrypoint, a router, a service and, with proxyProtocol, a servers transport, under its own name. A terminating router uses the default TLS options, so tls.sniStrict and tls.minVersion apply to it as they do to the HTTPS routers.

Platforms: NixOS only.

Type: attribute set of (submodule)

Default:

{ }

Example:

{
  soju = {
    entryPoint.address = ":6697";
    domain = "irc.example.com";
    backend = "[::1]:6667";
    proxyProtocol = 2;
  };
}

Declared by:

othrys.services.traefik.tcpRouters.<name>.backend

Address and port Traefik forwards the connection to.

Platforms: NixOS only.

Type: string

Example:

"[::1]:6667"

Declared by:

othrys.services.traefik.tcpRouters.<name>.domain

Name the router answers to, matched as HostSNI against the name the client sends. A client that sends no name is not routed. A terminating router asks the ACME resolver for a certificate for this name.

Platforms: NixOS only.

Type: string

Example:

"irc.example.com"

Declared by:

othrys.services.traefik.tcpRouters.<name>.entryPoint.address

Address of the entrypoint, :<port> for every address or <address>:<port> for one. Ports 80 and 443 belong to web and websecure, and 8080 to the insecure dashboard.

Platforms: NixOS only.

Type: string matching the pattern .*:[0-9]+

Example:

":6697"

Declared by:

othrys.services.traefik.tcpRouters.<name>.entryPoint.name

Name of the entrypoint the router listens on. Each router gets its own.

Platforms: NixOS only.

Type: string

Default:

<router name>

Example:

"ircs"

Declared by:

othrys.services.traefik.tcpRouters.<name>.openFirewall

Open the entrypoint’s port in the NixOS firewall.

Platforms: NixOS only.

Type: boolean

Default:

config.othrys.services.traefik.openFirewall

Declared by:

othrys.services.traefik.tcpRouters.<name>.passthrough

Forward the TLS stream unopened to a backend that terminates TLS itself. Traefik reads only the name from the client’s hello, and requests no certificate. Off by default, so Traefik terminates TLS with the certificate acme.resolver issues.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.services.traefik.tcpRouters.<name>.proxyProtocol

Version of the PROXY protocol header Traefik sends to the backend, so the backend sees the client’s address. Null sends none. The backend has to expect the header from Traefik’s address and from no other peer.

Platforms: NixOS only.

Type: null or one of 1, 2

Default:

null

Example:

2

Declared by:

othrys.services.traefik.tls.minVersion

Lowest TLS version the default TLS options accept. Traefik’s own default admits TLS 1.0 and 1.1. null leaves Traefik’s default in place.

Platforms: NixOS only.

Type: null or one of “VersionTLS12”, “VersionTLS13”

Default:

"VersionTLS12"

Declared by:

othrys.services.traefik.tls.sniStrict

Refuse a TLS connection whose server name matches no certificate, instead of answering with Traefik’s self-signed default certificate. A request made to the bare IP address is refused as well.

On by default when ACME issues the certificates, since every routed host then has one. Off by default otherwise, because a proxy with no certificate of its own would refuse every connection.

Platforms: NixOS only.

Type: boolean

Default:

config.othrys.services.traefik.acme.enable

Declared by:

othrys.services.unbound.enable

Whether to enable Unbound recursive DNS.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.unbound.accessControl

server.access-control entries (subnet + action). The default is derived from interfaces, so a host that listens on 10.0.0.1 answers 10.0.0.0/24 without further setup. A wildcard address or an interface name in interfaces derives nothing, so a host using one sets this itself.

Platforms: NixOS only.

Type: list of string

Default: loopback, then the /24 of each IPv4 address and the /64 of each IPv6 address in interfaces

Example:

[
  "10.0.0.0/24 allow"
]

Declared by:

othrys.services.unbound.forwardTls.enable

Forward all queries to the DoT upstreams over TLS (port 853), instead of recursing.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.services.unbound.forwardTls.upstreams

DoT upstream resolvers (addr@853#hostname).

Platforms: NixOS only.

Type: list of string

Default:

[
  "1.1.1.1@853#cloudflare-dns.com"
  "1.0.0.1@853#cloudflare-dns.com"
  "9.9.9.9@853#dns.quad9.net"
]

Declared by:

othrys.services.unbound.interfaces

Addresses Unbound listens on (server.interface). Replaces upstream’s loopback default, so list loopback when it should stay.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "10.0.0.1"
  "127.0.0.1"
]

Declared by:

othrys.services.unbound.rpz

RPZ blocklist zones (ad/malware blocking). Each url must use https://, and the respip module is added to server.module-config when the list is non-empty.

Platforms: NixOS only.

Type: list of (submodule)

Default:

[ ]

Example:

[{ name = "hagezi"; url = "https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/rpz/pro.txt"; }]

Declared by:

othrys.services.unbound.rpz.*.name

RPZ zone name.

Platforms: NixOS only.

Type: string

Declared by:

othrys.services.unbound.rpz.*.url

URL of the RPZ blocklist to fetch. Must use https://, since the zone rewrites answers for every client.

Platforms: NixOS only.

Type: string

Example:

"https://cdn.jsdelivr.net/gh/hagezi/dns-blocklists@latest/rpz/pro.txt"

Declared by:

othrys.services.unbound.settings

Extra unbound.conf settings, deep-merged over (and overriding) the generated config.

Platforms: NixOS only.

Type: attribute set of anything

Default:

{ }

Declared by:

othrys.services.victorialogs.enable

Whether to enable VictoriaLogs log database (LogsQL, journald ingestion).

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.victorialogs.collectJournal

Ship this host’s systemd journal into VictoriaLogs via systemd-journal-upload.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.victorialogs.extraFlags

Extra command-line flags passed to VictoriaLogs.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Declared by:

othrys.services.victorialogs.listenAddress

Address VictoriaLogs listens on. Loopback by default, expecting a reverse proxy in front.

Platforms: NixOS only.

Type: string

Default:

"127.0.0.1"

Declared by:

othrys.services.victorialogs.openFirewall

Open port in the firewall. Leave off when a reverse proxy fronts VictoriaLogs (the default).

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.services.victorialogs.port

Port VictoriaLogs listens on (HTTP API: ingestion and LogsQL queries).

Platforms: NixOS only.

Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default:

9428

Declared by:

othrys.services.victorialogs.retentionPeriod

How long to retain logs (suffixes: h/d/w/y; a bare number is months). Null uses the upstream default (7 days).

Platforms: NixOS only.

Type: null or string

Default:

null

Example:

"12w"

Declared by:

othrys.services.victoriametrics.enable

Whether to enable VictoriaMetrics single-node time-series database (Prometheus-compatible).

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.victoriametrics.extraFlags

Extra command-line flags passed to VictoriaMetrics.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "-dedup.minScrapeInterval=15s"
]

Declared by:

othrys.services.victoriametrics.listenAddress

Address VictoriaMetrics listens on. Loopback by default, expecting a reverse proxy in front; set to 0.0.0.0 to expose it directly.

Platforms: NixOS only.

Type: string

Default:

"127.0.0.1"

Declared by:

othrys.services.victoriametrics.openFirewall

Open port in the firewall. Leave off when a reverse proxy fronts VictoriaMetrics (the default).

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.services.victoriametrics.port

Port VictoriaMetrics listens on (HTTP API: scrape, remote-write, query).

Platforms: NixOS only.

Type: 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default:

8428

Declared by:

othrys.services.victoriametrics.retentionPeriod

How long to retain samples (suffixes s/h/d/w/y, a bare number is months). Null uses the upstream default (1 month), and long-term storage hosts usually want more.

Platforms: NixOS only.

Type: null or string

Default:

null

Example:

"1y"

Declared by:

othrys.services.victoriametrics.scrapeConfigs

Additional Prometheus-style scrape configs appended to the generated set.

Platforms: NixOS only.

Type: list of attribute set of anything

Default:

[ ]

Example:

[
  {
    job_name = "headscale";
    static_configs = [{targets = ["127.0.0.1:9090"];}];
  }
]

Declared by:

othrys.services.victoriametrics.scrapeNodeExporter

Scrape the local node exporter (at othrys.services.monitoring.nodePort). Follows the monitoring module by default so enabling both wires them together.

Platforms: NixOS only.

Type: boolean

Default:

config.othrys.services.monitoring.enable

Declared by:

othrys.services.virtualcamera.enable

Whether to enable Virtual camera (v4l2loopback).

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.virtualcamera.cardLabel

Label of the virtual camera device. Letters, digits, spaces, _, . and - only. Each further device carries the label followed by its number.

Platforms: NixOS only.

Type: string matching the pattern [A-Za-z0-9 _.-]+

Default:

"Virtual Camera"

Declared by:

othrys.services.virtualcamera.devices

Number of virtual camera devices to create.

Platforms: NixOS only.

Type: positive integer, meaning >0

Default:

1

Declared by:

othrys.services.virtualcamera.videoNr

Video device number of the first virtual camera, which appears as /dev/video<n>. Each further device takes the next number.

Platforms: NixOS only.

Type: unsigned integer, meaning >=0

Default:

10

Declared by:

othrys.services.wireguard.enable

Whether to enable raw WireGuard interfaces (coordination-server-free VPN links).

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.services.wireguard.interfaces

WireGuard interfaces (maps to networking.wireguard.interfaces).

Platforms: NixOS only.

Type: attribute set of (submodule)

Default:

{ }

Example:

{
  wg0 = {
    privateKeyFile = config.sops.secrets."wireguard/wg0".path;
    ips = ["10.100.0.2/24"];
    listenPort = 51820;
    openFirewall = true;
    peers = [
      {
        publicKey = "<peer public key>";
        allowedIPs = ["10.100.0.0/24"];
        endpoint = "vpn.example.com:51820";
        persistentKeepalive = 25;
      }
    ];
  };
}

Declared by:

othrys.services.wireguard.interfaces.<name>.allowedIPsAsRoutes

Add a route for every peer’s allowedIPs to table. Set to false where the routes are managed elsewhere, by a routing daemon or by the host’s own rules, and allowedIPs should only say which sources a peer may send from.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.services.wireguard.interfaces.<name>.fwMark

Firewall mark set on the encrypted packets this interface sends. Policy routing uses it to keep the tunnel’s own packets out of the tunnel when allowedIPs covers the default route.

Platforms: NixOS only.

Type: null or string

Default:

null

Example:

"0x6e6978"

Declared by:

othrys.services.wireguard.interfaces.<name>.ips

Addresses (CIDR) assigned to the interface.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Declared by:

othrys.services.wireguard.interfaces.<name>.listenPort

UDP listen port. Null picks a random port (fine for outbound-only peers).

Platforms: NixOS only.

Type: null or 16 bit unsigned integer; between 0 and 65535 (both inclusive)

Default:

null

Declared by:

othrys.services.wireguard.interfaces.<name>.mtu

MTU of the interface in bytes. Null leaves the WireGuard default of 1420, which is too large where the path underneath carries less than 1500.

Platforms: NixOS only.

Type: null or (positive integer, meaning >0)

Default:

null

Example:

1280

Declared by:

othrys.services.wireguard.interfaces.<name>.openFirewall

Open listenPort in the firewall (requires listenPort).

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.services.wireguard.interfaces.<name>.peers

Peers for this interface.

Platforms: NixOS only.

Type: list of (submodule)

Default:

[ ]

Declared by:

othrys.services.wireguard.interfaces.<name>.peers.*.allowedIPs

Networks routed to (and accepted from) this peer.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Declared by:

othrys.services.wireguard.interfaces.<name>.peers.*.endpoint

Peer endpoint. Null for peers that dial in.

Platforms: NixOS only.

Type: null or string

Default:

null

Example:

"vpn.example.com:51820"

Declared by:

othrys.services.wireguard.interfaces.<name>.peers.*.persistentKeepalive

Keepalive interval in seconds (needed behind NAT).

Platforms: NixOS only.

Type: null or (positive integer, meaning >0)

Default:

null

Example:

25

Declared by:

othrys.services.wireguard.interfaces.<name>.peers.*.presharedKeyFile

Path to a runtime file holding the preshared key for this peer, from wg genpsk (a secrets-provider path). Both ends must hold the same key.

Platforms: NixOS only.

Type: null or absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Default:

null

Example:

config.sops.secrets."wireguard/wg0-psk".path

Declared by:

othrys.services.wireguard.interfaces.<name>.peers.*.publicKey

Peer public key.

Platforms: NixOS only.

Type: string

Declared by:

othrys.services.wireguard.interfaces.<name>.privateKeyFile

Path to a runtime file holding the interface private key (a secrets-provider path).

Platforms: NixOS only.

Type: absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Declared by:

othrys.services.wireguard.interfaces.<name>.table

Routing table the routes for allowedIPs are added to, by name or number. Anything but main leaves the default route alone until an ip rule selects the table.

Platforms: NixOS only.

Type: string

Default:

"main"

Example:

"51820"

Declared by:

othrys.system.autoUpgrade.enable

Whether to enable unattended nixos-rebuild from the host configuration flake.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.system.autoUpgrade.allowReboot

Reboot when the new generation requires it (kernel/systemd changes). Off by default, so enable deliberately with a rebootWindow.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.system.autoUpgrade.dates

systemd calendar expression for the upgrade timer (daily at 04:00 by default, since servers want security fixes promptly).

Platforms: NixOS only.

Type: string

Default:

"04:00"

Declared by:

othrys.system.autoUpgrade.flags

Extra flags passed to nixos-rebuild.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Declared by:

othrys.system.autoUpgrade.flake

Flake URI the host upgrades from (the host configuration flake, not this library). Identity-shaped, set from the consuming host. Private repos need fetch credentials (e.g. a netrc via secrets). Nothing checks a signature on this path. Leave it null and use verify for that.

Platforms: NixOS only.

Type: null or string

Default:

null

Example:

"github:example/hosts"

Declared by:

othrys.system.autoUpgrade.randomizedDelaySec

Random delay added to the timer so a fleet doesn’t hit the flake host simultaneously.

Platforms: NixOS only.

Type: string

Default:

"30min"

Declared by:

othrys.system.autoUpgrade.rebootWindow

Time window reboots are confined to (with allowReboot). Null reboots whenever the upgrade lands.

Platforms: NixOS only.

Type: null or (attribute set of string)

Default:

null

Example:

{
  lower = "03:00";
  upper = "05:00";
}

Declared by:

othrys.system.autoUpgrade.verify.enable

Whether to enable signature verification of the host configuration repository before every upgrade.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.system.autoUpgrade.verify.allowedSigners

OpenSSH allowed signers file, used when format is ssh. Path literals and runtime path strings are handled as in publicKeys.

Platforms: NixOS only.

Type: null or absolute path

Default:

null

Example:

./keys/allowed_signers

Declared by:

othrys.system.autoUpgrade.verify.attribute

The nixosConfigurations attribute of the verified repository that the host builds.

Platforms: NixOS only.

Type: string

Default:

config.networking.hostName

Declared by:

othrys.system.autoUpgrade.verify.format

Signature format that is accepted. A signature in the other format fails verification.

Platforms: NixOS only.

Type: one of “openpgp”, “ssh”

Default:

"openpgp"

Declared by:

othrys.system.autoUpgrade.verify.maxAge

Days after which a verified commit counts as stale. A source that stops advancing verifies cleanly every night, so once the commit the host follows is older than this the unit logs a warning and, with the notify module on, sends a notification. The upgrade itself still runs. Null turns the report off.

Platforms: NixOS only.

Type: null or (positive integer, meaning >0)

Default:

30

Example:

90

Declared by:

othrys.system.autoUpgrade.verify.mode

What carries the signature. commit verifies the tip of ref with git verify-commit. tag takes the highest tag matching tagPattern by version sort, verifies it with git verify-tag and upgrades to the commit it points at, so an unsigned newer tag stops upgrades until it is removed.

Platforms: NixOS only.

Type: one of “commit”, “tag”

Default:

"commit"

Declared by:

othrys.system.autoUpgrade.verify.publicKeys

ASCII-armoured OpenPGP public key files, used when format is openpgp. These are the only keys whose signatures pass. A path literal is copied into the store, while a string such as “/run/secrets/signer.asc” is read at run time.

Platforms: NixOS only.

Type: list of absolute path

Default:

[ ]

Example:

[./keys/alice.asc]

Declared by:

othrys.system.autoUpgrade.verify.ref

Branch followed in commit mode. Its tip has to carry a good signature.

Platforms: NixOS only.

Type: string

Default:

"main"

Declared by:

othrys.system.autoUpgrade.verify.tagPattern

Glob selecting the tags considered in tag mode.

Platforms: NixOS only.

Type: string

Default:

"v*"

Declared by:

othrys.system.autoUpgrade.verify.url

Git URL the verify unit fetches. The fetch is anonymous, so the repository has to be readable without credentials.

Platforms: NixOS only.

Type: string

Example:

"https://example.com/alice/hosts.git"

Declared by:

othrys.system.bootloader.enable

Whether to enable Bootloader configuration.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.system.bootloader.extraEntries

Extra boot entries (e.g., Windows dual-boot, for Limine).

Platforms: NixOS only.

Type: strings concatenated with “\n”

Default:

""

Example:

''
  /Windows 11
      protocol: efi
      path: uuid(0123-ABCD):/EFI/Microsoft/Boot/bootmgfw.efi
''

Declared by:

othrys.system.bootloader.maxGenerations

How many of the newest generations the bootloader keeps on the boot partition and lists in its menu. Generations beyond it stay in the system profile and only leave the boot menu.

Every listed generation has its kernel and its initrd copied to the boot partition, and with no limit that is every generation in the profile, so the partition fills. Limine removes unused files only at the end of an install that succeeds, so once the partition is full a switch can no longer complete and nothing frees the space.

An install copies the new generation before it removes an old one, so the partition has to hold this number plus one. A generation costs the size of its kernel plus its initrd. At 40M a generation, 5 needs 240M. A host with a 200M initrd needs 1.3G for the same 5, so on a 1G partition it sets 3. du -sh /boot/limine/kernels shows the cost on a running Limine host.

null leaves the limit to the bootloader’s own default, which is no limit for Limine and systemd-boot and 100 for GRUB.

Platforms: NixOS only.

Type: null or (positive integer, meaning >0)

Default:

5

Declared by:

othrys.system.bootloader.secureBoot

Sign the boot chain with the sbctl keys in /var/lib/sbctl. Limine signs natively. systemd-boot is signed through lanzaboote, which the consuming flake must import as lanzaboote.nixosModules.lanzaboote. GRUB and "none" are rejected. The keys must exist before the first rebuild, and the firmware enforces nothing until they are enrolled.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.system.bootloader.type

Bootloader to use.

Platforms: NixOS only.

Type: one of “limine”, “systemd-boot”, “grub”, “none”

Default:

"limine"

Declared by:

othrys.system.defaultEditor

Default editor, used for EDITOR/VISUAL and git’s core.editor. An editor module that wants to be the default sets it with mkDefault.

Platforms: NixOS and nix-darwin.

Type: string

Default:

"vim"

Declared by:

othrys.system.disko.enable

Whether to enable Disko declarative disk configuration.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.system.disko.bootSize

EFI boot partition size.

Platforms: NixOS only.

Type: string

Default:

"1G"

Declared by:

othrys.system.disko.btrfs.compression

BTRFS compression algorithm for root subvolume.

Platforms: NixOS only.

Type: string

Default:

"zstd"

Declared by:

othrys.system.disko.btrfs.mountOptions

Common BTRFS mount options applied to all subvolumes.

Platforms: NixOS only.

Type: list of string

Default:

[
  "noatime"
  "space_cache=v2"
]

Declared by:

othrys.system.disko.device

Disk device path. Use /dev/disk/by-id/ for reliable identification. Find your disk ID with: ls -l /dev/disk/by-id/

A path outside /dev/disk/, such as /dev/sda, evaluates with a warning. The kernel hands those names out in probe order, so the same name can be another disk on the next boot.

Platforms: NixOS only.

Type: string

Example:

"/dev/disk/by-id/nvme-VENDOR_MODEL_XXXXXXXXXXXXX"

Declared by:

othrys.system.disko.luks.allowDiscards

Pass TRIM requests through dm-crypt to the SSD. The requests show an observer of the raw disk which blocks are free, which is the price of keeping the drive’s performance. services.fstrim.enable follows this option, since the passthrough alone discards nothing.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.system.disko.luks.bypassWorkqueues

Bypass dm-crypt workqueues for better SSD performance.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.system.disko.luks.fido2.enable

Whether to enable FIDO2/YubiKey unlock for the encrypted root (enrolled per-key via just luks-enroll; the passphrase stays as break-glass recovery).

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.system.disko.luks.name

Name for the LUKS encrypted root device (appears as /dev/mapper/<name>).

Platforms: NixOS only.

Type: string

Default:

"cryptroot"

Declared by:

othrys.system.disko.luks.passwordFile

Path to a file containing the LUKS passphrase used when disko first formats the disk. Leave null (default) to be prompted interactively at format time, recommended since at install time sops secrets do not yet exist on the target.

With luks.fido2.enable, this passphrase becomes the break-glass recovery keyslot: day-to-day unlock is via YubiKey, and the passphrase is only needed if every enrolled key is unavailable. Boot always falls back to this passphrase if no token is present.

Platforms: NixOS only.

Type: null or absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Default:

null

Example:

config.sops.secrets."security/boot/password".path

Declared by:

othrys.system.disko.luks.swapName

Name for the LUKS encrypted swap device (used only when swap.randomEncryption is false).

Platforms: NixOS only.

Type: string

Default:

"cryptswap"

Declared by:

othrys.system.disko.swap.randomEncryption

Encrypt swap with an ephemeral key generated on each boot instead of a persistent LUKS passphrase. Avoids a second unlock prompt at boot (recommended with FIDO2) at the cost of hibernation/resume. Defaults to luks.fido2.enable.

Platforms: NixOS only.

Type: boolean

Default:

config.othrys.system.disko.luks.fido2.enable

Declared by:

othrys.system.disko.swapSize

Swap partition size. Recommendations:

  • For hibernation: swap >= RAM size
  • Without hibernation: 4-8GB is usually sufficient

Platforms: NixOS only.

Type: string

Default:

"8G"

Example:

"16G"

Declared by:

othrys.system.git.enable

Whether to enable Git version control.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.system.git.aliases

Git aliases. Override or set to {} to opt out.

Platforms: NixOS and nix-darwin.

Type: attribute set of string

Default:

{
  br = "branch";
  ci = "commit";
  co = "checkout";
  graph = "log --graph --oneline --decorate";
  last = "log -1 HEAD";
  st = "status";
  unstage = "reset HEAD --";
}

Declared by:

othrys.system.git.defaultBranch

Default branch name for new repositories.

Platforms: NixOS and nix-darwin.

Type: string

Default:

"main"

Declared by:

othrys.system.git.email

Git user email for commits. Required, together with name, on a host where Home Manager manages the primary user.

Platforms: NixOS and nix-darwin.

Type: null or string

Default:

null

Example:

"alice@example.com"

Declared by:

othrys.system.git.name

Git user name for commits. Required, together with email, on a host where Home Manager manages the primary user, since that is where the identity is written. A host without a managed user installs git and reads neither.

Platforms: NixOS and nix-darwin.

Type: null or string

Default:

null

Example:

"alice"

Declared by:

othrys.system.hardening.enable

Apply the low-cost kernel and network sysctl hardening profile. The profile is opt-in, and nothing is set while this is off.

Every sysctl is written below the priority of a plain assignment, so a host overrides any single value by setting the same key under boot.kernel.sysctl. The values restrict kernel pointer and dmesg exposure, unprivileged BPF, ptrace and kexec, and turn off ICMP redirects and source routing.

rp_filter is set to loose mode (2) rather than strict (1). Strict mode drops replies that arrive on a different interface from the route back to the sender, which breaks Tailscale exit nodes and multi-homed routers. It also overrides the loose networking.firewall.checkReversePath that the Tailscale module selects, since the kernel check runs regardless of the firewall. othrys.services.router assigns loose mode to all and default as well, and strict mode to its WAN interface alone.

lockKernelModules and protectKernelImage are separate options because each one breaks something, and neither is implied by enable.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.system.hardening.kernelParams

Kernel command-line parameters the profile adds. The defaults cost nothing measurable: slab_nomerge keeps caches apart so an overflow in one stays in it, page_alloc.shuffle randomises the page allocator’s free lists, and vsyscall=none removes the fixed-address legacy syscall page. init_on_free and debugfs=off are not here, since the first costs on every free and the second breaks tooling, and a host that wants them adds them. Set the list to change it, since a list option merges rather than overrides.

Platforms: NixOS only.

Type: list of string

Default:

[
  "slab_nomerge"
  "page_alloc.shuffle=1"
  "vsyscall=none"
]

Declared by:

othrys.system.hardening.lockKernelModules

Set security.lockKernelModules, which disables kernel module loading once the system has booted.

No module can load after boot. Hardware plugged in later, and VPN or filesystem modules that were not loaded at boot, stop working until the next reboot. List every module the host needs later in boot.kernelModules so it is loaded before the lock.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.system.hardening.protectKernelImage

Set security.protectKernelImage, which prevents the running kernel image from being replaced.

Hibernation and kexec are disabled. Evaluation fails on a host that sets boot.resumeDevice or passes resume= in boot.kernelParams, since such a host would lose the ability to resume.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.system.impermanence.enable

Whether to enable Impermanence (ephemeral root with opt-in persistence).

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.system.impermanence.device

Block device holding the btrfs filesystem with the root and persist subvolumes. The wipe unit waits for this device in the initrd and mounts its top-level subvolume.

The option has to be set on a host that enables impermanence. With nixosModules.disko imported and othrys.system.disko.enable on, the layout fills it with its LUKS mapping, /dev/mapper/<luks.name>, as a default. A host that partitions any other way names the device here, which is the LUKS mapping for an encrypted root and the partition itself for a plain one.

Platforms: NixOS only.

Type: null or string

Default:

null

Example:

"/dev/disk/by-partlabel/root"

Declared by:

othrys.system.impermanence.persistRoot

Mountpoint of the persistent volume. nixosModules.impermanence binds everything the othrys modules declare as persistent from this path, and the disko layout mounts the persist subvolume here, so one option moves the whole persistence surface. The btrfs subvolume itself is still named persist (the boot-wipe script addresses subvolumes, not mounts).

Platforms: NixOS only.

Type: string

Default:

"/persist"

Declared by:

othrys.system.impermanence.retentionDays

Days to keep old root snapshots in /btrfs_tmp/old_roots before deletion.

Platforms: NixOS only.

Type: unsigned integer, meaning >=0

Default:

30

Declared by:

othrys.system.kernel.enable

Whether to enable kernel package selection (disabled = NixOS default kernel).

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.system.kernel.package

Kernel package set to use (e.g., pkgs.linuxPackages_latest, pkgs.linuxPackages_lts).

Platforms: NixOS only.

Type: raw value

Default:

pkgs.linuxPackages_latest

Declared by:

othrys.system.locale.enable

Whether to enable Locale and regional settings.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.system.locale.console.font

Console font.

Platforms: NixOS and nix-darwin.

Type: string

Default:

"Lat2-Terminus16"

Declared by:

othrys.system.locale.console.keyMap

Console keyboard layout.

Platforms: NixOS and nix-darwin.

Type: string

Default:

"us"

Declared by:

othrys.system.locale.locale

System locale.

Platforms: NixOS and nix-darwin.

Type: string

Default:

"en_US.UTF-8"

Declared by:

othrys.system.locale.timezone

System timezone.

Platforms: NixOS and nix-darwin.

Type: string

Default:

"UTC"

Example:

"America/New_York"

Declared by:

othrys.system.networking.enable

Whether to enable systemd-networkd networking.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.system.networking.bridges

Bridge netdevs; enslave interfaces to them via interfaces.<name>.bridge.

Platforms: NixOS only.

Type: attribute set of (submodule)

Default:

{ }

Example:

{ br-lan.address = ["10.0.0.1/24"]; }

Declared by:

othrys.system.networking.bridges.<name>.address

Static addresses (CIDR) assigned to the bridge itself.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "10.0.0.1/24"
]

Declared by:

othrys.system.networking.interfaces

Per-interface network configurations.

Platforms: NixOS only.

Type: attribute set of (submodule)

Default:

{ }

Example:

{
  wan = {
    match = "enp1s0f0";
    dhcp = true;
    requiredForOnline = "routable";
  };
  lan-port = {
    match = "enp1s0f1";
    bridge = "br-lan";
    requiredForOnline = "enslaved";
  };
}

Declared by:

othrys.system.networking.interfaces.<name>.address

Static addresses (CIDR) to assign to the interface.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "10.0.0.1/24"
]

Declared by:

othrys.system.networking.interfaces.<name>.bridge

Enslave this interface to the named bridge. The bridge has to be declared, under bridges or as a bridge netdev in systemd.network.netdevs, or evaluation fails naming it.

Platforms: NixOS only.

Type: null or string

Default:

null

Declared by:

othrys.system.networking.interfaces.<name>.dhcp

Enable DHCPv4 on this interface, by setting systemd-networkd’s DHCP = "ipv4".

This governs IPv4 alone. Turning it off does not make the interface statically addressed, since ipv6 independently controls Router Advertisements and leaves the interface with SLAAC addresses. An interface with no automatic addressing at all needs dhcp = false and ipv6 = false together.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.system.networking.interfaces.<name>.ipv6

Accept IPv6 Router Advertisements, which is how the interface picks up SLAAC addresses and a default route. Independent of dhcp, which covers IPv4 only.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.system.networking.interfaces.<name>.match

Interface match pattern (name or glob).

Platforms: NixOS only.

Type: string

Example:

"enp5s0"

Declared by:

othrys.system.networking.interfaces.<name>.requiredForOnline

When this interface counts as ‘online’ for network-online.target (use ‘enslaved’ for bridge members).

Platforms: NixOS only.

Type: one of “routable”, “carrier”, “degraded”, “enslaved”, “no”

Default:

"routable"

Declared by:

othrys.system.networking.interfaces.<name>.vlans

VLAN netdevs carried on this interface, which makes it a trunk port. Each has to be declared, under vlans or as a vlan netdev in systemd.network.netdevs, or evaluation fails naming it.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Declared by:

othrys.system.networking.vlans

VLAN netdevs; carry them on a trunk via interfaces.<name>.vlans.

Platforms: NixOS only.

Type: attribute set of (submodule)

Default:

{ }

Example:

{ vlan100 = { id = 100; address = ["10.100.0.1/24"]; }; }

Declared by:

othrys.system.networking.vlans.<name>.address

Static addresses (CIDR) assigned to the VLAN interface.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Declared by:

othrys.system.networking.vlans.<name>.id

802.1Q VLAN ID.

Platforms: NixOS only.

Type: integer between 1 and 4094 (both inclusive)

Declared by:

othrys.system.networking.waitOnline.enable

Wait for network to be online before reaching network-online.target.

Platforms: NixOS only.

Type: boolean

Default:

true

Declared by:

othrys.system.networking.waitOnline.timeout

Seconds to wait for network before giving up.

Platforms: NixOS only.

Type: unsigned integer, meaning >=0

Default:

10

Declared by:

othrys.system.nix.enable

Whether to enable Nix package manager configuration.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.system.nix.allowUnfree

Allow unfree packages, by writing nixpkgs.config.allowUnfree. A policy decision, not a capability, so it defaults to false and hosts opt in. Hosts that instantiate nixpkgs themselves must set the policy on that instance instead, since nixpkgs.config is ignored when nixpkgs.pkgs is defined.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Declared by:

othrys.system.nix.cachix.enable

Whether to enable Cachix binary cache.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.system.nix.cachix.authTokenFile

Path to file containing Cachix auth token for pushing.

Platforms: NixOS and nix-darwin.

Type: null or absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Default:

null

Example:

config.sops.secrets."system/cachix/auth-token".path

Declared by:

othrys.system.nix.cachix.name

Cachix cache name.

Platforms: NixOS and nix-darwin.

Type: string

Default:

""

Example:

"my-cache"

Declared by:

othrys.system.nix.cachix.publicKey

Cachix cache public key for verification.

Platforms: NixOS and nix-darwin.

Type: string

Default:

""

Example:

"my-cache.cachix.org-1:XXXXXX..."

Declared by:

othrys.system.nix.communityCache

Trust nix-community.cachix.org as a substituter. A trusted cache can serve any store path, so it is a trust root, and this one is added only when a host asks. The hyprland and niri caches are added with their compositors, since those flakes build nothing from cache.nixos.org, and cache.numtide.com with the AI modules whose package comes from the llm-agents input.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Declared by:

othrys.system.nix.extraSubstituters

Additional binary cache substituters.

Platforms: NixOS and nix-darwin.

Type: list of string

Default:

[ ]

Declared by:

othrys.system.nix.extraTrustedPublicKeys

Additional trusted public keys for the substituters.

Platforms: NixOS and nix-darwin.

Type: list of string

Default:

[ ]

Declared by:

othrys.system.nix.gc.automatic

Enable automatic garbage collection.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.system.nix.gc.dates

When to run garbage collection.

Platforms: NixOS and nix-darwin.

Type: string

Default:

"weekly"

Declared by:

othrys.system.nix.gc.olderThan

Delete generations older than this.

Platforms: NixOS and nix-darwin.

Type: string

Default:

"7d"

Declared by:

othrys.system.nix.globalRegistry

Let Nix fetch the global flake registry, which resolves names such as home-manager or flake-utils to whatever the registry’s maintainers point them at that day. Off, only the entries the host declares resolve, among them nixpkgs, pinned to the host’s own input. A full reference such as github:owner/repo is unaffected.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Declared by:

othrys.system.nix.nh.enable

Whether to enable nh (Nix CLI helper: nicer rebuild output + retention-aware GC).

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Example:

true

Declared by:

othrys.system.nix.nh.clean.enable

Whether to enable periodic nh clean all (retention-aware; supersedes the timer-based nix.gc).

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Example:

true

Declared by:

othrys.system.nix.nh.clean.extraArgs

Retention arguments passed to nh clean all.

Platforms: NixOS and nix-darwin.

Type: string

Default:

"--keep 5 --keep-since 7d"

Declared by:

othrys.system.nix.nh.flake

Absolute path nh uses as its default flake (NH_FLAKE), e.g. for nh os switch. Null leaves NH_FLAKE unset.

Platforms: NixOS and nix-darwin.

Type: null or string

Default:

null

Example:

"/home/alice/nixos"

Declared by:

othrys.system.nix.stateVersion

NixOS and home-manager state version, recording the release a host was first installed at. It governs the defaults of stateful services and is not a version to keep current, so set it once at install and leave it. This option is mandatory.

Platforms: NixOS and nix-darwin.

Type: string

Example:

"26.05"

Declared by:

othrys.system.nix.trustedUsers

nix.settings.trusted-users. A trusted user can set any substituter and import unsigned store paths, which is root over the store and so over the host, with no password and no YubiKey in the way. Root alone by default. A host that wants its administrators trusted adds “@wheel”, and nixos-rebuild switch through sudo needs nothing, since it runs as root.

Platforms: NixOS and nix-darwin.

Type: list of string

Default:

[
  "root"
]

Declared by:

othrys.system.persistence.enable

Whether to enable System-critical persistence declarations.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.system.secrets.enable

Whether to enable sops-nix secrets infrastructure.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.system.secrets.ageIdentityFile

Runtime path to an age identity file, pointed at by SOPS_AGE_KEY_FILE for manual sops editing. The required form for an identity that contains key material, since the file is read from the secrets provider at use time and nothing is copied into the store.

Platforms: NixOS and nix-darwin.

Type: null or absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Default:

null

Example:

"/run/secrets/sops/age-identity"

Declared by:

othrys.system.secrets.ageIdentityStubs

Age identity lines for manual sops editing, written to ~/.config/sops/age/keys.txt.

The content becomes a world-readable Nix store path, so this option is safe only for identities that hold no key material on their own. An age-plugin-yubikey stub qualifies, since the private key never leaves the token and the stub is only a pointer to it. A raw AGE-SECRET-KEY-1... does not, and an assertion rejects one. Use ageIdentityFile for anything secret.

Platforms: NixOS and nix-darwin.

Type: null or strings concatenated with “\n”

Default:

null

Example:

''
  #recipient: age1yubikey1qw3na0f9example...
  AGE-PLUGIN-YUBIKEY-1EXAMPLE...
''

Declared by:

othrys.system.secrets.secretFiles

Encrypted sops files, read from an optional secrets flake input in the consuming flake. othrys declares no such input itself.

The contract is that when a consumer declares an input named secrets, it exposes secretFiles as an attrset of names to encrypted files, for example { common = ./common.yaml; host-atlas = ./atlas.yaml; }. Declaring no secrets input is fine and leaves this empty. Declaring one that does not match the shape is an evaluation error rather than a silently empty attrset.

Platforms: NixOS and nix-darwin.

Type: attribute set of absolute path (read only)

Default:

inputs.secrets.secretFiles, or {} when no secrets input is declared

Declared by:

othrys.system.shell.bash.enable

Whether to enable Bash with safe defaults.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.system.shell.starship.enable

Whether to enable Starship prompt.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.system.shell.zsh.enable

Whether to enable Zsh shell with full configuration.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.system.shell.zsh.aliasPresets.ansible

Enable the ansible shorthand (ap, al, av) alias preset.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.system.shell.zsh.aliasPresets.clipboard

Enable the wayland clipboard (pbcopy/pbpaste -> wl-copy/wl-paste) alias preset.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

config.othrys.desktop.graphical

Declared by:

othrys.system.shell.zsh.aliasPresets.docker

Enable the docker shorthand (d, dc, dps, …) alias preset.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.system.shell.zsh.aliasPresets.editor

Enable the editor shortcuts (v/vim/vi -> defaultEditor) alias preset.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.system.shell.zsh.aliasPresets.git

Enable the git shorthand (g, gs, ga, gc, …) alias preset.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.system.shell.zsh.aliasPresets.jvm

Enable the maven/gradle shorthand alias preset.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.system.shell.zsh.aliasPresets.modernUnix

Enable the modern-unix replacements (eza ls, bat cat, colored grep/diff) alias preset.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.system.shell.zsh.aliasPresets.navigation

Enable the directory navigation (…, …, …) alias preset.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.system.shell.zsh.aliasPresets.nix

Enable the Nix workflow (rebuild, nix-search, nix-clean) alias preset.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.system.shell.zsh.aliasPresets.node

Enable the npm/yarn/pnpm shorthand alias preset.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.system.shell.zsh.aliasPresets.opentofu

Enable the opentofu shorthand (tf, tfi, tfp, …) alias preset.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.system.shell.zsh.aliasPresets.python

Enable the python/uv shorthand (py, pip, venv) alias preset.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.system.shell.zsh.extraAliases

Additional shell aliases merged over the presets.

Platforms: NixOS and nix-darwin.

Type: attribute set of string

Default:

{ }

Declared by:

othrys.system.shell.zsh.persistCompdump

Whether to persist .zcompdump across reboots.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Declared by:

othrys.system.stylix.enable

Whether to enable Stylix system-wide theming, configured from othrys.theme.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.system.stylix.gui.enable

Theme the graphical surface too: curated fonts, cursor, GTK, and per-user icon/cursor config. Off, Stylix still themes the console and Plymouth (the headless-relevant targets) without dragging the GUI font/cursor/GTK closure onto servers. On nix-darwin it sets the fonts alone, since Stylix declares no cursor or console target there and the adapter turns the user’s GTK target off.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

config.othrys.desktop.graphical

Declared by:

othrys.system.user.name

Login name of the primary user account. Modules that create per-user state (home-manager, persistence, git, …) read this value. This option is mandatory, so set it in your host configuration.

The name starts with a lowercase letter or an underscore, and continues with lowercase letters, digits, underscores and hyphens. Any other value is refused at evaluation.

Platforms: NixOS and nix-darwin.

Type: string matching the pattern [a-z_][a-z0-9_-]*

Example:

"alice"

Declared by:

othrys.system.users.enable

Whether to enable User account configuration.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.system.users.defaultShell

Default shell for the user.

Platforms: NixOS and nix-darwin.

Type: package

Default:

pkgs.bash

Declared by:

othrys.system.users.extraGroups

Additional groups for the user, beside wheel when the wheel option is on.

Platforms: NixOS and nix-darwin.

Type: list of string

Default:

[ ]

Declared by:

othrys.system.users.homeManaged

Whether home-manager manages the primary user (derived; do not set). True when the account exists, homeManager.enable is on and the host imports nixosModules.home beside the Home Manager module.

Platforms: NixOS and nix-darwin.

Type: boolean (read only)

Default:

othrys.system.users.enable && othrys.system.users.homeManager.enable, on a host that imports nixosModules.home

Declared by:

othrys.system.users.homeManager.enable

Whether to enable home-manager management of the primary user’s environment.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Example:

true

Declared by:

othrys.system.users.initialHashedPassword

Hashed password used to bootstrap the account on first boot, for the window before a secrets provider is available. Generate one with mkpasswd -m yescrypt.

The hash is written into the world-readable Nix store and stays there for the life of every generation that references it, so treat it as public and offline-crackable. It is a bootstrap mechanism, and NixOS does not clear or expire it. Move the host to passwordFile once secrets decrypt on boot.

Platforms: NixOS and nix-darwin.

Type: null or string

Default:

null

Example:

"$y$j9T$..."

Declared by:

othrys.system.users.mutableUsers

users.mutableUsers. False keeps accounts fully declarative, so passwd and useradd changes do not survive a rebuild. Set it to true on a host where accounts are managed outside Nix.

This is stated rather than inferred. It was previously derived from whether passwordFile happened to be null, which flipped a security property as a side effect of an unrelated option.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

false

Declared by:

othrys.system.users.passwordFile

Path to a runtime file holding the hashed password, injected by the host configuration. The preferred form, since nothing reaches the store.

The file is read in the users activation step, before ordinary secrets are installed. With sops-nix only a secret declared with neededForUsers = true exists in time, and such a secret lives under /run/secrets-for-users/, not /run/secrets/. A path that is absent when the step runs leaves the account with no usable password, and the module warns on a /run/secrets/ prefix for that reason.

Platforms: NixOS and nix-darwin.

Type: null or absolute runtime path outside the Nix store, e.g. “/run/secrets/service-password”

Default:

null

Example:

config.sops.secrets."users/alice/password".path

Declared by:

othrys.system.users.uid

UID of the primary user, on nix-darwin only. Null leaves the account to macOS. Set, it puts the user in users.knownUsers, so nix-darwin owns the account, creates it when it is missing and applies defaultShell as its login shell. The administrator account macOS created at setup, usually uid 501, keeps null, since nix-darwin must not manage it.

Platforms: nix-darwin only.

Type: null or signed integer

Default:

null

Example:

502

Declared by:

othrys.system.users.wheel

Put the primary user in wheel, which is sudo. Off for a host whose primary user is not its administrator.

Platforms: NixOS and nix-darwin.

Type: boolean

Default:

true

Declared by:

othrys.system.wsl.enable

Whether to enable running the host as a NixOS-WSL distro.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.system.wsl.defaultUser

The account WSL logs in as when the distro starts, written to wsl.defaultUser.

Platforms: NixOS only.

Type: string

Default:

config.othrys.system.user.name

Declared by:

othrys.system.wsl.startMenuLaunchers

Add a Windows Start menu shortcut for each GUI application the host installs.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.system.wsl.usbip.enable

Whether to enable attaching Windows USB devices through usbipd-win.

Platforms: NixOS only.

Type: boolean

Default:

false

Example:

true

Declared by:

othrys.system.wsl.usbip.autoAttach

Bus IDs to attach at boot, as usbipd list prints them on Windows. Each device has to be bound once on Windows with usbipd bind --busid <id>.

Platforms: NixOS only.

Type: list of string

Default:

[ ]

Example:

[
  "4-1"
]

Declared by:

othrys.system.wsl.usbip.hostAddress

The address of the Windows host that runs usbipd-win. null keeps the NixOS-WSL default, which reads the gateway of eth0. Under networkingMode=mirrored the distro has no such route, so a mirrored host sets 127.0.0.1.

Platforms: NixOS only.

Type: null or string

Default:

null

Example:

"127.0.0.1"

Declared by:

othrys.system.wsl.windowsPath

Append the Windows PATH to the PATH of the distro. Off by default, so a name such as git or node resolves to the Nix package and not to a Windows binary of the same name. Interop stays on either way, and a Windows binary still runs by its full path, as in /mnt/c/Windows/explorer.exe.

Platforms: NixOS only.

Type: boolean

Default:

false

Declared by:

othrys.theme.colors

The palette in the other forms a module needs, derived and not to be set. withHashtag.<name> is the colour with a leading #, and rgb.<name> holds its r, g and b channels as integers from 0 to 255. Null when the palette is null. The plain six digits are othrys.theme.palette.<name>.

Platforms: NixOS and nix-darwin.

Type: raw value (read only)

Default: derived from othrys.theme.palette

Declared by:

othrys.theme.fonts.monospace

The monospace font for terminals and editors. Null leaves each application its own font.

Platforms: NixOS and nix-darwin.

Type: null or (submodule)

Default:

null

Example:

{
  name = "JetBrainsMono Nerd Font";
  package = pkgs.nerd-fonts.jetbrains-mono;
}

Declared by:

othrys.theme.fonts.monospace.package

Package that provides the font. It is added to fonts.packages. Null installs nothing, for a font the host already has.

Platforms: NixOS and nix-darwin.

Type: null or package

Default:

null

Example:

pkgs.nerd-fonts.jetbrains-mono

Declared by:

othrys.theme.fonts.monospace.name

Family name of the font, as fontconfig knows it.

Platforms: NixOS and nix-darwin.

Type: string

Example:

"JetBrainsMono Nerd Font"

Declared by:

othrys.theme.fonts.sansSerif

The sans-serif font for interface text, which the bar reads. Null leaves each application its own font.

Platforms: NixOS and nix-darwin.

Type: null or (submodule)

Default:

null

Example:

{
  name = "Inter";
  package = pkgs.inter;
}

Declared by:

othrys.theme.fonts.sansSerif.package

Package that provides the font. It is added to fonts.packages. Null installs nothing, for a font the host already has.

Platforms: NixOS and nix-darwin.

Type: null or package

Default:

null

Example:

pkgs.nerd-fonts.jetbrains-mono

Declared by:

othrys.theme.fonts.sansSerif.name

Family name of the font, as fontconfig knows it.

Platforms: NixOS and nix-darwin.

Type: string

Example:

"JetBrainsMono Nerd Font"

Declared by:

othrys.theme.opacity

Window opacity by kind of surface. Null leaves opacity to each application.

Platforms: NixOS and nix-darwin.

Type: null or (submodule)

Default:

null

Example:

{
  terminal = 0.95;
}

Declared by:

othrys.theme.opacity.applications

Opacity of application windows, from 0 to 1.

Platforms: NixOS and nix-darwin.

Type: integer or floating point number between 0 and 1 (both inclusive)

Default:

1.0

Declared by:

othrys.theme.opacity.desktop

Opacity of bars and widgets, from 0 to 1.

Platforms: NixOS and nix-darwin.

Type: integer or floating point number between 0 and 1 (both inclusive)

Default:

1.0

Declared by:

othrys.theme.opacity.popups

Opacity of notifications and popups, from 0 to 1.

Platforms: NixOS and nix-darwin.

Type: integer or floating point number between 0 and 1 (both inclusive)

Default:

1.0

Declared by:

othrys.theme.opacity.terminal

Opacity of terminal windows, from 0 to 1.

Platforms: NixOS and nix-darwin.

Type: integer or floating point number between 0 and 1 (both inclusive)

Default:

1.0

Declared by:

othrys.theme.palette

The palette every othrys module reads. It follows scheme and polarity by default, and a host can set it directly to a palette that belongs to no scheme.

Null means no palette. A module then writes no colour, and the application keeps its own look.

Platforms: NixOS and nix-darwin.

Type: null or base16 palette (base00 to base0F, and optionally the base24 colours base10 to base17)

Default: the scheme named by othrys.theme.scheme, at othrys.theme.polarity, or null when the scheme is null

Example:

config.othrys.theme.schemes.oxocarbon.light

Declared by:

othrys.theme.polarity

Whether the host is dark or light. It picks the half of the scheme that becomes the palette, and modules that tell an application which variant to use read it.

Platforms: NixOS and nix-darwin.

Type: one of “dark”, “light”

Default:

"dark"

Declared by:

othrys.theme.scheme

The scheme in use, as a name in othrys.theme.schemes.

"wallpaper" derives the palette from othrys.theme.wallpaper.primary when the system is built. othrys holds no generator of its own, so this value needs a module that provides one, as described in the theming guide.

Null selects no scheme. othrys.theme.palette is then null unless the host sets it, and every othrys module leaves colour to the application.

Platforms: NixOS and nix-darwin.

Type: null or string

Default:

"oxocarbon"

Example:

"gruvbox"

Declared by:

othrys.theme.schemes

The colour schemes a host can choose from, by name. Each scheme holds a dark and a light palette, and a palette is an attribute set of colours written as six hexadecimal digits with no #. The sixteen base16 colours base00 to base0F are required. The eight base24 colours base10 to base17 are optional.

othrys defines oxocarbon. A host adds a scheme of its own by defining another name here with the same shape, as the example does, and selects it with othrys.theme.scheme. The definitions merge, so adding a scheme leaves oxocarbon in place. The name wallpaper is reserved, since othrys.theme.scheme gives it another meaning.

Platforms: NixOS and nix-darwin.

Type: attribute set of (submodule)

Example:

{
  gruvbox = {
    dark = {
      base00 = "282828";
      base01 = "3c3836";
      base02 = "504945";
      base03 = "665c54";
      base04 = "bdae93";
      base05 = "d5c4a1";
      base06 = "ebdbb2";
      base07 = "fbf1c7";
      base08 = "fb4934";
      base09 = "fe8019";
      base0A = "fabd2f";
      base0B = "b8bb26";
      base0C = "8ec07c";
      base0D = "83a598";
      base0E = "d3869b";
      base0F = "d65d0e";
    };
    light = {
      base00 = "fbf1c7";
      base01 = "ebdbb2";
      base02 = "d5c4a1";
      base03 = "bdae93";
      base04 = "665c54";
      base05 = "504945";
      base06 = "3c3836";
      base07 = "282828";
      base08 = "9d0006";
      base09 = "af3a03";
      base0A = "b57614";
      base0B = "79740e";
      base0C = "427b58";
      base0D = "076678";
      base0E = "8f3f71";
      base0F = "d65d0e";
    };
  };
}

Declared by:

othrys.theme.schemes.<name>.dark

The palette this scheme gives a dark host.

Platforms: NixOS and nix-darwin.

Type: base16 palette (base00 to base0F, and optionally the base24 colours base10 to base17)

Declared by:

othrys.theme.schemes.<name>.light

The palette this scheme gives a light host.

Platforms: NixOS and nix-darwin.

Type: base16 palette (base00 to base0F, and optionally the base24 colours base10 to base17)

Declared by:

othrys.theme.wallpaper.fill

How an image that does not match the screen is drawn. center covers the whole screen and crops what does not fit. fit shows the whole image and leaves black borders, and fit-border-color draws those borders in the colour of the image’s edge. stretch covers the screen by changing the aspect ratio, and tile repeats the image.

Platforms: NixOS and nix-darwin.

Type: one of “center”, “fit”, “fit-border-color”, “stretch”, “tile”

Default:

"center"

Example:

"fit"

Declared by:

othrys.theme.wallpaper.interval

How long one image stays before the next replaces it, as a number of seconds or as a duration such as "30s", "10m" or "1h 30m". Null keeps the image the session started with. It has an effect only when source is a list or a directory.

Platforms: NixOS and nix-darwin.

Type: null or positive integer, meaning >0, or duration such as “30s”, “10m” or “1h 30m”

Default:

null

Example:

"10m"

Declared by:

othrys.theme.wallpaper.order

The order images are taken in when source is a list or a directory. ascending and descending go through the file names in order, and a list keeps the order it is written in under ascending.

Platforms: NixOS and nix-darwin.

Type: one of “random”, “ascending”, “descending”

Default:

"random"

Example:

"ascending"

Declared by:

othrys.theme.wallpaper.outputs

Wallpaper settings for single monitors, keyed by the name the compositor gives the output, such as "DP-1". Each entry holds the same source, interval, order and fill, and a value left null takes the one set for every monitor. A monitor with no entry uses the settings above.

Platforms: NixOS and nix-darwin.

Type: attribute set of (submodule)

Default:

{ }

Example:

{
  "DP-1".source = ./wallpapers/portrait.png;
  "HDMI-A-1" = {
    source = "~/Pictures/Wallpapers";
    interval = "30m";
  };
}

Declared by:

othrys.theme.wallpaper.outputs.<name>.fill

How an image is fitted to this monitor. Null uses othrys.theme.wallpaper.fill.

Platforms: NixOS and nix-darwin.

Type: null or one of “center”, “fit”, “fit-border-color”, “stretch”, “tile”

Default:

null

Example:

"fit"

Declared by:

othrys.theme.wallpaper.outputs.<name>.interval

How long one image stays on this monitor. Null uses othrys.theme.wallpaper.interval.

Platforms: NixOS and nix-darwin.

Type: null or positive integer, meaning >0, or duration such as “30s”, “10m” or “1h 30m”

Default:

null

Example:

"10m"

Declared by:

othrys.theme.wallpaper.outputs.<name>.order

The order images are taken in on this monitor. Null uses othrys.theme.wallpaper.order.

Platforms: NixOS and nix-darwin.

Type: null or one of “random”, “ascending”, “descending”

Default:

null

Example:

"ascending"

Declared by:

othrys.theme.wallpaper.outputs.<name>.source

The wallpaper of this monitor, in any form the option for every monitor takes. Null uses othrys.theme.wallpaper.source.

Platforms: NixOS and nix-darwin.

Type: null or image, as a Nix path or a path in the Nix store or non-empty (list of image, as a Nix path or a path in the Nix store) or directory read at run time, as a string starting with / or ~/

Default:

null

Example:

./wallpapers/portrait.png

Declared by:

othrys.theme.wallpaper.primary

The one image used wherever a single image is needed. scheme = "wallpaper" derives the palette from it, and the Stylix export hands it to Stylix. A directory read at run time holds no image that is known when the system is built, so a host with such a source sets this option when something needs an image.

Platforms: NixOS and nix-darwin.

Type: null or absolute path

Default: source when it is one image, its first element when it is a list, and null otherwise

Example:

./wallpapers/dawn.png

Declared by:

othrys.theme.wallpaper.source

The desktop wallpaper, in one of four forms.

  • Null sets no wallpaper, and the palette still comes from scheme and polarity.
  • A Nix path such as ./wallpaper.png, or a package that builds an image, is one image. It is copied into the store.
  • A list of such images, as in [./wallpapers/dawn.png ./wallpapers/dusk.png], is a set the daemon picks from. Each is copied into the store.
  • A string such as "~/Pictures/Wallpapers" or "/srv/wallpapers" is a directory the daemon reads while the session runs, so its images change without a rebuild. Nothing is copied, and no image of it is known when the system is built.

No image ships with this library, so a host provides its own. othrys.desktop.wallpaper draws whichever form is set.

Platforms: NixOS and nix-darwin.

Type: null or image, as a Nix path or a path in the Nix store or non-empty (list of image, as a Nix path or a path in the Nix store) or directory read at run time, as a string starting with / or ~/

Default:

null

Example:

# one image, copied into the store
./wallpaper.png

# several images, copied into the store
[./wallpapers/dawn.png ./wallpapers/dusk.png]

# a directory read while the session runs
"~/Pictures/Wallpapers"

Declared by:

Keybindings

Keybinding reference for the two compositors. The tables show the defaults. Every action’s chord is an option, and setting one to null drops the bind. The two modules share a chord wherever the action exists in both, so the same hand positions work in either session.

Hyprland

Chords live under othrys.desktop.compositors.hyprland.binds.*. $mainMod is the mainMod option (default SUPER), and numbered-workspace binds are toggled by numberedWorkspaceBinds.

Chords use Hyprland’s +-separated syntax, e.g. $mainMod + SHIFT + H or a bare Print. Add binds the module does not curate with extraBinds, whose dispatcher is a raw Lua expression:

othrys.desktop.compositors.hyprland.extraBinds = [
  {
    key = "$mainMod + CTRL + 1";
    dispatcher = ''hl.dsp.focus({ monitor = "DP-1" })'';
  }
];

Workspace

BindingAction
Super + 1-0Switch to workspace 1-10
Super + Shift + 1-0Move window to workspace 1-10
Super + Ctrl + Left/RightCycle workspaces
Super + Mouse wheelCycle workspaces
Super + SToggle scratchpad
Super + Shift + SMove to scratchpad

Focus & Window Management

BindingAction
Super + H/J/K/LFocus left/down/up/right
Super + Shift + H/J/K/LSwap window left/down/up/right
Super + QKill active window
Super + MFullscreen
Super + VToggle floating
Super + PPseudo-tile
Super + YPin window
Super + Shift + EExit Hyprland

Mouse

BindingAction
Super + Left click dragMove window
Super + Right click dragResize window

Applications

BindingAction
Super + ReturnTerminal (the terminal option)
Super + FBrowser (the browser option)

Launcher, run-prompt, emoji-picker, clipboard, file-search and color-picker binds are added by the ashell module when enabled.

Media

BindingAction
Volume Up/DownAdjust volume (5%)
Volume MuteToggle mute
Mic MuteToggle mic mute
Brightness Up/DownAdjust brightness (10%)
Media Next/Prev/PlayPlayer control

Screenshots

BindingAction
PrintFull screenshot → screenshots.directory (default ~/Pictures/Screenshots/)
Super + PrintRegion screenshot → file
Super + Shift + PrintRegion screenshot → clipboard

Source

          bind = let
            b = cfg.binds;
          in
            lib.optionals cfg.numberedWorkspaceBinds (
              map (n:
                hlLua.mkBind {
                  key = "$mainMod + ${toString (lib.mod n 10)}";
                  dispatcher = "hl.dsp.focus({ workspace = ${toString n} })";
                }) (lib.range 1 10)
              ++ map (n:
                hlLua.mkBind {
                  key = "$mainMod + SHIFT + ${toString (lib.mod n 10)}";
                  dispatcher = "hl.dsp.window.move({ workspace = ${toString n} })";
                }) (lib.range 1 10)
            )
            ++ mkBind b.focusLeft ''hl.dsp.focus({ direction = "left" })''
            ++ mkBind b.focusRight ''hl.dsp.focus({ direction = "right" })''
            ++ mkBind b.focusDown ''hl.dsp.focus({ direction = "down" })''
            ++ mkBind b.focusUp ''hl.dsp.focus({ direction = "up" })''
            ++ mkBind b.swapLeft ''hl.dsp.window.swap({ direction = "left" })''
            ++ mkBind b.swapRight ''hl.dsp.window.swap({ direction = "right" })''
            ++ mkBind b.swapDown ''hl.dsp.window.swap({ direction = "down" })''
            ++ mkBind b.swapUp ''hl.dsp.window.swap({ direction = "up" })''
            ++ mkBind b.killActive "hl.dsp.window.close()"
            ++ mkBind b.terminal "hl.dsp.exec_cmd(terminal)"
            ++ mkBind b.browser "hl.dsp.exec_cmd(browser)"
            ++ mkBind b.fullscreen "hl.dsp.window.fullscreen()"
            ++ mkBind b.toggleFloating "hl.dsp.window.float()"
            ++ mkBind b.pseudo "hl.dsp.window.pseudo()"
            ++ mkBind b.pin "hl.dsp.window.pin()"
            ++ mkBind b.exit "hl.dsp.exit()"
            ++ mkBind b.specialWorkspace ''hl.dsp.workspace.toggle_special("magic")''
            ++ mkBind b.moveToSpecialWorkspace ''hl.dsp.window.move({ workspace = "special:magic" })''
            ++ mkBind b.workspacePrev ''hl.dsp.focus({ workspace = "e-1" })''
            ++ mkBind b.workspaceNext ''hl.dsp.focus({ workspace = "e+1" })''
            ++ mkBind b.screenshot (execCmd "grim ${screenshotFile}")
            ++ mkBind b.screenshotRegion (execCmd ''grim -g "$(slurp)" ${screenshotFile}'')
            ++ mkBind b.screenshotRegionToClipboard (execCmd ''grim -g "$(slurp)" - | wl-copy'')
            # Drag binds, where `mouse` is exclusive with locked/repeating.
            ++ [
              (hlLua.mkBind {
                key = "$mainMod + mouse:272";
                dispatcher = "hl.dsp.window.drag()";
                opts.mouse = true;
              })
              (hlLua.mkBind {
                key = "$mainMod + mouse:273";
                dispatcher = "hl.dsp.window.resize()";
                opts.mouse = true;
              })
              (hlLua.mkBind {
                key = "$mainMod + mouse_down";
                dispatcher = ''hl.dsp.focus({ workspace = "e+1" })'';
              })
              (hlLua.mkBind {
                key = "$mainMod + mouse_up";
                dispatcher = ''hl.dsp.focus({ workspace = "e-1" })'';
              })
            ]
            # Media and brightness keys stay live on the lock screen and
            # repeat while held.
            ++ map (spec:
              hlLua.mkBind {
                inherit (spec) key dispatcher;
                opts = {
                  locked = true;
                  repeating = true;
                };
              }) [
              {
                key = "XF86AudioRaiseVolume";
                dispatcher = execCmd "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+";
              }
              {
                key = "XF86AudioLowerVolume";
                dispatcher = execCmd "wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-";
              }
              {
                key = "XF86AudioMute";
                dispatcher = execCmd "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
              }
              {
                key = "XF86AudioMicMute";
                dispatcher = execCmd "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle";
              }
              {
                key = "XF86MonBrightnessUp";
                dispatcher = execCmd "brightnessctl s 10%+";
              }
              {
                key = "XF86MonBrightnessDown";
                dispatcher = execCmd "brightnessctl s 10%-";
              }
            ]
            ++ map (spec:
              hlLua.mkBind {
                inherit (spec) key dispatcher;
                opts.locked = true;
              }) [
              {
                key = "XF86AudioNext";
                dispatcher = execCmd "playerctl next";
              }
              {
                key = "XF86AudioPrev";
                dispatcher = execCmd "playerctl previous";
              }
              {
                key = "XF86AudioPlay";
                dispatcher = execCmd "playerctl play-pause";
              }
              {
                key = "XF86AudioPause";
                dispatcher = execCmd "playerctl play-pause";
              }
            ]
            ++ map hlLua.mkBind cfg.extraBinds;

Niri

Chords live under othrys.desktop.compositors.niri.binds.* and use niri’s syntax, Mod+Shift+H or a bare Print. Mod is the Super key in a session started from a greeter. Niri arranges windows in columns on a strip that scrolls sideways, so the horizontal binds act on columns and the vertical ones on the windows inside a column. Add binds the module does not curate with extraBinds, in the format of programs.niri.settings.binds:

othrys.desktop.compositors.niri.extraBinds = {
  "Mod+T".action.spawn = "thunderbird";
};

Workspace

BindingOptionAction
Mod + 1-9numberedWorkspaceBindsFocus workspace 1-9
Mod + Shift + 1-9numberedWorkspaceBindsMove the column to workspace 1-9
Mod + Ctrl + Leftbinds.workspacePrevPrevious workspace
Mod + Ctrl + Rightbinds.workspaceNextNext workspace
Mod + Sbinds.overviewToggle the overview

Niri has no scratchpad, so Mod + S opens the overview where Hyprland toggles its scratchpad.

Focus & Window Management

BindingOptionAction
Mod + H/Lbinds.focusLeft, binds.focusRightFocus the column to the left or right
Mod + J/Kbinds.focusDown, binds.focusUpFocus the window below or above
Mod + Shift + H/Lbinds.moveLeft, binds.moveRightMove the column left or right
Mod + Shift + J/Kbinds.moveDown, binds.moveUpMove the window down or up
Mod + Qbinds.killActiveClose the active window
Mod + Mbinds.fullscreenToggle fullscreen
Mod + Pbinds.maximizeColumnMaximize the column
Mod + Vbinds.toggleFloatingToggle floating
Mod + Shift + Ebinds.exitQuit niri

Applications

BindingOptionAction
Mod + Returnbinds.terminalTerminal (the terminal option)
Mod + Fbinds.browserBrowser (the browser option)

The ashell module adds Mod + D for the launcher, Mod + Shift + D for the run prompt, Mod + E for the emoji picker, Mod + Shift + V for the clipboard history and Mod + Shift + F for file search. Each picker chord is bound only while its signal holds a command. The color picker is Hyprland only.

Media

These keys also work while the session is locked. They have no option and are replaced through extraBinds.

BindingAction
Volume Up/DownAdjust volume (5%)
Volume MuteToggle mute
Media Play/PauseToggle playback

Screenshots

BindingOptionAction
Printbinds.screenshotOpen niri’s interactive screenshot UI
Mod + Printbinds.screenshotScreenScreenshot the full screen
Mod + Shift + Printbinds.screenshotWindowScreenshot the focused window

Screenshots are saved into screenshots.directory (default ~/Pictures/Screenshots).