refactor(nixos): architecture overhaul #128
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "nick/dotfiles:architecture"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The four upRoot Nutrition services move from modules/nixos/homelab/guests/uprootnutrition/ to nodes/guests/<service>: uproot-frontend, uproot-backend, enaychi and uproot-routing, each one record with a prod instance ("01", on ceres) and a dev instance ("02", on mars) pinned to today's guest names. The old wrappers split in two: what ran inside the guest becomes instances/<nn>/guest.nix, with the link's named port, the neighbouring guests' addresses (`nodes.<name>.address`), the frontend's site as the OpenID issuer and Loki's address and push port in place of the record reads; what the wrapper set on the host beyond the record-derived fields (secrets, the backend's shares, the encrypted container, directories, mars's port) becomes instances/<nn>/host.nix. The helpers follow the service that uses them: backendReadiness, databaseBackup, discordArchiveStream and mapCells to uproot-backend, routingReadiness and valhalla to uproot-routing. Prod and dev stay separate files: this pass is placement, not factoring. The dev links name no http port and mars's Caddy ports are not yet on its record, so the dev frontends keep a literal 4321 and the dev backend's origins still read the website record's `domain` and `hostPort`. The resolver now places a guest on any machine whose link's `guests` range holds the guest's link, not only a host: mars is a workstation and runs the dev instances. The bare `enaychi` gitignore rule is told to leave nodes/guests/enaychi alone. Every guest's derivation is unchanged, mars and the forgejo guest differ only in the branding sources, and ceres reorders `system-path` (identical built tree) and its tmpfiles rules (113 each, equal sets: the websiteProd block moves). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016dB3eMiG93gcJ3PG8jnkqeThe modules nothing imports stop reading `services.instances` and `machines.devices` and move to where they would live if used (step 6 of docs/architecture.md). Nobody enables them. Guest services nobody runs become service directories with one disabled instance, their link drawn as planned, today's name pinned as `legacy.name`: - modules/nixos/homelab/guests/firefly-iii/{config,fireflyEris} -> nodes/guests/firefly-iii/{record,guest,host}.nix (firefly_priv) - modules/nixos/homelab/guests/syncthing/{config,syncthingEris} -> nodes/guests/syncthing/{record,guest,host}.nix (syncthing_priv) - modules/nixos/homelab/guests/openwebui/{config,openwebuiCeres} -> nodes/guests/openwebui/{record,guest,host}.nix (openwebui_priv; the old `ollama` record, so the guest is still named `ollama`) - modules/nixos/homelab/guests/projectsite/projectSiteProd -> nodes/guests/projectsite/{record,guest,host}.nix with the two halves it composed, opencloud.nix and vaultwarden.nix, carrying the parameters the wrapper passed (projectsite_frontend_prod). Its imports of the removed vaultwarden/config and opencloud/config were already dangling. Host-side orphans become features, which lib/nodes/options.nix turns into record options nothing sets: - modules/nixos/homelab/orphans/{glance,searx,midnight,defenseio} -> features/{glance,searx,midnight,defenseio} - modules/nixos/services/ollamaCeres -> features/ollamaCeres Record reads replaced: hostname compares read `node.name`; ceres's LAN address is `nodes.ceres.lanAddress`; the three WireGuard addresses are `nodes.{ceres,mars,deimos}.legacy.tunnel`; ports the links name come from `node.ports.{http,searx}`; SMTP settings read `flake.self.lib.mail`; jellyfin's public name is `nodes.jellyfin.sites`. Literals, each with a comment, for what the network doesn't name: firefly's 8084/8081, syncthing's 21027/22000, Ollama's API 11434, glance's 3434, the project-site Vaultwarden's 8085; the names nothing serves (finances, dashboard, search, cloud./vault.<project site>); the acme certificate paths for dashboard and search; `/run/secrets/searx-<secret>`; and the `web` record's two addresses (0.0.0.0, 127.0.0.1). Glance's assets-path follows its directory. The module index loses the three comment lines naming the old wrappers. Every system's and guest's derivation is unchanged but the usual three (branding source). Brought onto the branch after the record deletion: the module list keeps the branch's shorter form, and the mail reads use lib/mail.nix's names (`ports`, `noReply`). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016dB3eMiG93gcJ3PG8jnkqeThe builder's `people` table named four modules under modules/nixos (core/environment, core/nh, core/ssh, sops) beside profiles/user0. They are people/user0/{environment,nh,ssh,sops}.nix now, with a default.nix importing them, and the table lists that directory beside the profile. common/routers imports nh and ssh from there; the core, iso and mantle bundles list the new paths in the order import-tree gave them; the sops module's defaultSopsFile path is the one edit inside a moved file. The empty core/system module goes. Every derivation is unchanged but the branding leaves; ceres, deimos, eris and mars reorder `system-path` (identical built trees), which dbus-1 and the dbus-broker, polkit and accounts-daemon units inherit. flake.lib.legacy has one reader left, the firewall's `modules` (docs/architecture.md, step 8). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016dB3eMiG93gcJ3PG8jnkqeStep 11.a of docs/architecture.md (owner: the dotfiles should be fully dendritic). flake.nix imports lib, network, packages, parts and topology whole with one import-tree; the value files they hold take the underscore import-tree skips (_records, _mail, _users, _themes, _lib, _tests, _nixos, the packages' callPackage files) and the pure aggregators go. The record schema declares common.<tier>, features.<name>.{module,options}, images.<name>.module, home.modules/groups, nodes.*.module and the guests' module/host; a person gets nixos. The builder takes a module by name where its files fill the option and by path where they don't yet. Leaves: the Haskell packages whose source directory holds a renamed file, and branding paths. Nothing else evaluates differently. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016dB3eMiG93gcJ3PG8jnkqeStep 11.f of docs/architecture.md. images/iso/{installer,platform}.nix and images/firewallInstaller/default.nix fill nixosConfigurations/<image>; the ISO's own module names the all and desktop tiers and the owner it is built with. The builder makes a system of every nixosConfigurations/<name> that has no record, with node as only the name, so flake.nix's hand list goes and images/ is read whole by import-tree. No derivation changed beyond the branding source paths. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016dB3eMiG93gcJ3PG8jnkqeenaychi, peertube, uproot-backend, uproot-frontend and uproot-routing lose their instances/<nn>/ files: each guest.nix and host.nix reads the guest's role and keeps what differs in a `roles` block (values as role.<x>, the options only one role defines as the imported module role.only); peers are nodes.${node.peers.<service>}. Every host wrapper imports its host sides instead of merging them. Leaves: ceres's tmpfiles rules reorder with equal sets, its system-path builds an identical tree, and the dev enaychi's Caddyfile takes prod's wording of one comment. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016dB3eMiG93gcJ3PG8jnkqe