7.5 KiB
7.5 KiB
Reference Map
Module Directories
- apps →
modules/apps/(desktop/workstation apps; supports legacy flat modules and preferred split feature directories) - dev →
modules/dev/(language toolchains and dev shells; supports legacy flat modules and preferred split feature directories) - scripts →
modules/scripts/(script units built viamkscript; supports legacy flat modules and preferred split feature directories) - servers →
modules/servers/(reverse-proxied services built viamkserver; supports legacy flat modules and preferred split feature directories) - services →
modules/services/(supporting services like syncthing, wireguard; supports legacy flat modules and preferred split feature directories) - shell →
modules/shell/(shell customizations and CLI tooling; supports legacy flat modules and preferred split feature directories) - websites →
modules/websites/(static nginx vhosts for portfolio/blog and reports; supports legacy flat modules and preferred split feature directories) - network →
modules/network/(networking rules, firewall helpers; supports legacy flat modules and preferred split feature directories) - users →
modules/users/(user-related options) - nix →
modules/nix/(Nix configuration and helpers) - factories →
modules/factories/(mkserver.nix,mkscript.nixshared helpers) - home-manager loader →
modules/home-manager.nix(discovers nestedhome.nixfiles undermodules/)
Root Directories
- patches →
patches/(patch artifacts referenced by modules)
User Config Split
- System-side user config:
config/<name>.nixfor NixOS user accounts, host secrets, groups, and other OS-owned state. - Home-side user config:
config/<name>-home.nixfor Home Manager-only files, shell/program configuration, and per-user match blocks. - Current example:
config/jawz.nixandconfig/jawz-home.nix.
Auto-Import Rules
- Source:
modules/modules.nixusesinputs.self.lib.autoImportfor legacy flat.nixfiles andinputs.self.lib.autoImportLeaffor nestednixos.nixfiles. - Home Manager source:
config/base.nixregistersmodules/home-manager.nixinhome-manager.sharedModules, and that module usesinputs.self.lib.autoImportLeafto discover nestedhome.nixfiles anywhere undermodules/. - Filter: Legacy flat auto-import excludes
librewolf.nix; nested split modules are discovered by exact leaf name (nixos.nixorhome.nix). - Preferred layout:
modules/<category>/<name>/nixos.nixandmodules/<category>/<name>/home.nix. - Migration rule: Legacy flat
modules/<category>/<name>.nixmodules remain supported while features are moved into split directories. - Implication: Place new dual-surface modules in a feature directory so NixOS and Home Manager stay adjacent; no manual import wiring is required unless adding a new factory.
Hosts and Roles
- Configs:
hosts/<name>/configuration.nixwith toggles inhosts/<name>/toggles.nix. - Active hosts:
workstation,server,miniserver,galaxy,emacs,vps. - Roles:
- workstation: developer desktop; provides build power for distributed builds.
- server: primary services host; runs most services and WireGuard targets.
- miniserver: small-footprint server.
- galaxy: small server variant using nixpkgs-small.
- emacs: VM profile,
my.secureHost = falsefor secret-free usage. - vps: Linode VPS image target, secure host with enrollment-based secrets.
- Network maps:
my.ipsandmy.interfacesdeclared inmodules/modules.nix; host toggles may override.
Proxy, Firewall, and Networking
- Proxy enablement:
my.enableProxytoggles Nginx reverse proxy; assertions require at least onemy.servers.*.enableProxywhen enabled. - Proxy helpers: use
parts/core.nixhelpers (proxy,proxyReverse,proxyReverseFixfor header preservation,proxyReversePrivatefor mutual TLS).mkserversupplieshost,ip,url,enableProxy, anduseDefaultProxy. - Default proxying: any server with
enableProxy = truegets aproxyReversevhost unlessuseDefaultProxy = falseor it is listed inproxyReverseFix/proxyReversePrivate. - Main server selection:
my.mainServerchooses where services live by default (defaultvps);mkserversetsisLocalbased on this and picks IPs frommy.ips. - Firewall generation:
inputs.self.lib.generateFirewallPortscombines static ports, additional ports, and service ports frommy.servers(excluding native firewall services). Usemy.network.firewallsettings andgetServicesWithNativeFirewallto derive open ports.
Secrets Map
- Files and purposes:
secrets/certs.yaml→ certificates and TLS material.secrets/env.yaml→ environment variables for services (e.g., lidarr-mb-gap).secrets/gallery.yaml→ media/gallery credentials.secrets/homepage.yaml→ homepage widget secrets.secrets/keys.yaml→ SSH/private keys and key ownership.secrets/wireguard.yaml→ WireGuard peers and private keys.secrets/secrets.yaml→ default SOPS file (general secrets, fallback when unspecified).secrets/ssh/→ host SSH keys and related artifacts.
- secureHost: Only hosts with
my.secureHost = trueconsume SOPS entries and WireGuard interfaces. Keep secret references behindlib.mkIf config.my.secureHost; proxy-only services that use private certs must still declare their cert secrets whenenableProxy = true.
Stylix and Theming
- Stylix module:
config/stylix.nixand stylix inputs inflake.nixapply theming. Host togglemy.stylix.enablecontrols activation (see host toggles). - Schemes and assets: Imported via Stylix inputs; wallpapers/fonts sourced from external flakes (
wallpapers,fonts).
Playbooks and Templates
- Playbook template:
docs/playbooks/template.md - Playbook:
docs/playbooks/add-module.md— add a module in the right category and confirm auto-import. - Playbook:
docs/playbooks/split-home-manager.md— migrate a mixed module into pairednixos.nixandhome.nixfiles. - Playbook:
docs/playbooks/add-server.md— add a reverse-proxied server viamkserverand proxy rules. - Playbook:
docs/playbooks/add-script.md— add a script unit viamkscriptwith install/service/timer options. - Playbook:
docs/playbooks/add-host-toggle.md— add or update host toggle maps underhosts/<name>/toggles.nix. - Playbook:
docs/playbooks/add-secret.md— add a SOPS secret in the correct file and wire it into modules. - Playbook:
docs/playbooks/add-wireguard-peer.md— add a WireGuard peer and update secrets/hosts. - Playbook:
docs/playbooks/enroll-vps.md— enroll a VPS key, re-encrypt secrets, redeploy. - Playbook:
docs/playbooks/vps-rebuild.md— rebuild the VPS with the expected deploy flow. - Constitution link-back:
docs/constitution.mdsections on terminology, proxies, secrets, and maintenance. - MCP server reference:
docs/reference/mcp-server.md(tool catalog,nixos-mcpwrapper, invocation, sync-docs)
Quick Audit Checklist
- Module coverage: All categories (apps, dev, scripts, servers, services, shell, websites, network, users, nix) have corresponding entries and auto-import rules for both legacy flat modules and split
nixos.nix/home.nixmodules;patches/is documented as a root directory. - Host coverage: Active hosts listed with roles and secureHost status;
mainServernoted. - Proxy rules:
enableProxyusage, proxy helper selection, andmy.ipsmappings documented. - Secrets map: Every secrets file and secureHost gating captured; new secret types aligned to file purposes.
- Discoverability: Paths reachable within two clicks from
docs/constitution.md.