1.8 KiB
1.8 KiB
Playbook: Add a NixOS Module
- Name: Add a module under
modules/<category>/ - Purpose: Introduce a new module following auto-import and toggle conventions.
- Prerequisites: Identify target host(s) and toggle category; confirm
my.secureHostif secrets are involved. - Inputs: Module name, category (apps/dev/scripts/servers/services/shell/network), required options, secret needs, proxy requirements if server-facing.
- Steps:
- Choose the category path from
docs/reference/index.md. Prefermodules/<category>/<name>/nixos.nixplusmodules/<category>/<name>/home.nixwhen the feature spans both system and Home Manager; use a legacy flatmodules/<category>/<name>.nixonly for NixOS-only modules or temporary migration work. - Define options under
my.<category>or reuse factories (mkserverfor servers,mkscriptfor scripts) instead of hand-rolled patterns. - If the module needs secrets, guard references with
lib.mkIf config.my.secureHostand map them to the correct secrets file (see secrets map). - For networked services, align host selection with
my.mainServerandmy.ips; enable reverse proxy viaenableProxywhen applicable. - Wire toggles for target hosts in
hosts/<host>/toggles.nix, ensuring users/groups and containers/proxy flags are set.
- Choose the category path from
- Validation:
- Module loads without extra imports (
nixos.nixandhome.nixare auto-discovered; legacy flat modules remain supported). - Toggle wiring matches intended hosts; secureHost gating present for secrets.
- Proxy and port choices align with
my.mainServer,my.ips, and firewall rules.
- Module loads without extra imports (
- Outputs: New module file and updated host toggles if required.
- References:
docs/constitution.md(Module Categories, Secrets Map, Main server and proxies),docs/reference/index.md(Module Directories, Auto-Import Rules, Proxy rules, Secrets Map)