Skip to content
LogoLogo

Modules

Every cattery module declares its options under cattery.<category>.<path> and is off until something enables it, either you or a room. The option path follows the directory: modules/nixos/services/nginx/default.nix declares cattery.services.nginx.

Exports

The module outputs are flat. purr exports one attribute per top-level directory of a module tree, so nixosModules.services holds every NixOS service module and there is no nixosModules.services.nginx.

OutputSource directoriesCategories
nixosModulesmodules/nixos, modules/sharedapps, cli-apps, containers, desktop, home, nix, room, secrets, security, services, system, user
darwinModulesmodules/darwin, modules/sharedapps, brew, cli-apps, home, nix, room, secrets, services, system, user
homeModulesmodules/homeapps, cli-apps, desktop, room, secrets, services, system, user

The three outputs share their category names. home and nix come from modules/shared, containers and security exist only on NixOS, and brew only on nix-darwin. Each output also has default, which imports every category plus the third-party modules from extraModules in cattery's flake.nix.

Exported modules have stable keys, so you can remove a whole category from the bundle:

{ inputs, ... }:
{
  imports = [ inputs.cattery-modules.nixosModules.default ];
  disabledModules = [ inputs.cattery-modules.nixosModules.containers ];
}

Conventions

Plain definitions win

Rooms set enable with lib.mkDefault. Any value you set yourself takes precedence, so you can turn a room member off or swap it for another module:

{
  cattery = {
    room.desktop.dev.enable = true;
    apps.zed-editor.enable = false;
    cli-apps.editor.helix.enable = true;
  };
}

extraOptions

Modules that wrap an upstream program or service have an extraOptions option. It is merged into the upstream option with lib.mkMerge, so it takes anything the upstream module takes, including lib.mkForce and lib.mkIf:

{
  # Merged into programs.git.
  cattery.cli-apps.dev-kit.git.extraOptions = {
    lfs.enable = true;
    maintenance.enable = true;
  };
 
  # Merged into services.openssh.
  cattery.services.openssh.extraOptions = {
    settings.PasswordAuthentication = false;
  };
}

Each extraOptions description names the option it merges into, for example "Additional options merged into services.openssh."

persistence

Modules that keep state have a persistence option that defaults to true. When impermanence is enabled, the module adds its state paths to cattery.system.impermanence. Set it to false to let that state reset on boot:

{
  cattery.cli-apps.shell.atuin = {
    enable = true;
    persistence = false;
  };
}

Platform guards

homeModules.default works on Linux and macOS. A Home Manager module that only makes sense on one platform still declares its options everywhere and guards its config:

# modules/home/apps/iina/default.nix
{ config, pkgs, lib, namespace, ... }:
let
  inherit (pkgs.stdenv.hostPlatform) isDarwin;
  cfg = config.${namespace}.apps.iina;
in
{
  options.${namespace}.apps.iina = {
    enable = lib.mkEnableOption "the IINA media player";
  };
 
  config = lib.mkIf (cfg.enable && isDarwin) {
    home.packages = [ pkgs.iina ];
  };
}

Setting a Darwin-only option on Linux is therefore harmless, which is what lets rooms list both kinds of members. The modules shared by NixOS and nix-darwin read purr.meta.isLinux and purr.meta.isDarwin instead.

Shared modules

modules/shared is imported by both NixOS and nix-darwin.

OptionWhat it does
cattery.userThe primary user: name, realName, email, gpg, authorizedKeys, defaultUserShell, and useSecretPasswordFile. Creates the user on both platforms and sets system.primaryUser on macOS
cattery.home.extraOptionsHome Manager configuration forwarded to home-manager.users.<cattery.user.name> with mkAliasDefinitions. Hosts without Home Manager still evaluate
cattery.nixFlakes, automatic garbage collection, store optimisation, and the beans registry entry (nix.registry.beans.to) for develop-templates
cattery.secretsagenix secrets. See Secrets
cattery.system.fonts, cattery.system.ulimitDefault fonts and the open files limit
cattery.cli-apps.opensshThe OpenSSH client
cattery.cli-apps.securityfido2, gnupg (the agent), and yubihsm
cattery.cli-apps.shellfish and zsh as login shells
cattery.services.wg-quickWireGuard interfaces from config files in /etc/wireguard
cattery.services.sing-boxsing-box, configured through settings or a secret config file
cattery.apps.winboxWinBox for MikroTik routers

NixOS modules

CategoryModules
appsgame.steam, game.gale, vmware, yubikey
cli-appsmtr, nix.nix-ld, ssh (global known hosts)
containersNixOS containers, see below
desktopplasma, gnome, hyprland with the caelestia and charm-cat themes, niri, lightdm, and addons.catppuccin, addons.chromium-support, addons.xdg-portal
securitysecurity.pam, assigned to the NixOS security.pam options
services: networkopenssh, tailscale, cloudflared, adguardhome, smartdns, avahi, nginx, acme
services: storagesamba, samba-wsdd, nfs, target, sanoid, syncoid
services: appsforgejo, forgejo-runner, gitea, gitea-actions-runner, vaultwarden, postgresql, hydra, hydra-builder
services: containers and VMsdocker, containerd, k3s, kubernetes, firecracker, flintlock, qemu-guest, cloud-init
services: otherbeszel, netdata, cron, getty, vscode-server
system: bootboot.efi, boot.grub, boot.lanzaboote (Secure Boot), boot.kernel, boot.binfmt
system: file systemsfileSystems.zfs, fileSystems.nfs, fileSystems.samba, fileSystems.webdav, fileSystems.btrfs.impermanence
system: othernetwork (with wireless, bridges, nat), impermanence, locale, time, fcitx5, peripherals, automount, gpu.amd, wsl, proxmox.lxc

