NixOS/clan distributed-server spike (3 nodes + edge)
- TypeScript 48.7%
- Nix 40.5%
- Shell 10.8%
| .claude/commands | ||
| machines | ||
| Plans | ||
| scripts | ||
| sops | ||
| tests | ||
| vars | ||
| .drvpath-baseline | ||
| .gitignore | ||
| BOOTSTRAP.md | ||
| clan-ip-addresses.md | ||
| community.nix | ||
| DEVLOG.md | ||
| flake.lock | ||
| flake.nix | ||
| inventory.json | ||
| matou-infrastructure-map.md | ||
| matou-to-clan-spec.md | ||
| README.md | ||
| SETUP-RUNBOOK.md | ||
| still-to-build.md | ||
mauke — Mātou-style resilience stack on clan.lol
A four-machine, self-hosted resilience stack for mauke.network (new VPS +
three community servers), modelled on the Mātou design but deployed declaratively
with clan.lol instead of Ansible.
Full design rationale and the Mātou→clan mapping: matou-to-clan-spec.md.
Layout
flake.nix # fleet: machines + inventory (roles→tags)
machines/
edge/configuration.nix # new VPS: ingress, kanidm, mail, mesh controller+moon
node01/configuration.nix # workhorse: garage + pg/redis voter + active apps
node02/configuration.nix # active-active partner + relocate targets
node03/configuration.nix # quorum anchor: voter only, no frontends
modules/clan-services/
pg-ha/ # custom: HA Postgres (etcd+Patroni+HAProxy)
redis-ha/ # custom: HA Redis (Sentinel+HAProxy)
scripts/
garage-layout.sh # one-time: 1 zone/node, RF=3
matou-to-clan-spec.md # the spec
matou-infrastructure-map.md # reference design (Mātou)
Roles at a glance
| Machine | Tags | Runs |
|---|---|---|
| edge (VPS) | edge |
zerotier controller+moon, Caddy, acme-dns, kanidm, Stalwart, borg client |
| node01 | community voter frontend |
garage, pg/redis voter, Nextcloud+Forgejo+Mattermost+Collabora |
| node02 | community voter frontend |
garage, pg/redis voter, Nextcloud+Collabora, relocate targets |
| node03 | community voter |
garage, pg/redis voter (tiebreaker) |
First deploy
# 0. dev shell with the clan CLI
nix develop # or: nix run git+https://git.clan.lol/clan/clan-core#clan -- <cmd>
# 1. fill placeholders: EDGE_PUBLIC_IP (flake.nix), hardware-configuration.nix
# per machine (generated by nixos-anywhere/disko at install), domains/TLS.
# 2. generate + encrypt secrets (DB pw, garage keys, DKIM, kanidm) via sops
clan vars generate
# 3. bootstrap each host
clan machines install edge --target-host root@209.38.94.11 # mauke-edge (syd1)
clan machines install node01 --target-host root@<NODE01_LAN_IP>
clan machines install node02 --target-host root@<NODE02_LAN_IP>
clan machines install node03 --target-host root@<NODE03_LAN_IP>
# 4. one-time garage cluster layout (zones + RF=3)
./scripts/garage-layout.sh
# 5. thereafter, push changes to the whole fleet
clan machines update
clan vars list node01 # discover a machine's mesh (zerotier) IP
Status / what's stubbed
✅ wired = inventory role assigned (clan-native).
🔧 stub = NixOS config present as a TODO skeleton to fill in.
- ✅ mesh (zerotier controller+moon+peer), garage, borgbackup, sshd/users/monitoring
- 🔧 edge: Caddy wildcard routing, acme-dns container, kanidm clients/groups, Stalwart, oauth2-proxy fleet
- 🔧 apps: Nextcloud (active-active), Forgejo+runner, Mattermost, Collabora container
- 🔧🔧 pg-ha / redis-ha: role interface + module skeleton written; etcd/Patroni/Sentinel/HAProxy internals are TODO (the bulk of the work)
See matou-to-clan-spec.md → Recommended build order.
Caveats verified against clan.lol/docs/26.05
zerotier,garage,borgbackuprole names/schema are confirmed for 26.05.- The
clan-core.lib.clanflake output wiring and theclan.serviceauthoring schema (roles.<name>.{interface,perInstance}) should be re-confirmed against the live docs before first build — the API is still stabilising.