From d448e0f6c8985d361df29c33c4807c8b19426b90 Mon Sep 17 00:00:00 2001 From: Danilo Reyes Date: Fri, 30 Jan 2026 16:42:29 -0600 Subject: [PATCH] reviewing --- .gitignore | 7 ++++ docs/constitution.md | 52 +++++++++++++++++++++++ docs/playbooks/add-host-toggle.md | 18 ++++++++ docs/playbooks/add-module.md | 18 ++++++++ docs/playbooks/add-script.md | 17 ++++++++ docs/playbooks/add-secret.md | 17 ++++++++ docs/playbooks/add-server.md | 18 ++++++++ docs/playbooks/template.md | 15 +++++++ docs/reference/index.md | 64 +++++++++++++++++++++++++++++ specs/001-ai-docs/data-model.md | 2 +- specs/001-ai-docs/quickstart.md | 10 ++--- specs/001-ai-docs/research.md | 5 +++ specs/001-ai-docs/tasks.md | 68 +++++++++++++++---------------- 13 files changed, 271 insertions(+), 40 deletions(-) create mode 100644 docs/constitution.md create mode 100644 docs/playbooks/add-host-toggle.md create mode 100644 docs/playbooks/add-module.md create mode 100644 docs/playbooks/add-script.md create mode 100644 docs/playbooks/add-secret.md create mode 100644 docs/playbooks/add-server.md create mode 100644 docs/playbooks/template.md create mode 100644 docs/reference/index.md diff --git a/.gitignore b/.gitignore index e438614..7210bc6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,10 @@ result **/secrets/*.yaml.dec **/*-decrypted.* **/temp-secrets.* +# Editor/OS artifacts +.DS_Store +Thumbs.db +.vscode/ +.idea/ +*.swp +*.tmp diff --git a/docs/constitution.md b/docs/constitution.md new file mode 100644 index 0000000..7eb9639 --- /dev/null +++ b/docs/constitution.md @@ -0,0 +1,52 @@ +# AI Constitution for the NixOS Repository + +## Scope and Audience +- Audience: AI assistants and contributors needing an authoritative description of repository rules, structure, and workflows. +- Scope: Repo-wide conventions, module categories, host roles, secrets handling, proxy rules, documentation locations, and maintenance triggers. +- Authority: This constitution is the source of truth for AI. If human-facing docs differ, update both with the recorded resolution in `specs/001-ai-docs/research.md`. + +## Repository Overview +- Architecture: Flake-based repo using `flake-parts` with inputs for pkgs (stable/unstable), stylix, home-manager, sops-nix, and service overlays. Common modules are composed through `parts/core.nix` and `parts/hosts.nix`. +- Module auto-import: `modules/modules.nix` auto-imports `.nix` files under `modules/apps`, `modules/dev`, `modules/scripts`, `modules/servers`, `modules/services`, `modules/shell`, and `modules/network`, excluding `librewolf.nix`. Factories live in `modules/factories/` (`mkserver`, `mkscript`), and shared options are in `modules/nix` and `modules/users`. +- Hosts and toggles: Host definitions live in `hosts//configuration.nix` with host-specific toggles in `hosts//toggles.nix`. The `my` namespace carries toggles for apps/dev/scripts/services/shell, feature flags like `enableProxy` and `enableContainers`, and per-host `interfaces` and `ips` maps. +- Main server and proxies: `my.mainServer` selects the host that should serve traffic by default (default `miniserver`; overridden to `server` in `hosts/server/toggles.nix`). Reverse proxies use helpers in `parts/core.nix` (`proxy`, `proxyReverse`, `proxyReverseFix`, `proxyReversePrivate`) and pick IPs from `my.ips` plus the hostName/ip set by `mkserver` options. +- Secure hosts and secrets: `my.secureHost` gates SOPS secrets. Secure hosts load secrets from `secrets/*.yaml` and wireguard definitions; non-secure hosts (e.g., `hosts/emacs`) skip secret-dependent services. Default SOPS file is `secrets/secrets.yaml` via `config/base.nix`. + +## Coding Conventions +- No blank lines between code blocks; keep markdown examples tight. +- Minimize comments; prefer clear naming and shared helpers (`modules/factories/mkserver.nix`, `modules/factories/mkscript.nix`) to avoid duplication. +- Use business-level, technology-agnostic language in AI docs; reserve implementation detail for module code. + +## Terminology and Naming Standards +- Module: A Nix module under `modules//.nix` auto-imported into the system. +- Factory: Shared option constructors in `modules/factories/` (use `mkserver` for server modules, `mkscript` for script units). +- Options: Settings under the `my` namespace (e.g., `my.services.`, `my.scripts.