| 1 | --- |
| 2 | type: decision |
| 3 | id: dcr-0f5d9b1 |
| 4 | status: decided |
| 5 | title: the-valley owns its host module; CUE owns the domain model, Nix installs it |
| 6 | created: 2026-07-06 |
| 7 | --- |
| 8 | |
| 9 | # CUE config and host-module ownership |
| 10 | |
| 11 | Four decisions, taken together, shape the repo's first shipped artifacts (the schema and the NixOS |
| 12 | host module): |
| 13 | |
| 14 | 1. **the-valley exports the host module; consumers install and configure it.** The flake's |
| 15 | `nixosModules.valley-host` is the implementation; consumer machines (cosmo's hosts) enable it and |
| 16 | supply machine integration only — data directory, unix user, SSH keys. This supersedes the |
| 17 | cosmo-owned approach of cosmo PR #601, where the module lived in cosmo: the thing that defines |
| 18 | what a valley host _is_ belongs with the-valley, not with any one machine's infra repo. |
| 19 | |
| 20 | 2. **The canonical config format is CUE, independent of Nix.** The domain model must be legible to |
| 21 | agents and tools in any runtime; Nix is one installer, never the owner of the model. CUE is |
| 22 | already the committed schema language for event schemas |
| 23 | ([roadmap, cross-cutting threads](../../design/roadmap.md#cross-cutting-threads)), so config and |
| 24 | events share one schema language. The module vets and exports the CUE at build time; if it needs |
| 25 | the data in Nix, it comes from the `cue export` — Nix never redefines the schema. |
| 26 | |
| 27 | 3. **The declaration unit is a project, with git as one nested store type.** `#Project` has a `git` |
| 28 | store (the only one today), not a top-level repo. This keeps the-valley from hard-coding a |
| 29 | commitment to being git-only that the design deliberately does not make. |
| 30 | |
| 31 | 4. **Push mirrors are the one connective mechanism; per-project access is deferred.** Public |
| 32 | exposure and the migration's dual-push |
| 33 | ([S1](../../design/user-scenarios.md#s1--my-repos-live-on-my-infrastructure-and-i-can-never-lose-them), |
| 34 | [oc-9949561](../outcomes/oc-9949561-push-replication.md)) are the same thing: per-project |
| 35 | declared push mirrors, best-effort, deletions propagated. Per-project _access_ is deliberately |
| 36 | absent from both CUE and Nix until S5 (first collaborator): with a single git user and git-shell |
| 37 | it is not honestly enforceable without forced-command machinery, and offering the option would |
| 38 | misrepresent the security boundary. |