Home Manager modules

CategoryModules
appsEditors (vscode, zed-editor, code-cursor, antigravity-ide, jetbrains), terminals (wezterm, ghostty, foot), and desktop apps such as browser, instant-messengers, thunderbird, slack, zoom-us, graphics, video, iina, game, hmcl, remote, safety
cli-apps.dev-kitgit, jujutsu, nix, cpp, go, java, javascript, lua, rust, wasm, dive
cli-apps.shellfish, zsh, nushell, powershell, starship, atuin, direnv
cli-apps.editorhelix, neovim, vim
cli-apps.toolEveryday tools (useful, http-utils, network, monitoring, compressor, tldr), AI coding tools (claude-code, codex, opencode, pi, goose, kimi-code, qwen-code, cursor-cli, github-copilot-cli, antigravity-cli, ollama), and others such as gh, tea, acme-sh, installer, ventoy
cli-apps.operationscloud with one module per provider, kubernetes, serverless
cli-apps: otherssh, security.gnupg, security.yubihsm, nix.home-manager, nix.nix-index, file-manager.yazi, database.sqlite, video.visual, video.youtube, cloudflared, warp, android, disk, misc
desktophyprland with its addons and the caelestia and charm-cat themes, niri, plasma, xdg, addons.catppuccin
servicesgpg-agent, awww (wallpaper daemon)
systemfonts, impermanence
user, secretsThe Home Manager side of cattery.user and cattery.secrets

Containers

cattery.containers.<name> declares a NixOS container managed with machinectl:

{
  cattery.containers.web = {
    networkMode = "none";
    forwardPorts = [
      {
        protocol = "tcp";
        hostPort = 8080;
        containerPort = 80;
      }
    ];
    # system.stateVersion defaults to the host value.
    config.cattery.services.nginx.enable = true;
  };
}
  • hostModules.enable defaults to true. The container then imports hostModules.modules, which defaults to [ inputs.cattery-modules.nixosModules.default ], and lists nixosModules.containers in its disabledModules, so containers cannot nest. Set hostModules.enable = false for a container without cattery.
  • networkMode is none (a private veth pair with generated addresses), bridge (needs hostBridge), or host (the host network namespace).
  • hostModules.autoLoader turns on services inside the container when the container's name matches one: postgresql, vaultwarden, nginx, and acme from NixOS, and wg-quick, sing-box, and openssh from the shared modules. A container named postgresql runs cattery.services.postgresql. Set bindSecretsEtc = true to bind mount those services' decrypted /etc secret files into the container.
  • modules, specialArgs, bindMounts, dns, and extraOptions (merged into containers.<name>) cover the rest.

nix-darwin and Mac mini

cattery.system.power

Wraps the nix-darwin power options. Each value defaults to null, which leaves the macOS setting unchanged, and only set values are passed on. room.server uses it to keep a headless Mac running:

{
  cattery.system.power = {
    enable = true;
    restartAfterPowerFailure = true;
    restartAfterFreeze = true;
    sleep = {
      computer = "never";
      harddisk = "never";
      display = 10;
      allowSleepByPowerButton = false;
    };
  };
}

The sleep values take minutes or "never". extraOptions is merged into power.

cattery.system.sudoTouch

Touch ID for sudo through security.pam.services.sudo_local. Every value is set with mkDefault, so direct sudo_local settings still win.

OptionDefaultEffect
enablefalseSets touchIdAuth
reattachfalseReattaches sudo to the user session so Touch ID works inside tmux and screen
watchIdAuthfalseLets an Apple Watch approve sudo

cattery.brew

Homebrew through nix-darwin's homebrew module. It also adds /opt/homebrew/bin to the system path.

{
  cattery.brew = {
    enable = true;
    taps = [ "apple/apple" ];
    brews = [ "mas" ];
    casks = [ "raycast" ];
    masApps = {
      Xcode = 497799835;
    };
    # "none", "check", "uninstall", or "zap". Sets homebrew.onActivation.cleanup.
    cleanup = "zap";
  };
}

onActivation.autoUpdate and onActivation.upgrade default to true. extraOptions is merged into homebrew.

cattery.services.wg-quick and cattery.services.sing-box

Both modules are shared, so the same configuration works on NixOS and macOS:

{
  # Brings up /etc/wireguard/wg0.conf.
  cattery.services.wg-quick.configNames = [ "wg0" ];
 
  cattery.services.sing-box = {
    enable = true;
    settings.log.level = "warn";
  };
}

On NixOS they use networking.wg-quick.interfaces and the NixOS services.sing-box module. On macOS each one runs as a launchd daemon that waits for the Nix store volume before it starts and logs to /var/log/wg-quick-<name>.log or /var/log/sing-box.log. macOS has no kernel WireGuard, so wg-quick uses wireguard-go there.

wg-quick.enable defaults to true as soon as configNames is not empty. The configuration files usually come from secrets. On Linux, sing-box settings can reference secret files with _secret. macOS writes the settings to the Nix store, so _secret is rejected there. Put the whole config in the sing-box secret file instead.

cattery.services.openssh turns on the OpenSSH server on macOS, and cattery.system.useful applies Finder and other macOS defaults, such as showing all file extensions and not writing .DS_Store files on network and USB volumes.