- Work from
nix develop. Repo-specific tools (nixos,agenix,derive,sshed,browse,alejandra) come from the devshell. nixosandagenixhere are wrapper scripts frompackages/, not stock CLIs. Many subcommands are interactive (gum) and some auto-stage files in git; avoid them for unattended automation unless you want that behavior.
- Module placement and import conventions:
modules/MODULE-PATTERNS.md - Networking, DNS, CA, Traefik, and Tailscale model:
modules/NETWORKING-PATTERNS.md users/is NixOS users/service identities, not Home Manager users:users/README.md- Deterministic secret/key recovery and agenix workflow:
secrets/README.md
- Format:
nix fmt(oralejandra .inside the devshell). - Eval one host without building:
nix eval .#nixosConfigurations.<host>.config.system.build.toplevel.outPath - Build one host:
nix build .#nixosConfigurations.<host>.config.system.build.toplevel - Full repo check:
nix flake check - Build installer ISO:
nix build .#nixosConfigurations.iso.config.system.build.isoImage - Non-interactive deploy equivalent:
nixos-rebuild --flake .#<host> [switch|boot|test|build|repl]
nixos generateis broad: it unlockssecrets/id_age.ageinto/tmp/id_age, rewrites host/user public keys underhosts/*andusers/*, ensureszones/ca.{crt,age}exists, and runsagenix rekey -a.nixos add host|userscaffolds files, stages them in git, then runsnixos generate.- Edit secrets with
agenix edit <path>.age. After changing recipients or adding/removing secrets, runagenix rekey -a(ornixos generate). Never commit plaintext secrets.
- This flake uses
blueprint: directories map directly to flake outputs. hosts/<name>/configuration.nixdefinesnixosConfigurations.<name>.- Shared system modules live in
modules/nixos/; shared Home Manager modules live inmodules/home/. - Per-host Home Manager configs live in either
hosts/<host>/users/<user>.nixorhosts/<host>/users/<user>/home-configuration.nix. users/<name>/holds NixOS user/service identity data plus generated public keys and encrypted passwords.zones/*/default.nixis the source of truth for IP data; the zone READMEs are router/admin runbooks.
modules/nixos/default/default.niximports./configs,./options, and./overlays;modules/home/default/default.niximports./configsand./options.- Before inventing new helpers, check
modules/README.md: this repo already extends modules withpersist,tmpfiles, extranetworking.*, and Home Managerhome.uid/home.portOffset. - New opt-in programs/services usually belong in
modules/{home,nixos}/default/options/; desktop-only modules belong undermodules/{home,nixos}/desktop/.
nixos sim up|rebuild|sshis the VM workflow for installer/disko experiments. It createshosts/sim/disk{1..4}.imgand deriveshosts/sim/ssh_host_ed25519_keylocally.