Personal Nix flake for all my machines, built with flake-parts and the
dendritic pattern: every feature lives in its own file
under modules/, and contributes to as many of darwin / nixos / homeManager as it needs.
The generic part (options kiso.*, shell, git, ssh, tmux, Nix itself, home-manager wiring, the
flake plumbing) is kiso, a public flake-parts module imported in
flake.nix: hosts use its features by name like their own (darwin.fish, homeManager.git…).
This repo keeps the machines, the services, the network, the secrets and the values; what must
not be public (where the services live, public keys) sits in modules-private/, encrypted in the
repository with git-crypt (see Encrypted trees).
| Host | Machine | OS |
|---|---|---|
jiban |
Mac Mini M4 | macOS (nix-darwin) |
ishizue |
NixOS VM on jiban (vfkit) | NixOS |
torii-cdg |
Vultr instance, Paris | NixOS |
hashira-01, hashira-02 |
Lenovo ThinkCentre M75q, home LAN | NixOS |
shosai |
Dell Latitude 7440 | NixOS |
modules/
meta/ the values of kiso's options (owner.nix), this repo's options (services, expiring secrets)
home/ home-manager features of this repo (ssh-hosts, gh, Claude Code); the generic ones are kiso's
macos/ nix-darwin-only features (headless server, auto-login, VM host, linux builder, reminders)
nixos/ NixOS-only features (server, Forgejo, rirekisho)
backup/ azukari: the object store on hashira-01 and each node's backup exports
cache/ oroshi: the Nix binary cache on hashira-01, its readers and jiban's uploader
network/ kekkai, annai, hanko, genkan
desktop/ the Sway session of a workstation (SwayFX, Stylix, Plymouth, LibreWolf, everyday apps)
vm/ NixOS guest base for VMs on a Mac (vfkit, EFI)
flake/ this repo's apps (rekey-host, set-autologin-password); the rest of the plumbing is kiso's
hosts/ one file per machine: its identity + the features it imports
modules-private/ git-crypt, laid out like modules/: where services live (meta/endpoints.nix), public keys (meta/keys.nix)
secrets/ sops files per host, git-crypt on top
infra/ OpenTofu: cloud resources and public DNS (see Infrastructure)
scripts/
bootstrap.sh turns a fresh Mac into a working jiban
hooks/ pre-commit: refuses an encrypted tree committed in clear
A feature file declares flake.modules.<class>.<name>; a host file just lists the names it wants.
Adding a feature never requires touching an existing file.
nix run .#switch # rebuild + diff against the current generation (sudo prompt included)
nix run .#check # nix flake check
nix run .#fmt # nix fmt (nixfmt-tree)
nix run .#rekey-host -- <host> --public-key <verified-key.pub> # new host key: update its recipient, including shared secrets
nix run .#install-ishizue # on jiban: build ishizue's disk image and start it (once)
nix run .#deploy-ishizue # over kekkai: build inside the VM, then switch in a detached unit (also deploy-torii-cdg, deploy-hashira-01, deploy-hashira-02: built on the host)
nix develop # shell with nixfmt, statix, deadnix, shellcheck, just, nvdSteps in execution order. Everything not listed here is declarative and comes back with the
switch. The repo is private (SSH over FIDO2 key), so the bootstrap script cannot be
fetched with curl from GitHub: bring scripts/bootstrap.sh and scripts/bootstrap.nim over,
side by side (AirDrop, scp, USB stick).
- Before wiping: everything pushed (
sekkeizuand~/repositories/kanna), and the password manager holds the two FIDO2 identities of~/.config/sops/age/keys.txtand the admin age key. - Erase All Content and Settings, then in Setup Assistant: create the account with the name set
in
modules/meta/owner.nix, and turn FileVault off when the assistant offers it (with FileVault on, macOS ignores/etc/kcpasswordand the headless boot stops at the unlock screen). - Bootstrap, with the first FIDO2 key plugged in:
It installs Nix, then compiles and runs
bash bootstrap.sh --repo git@github.com:scorsi/sekkeizu.git
bootstrap.nim(Nim and clang from nixpkgs), which installs the Command Line Tools, pulls the key handle (ssh-keygen -K: PIN, then touch), clones sekkeizu and kanna (~/repositories/kanna, the live Neovim config), fetches the flake inputs from their GitHub mirrors (Forgejo isn't reachable yet) and runs the first switch. Until kekkai is up (second switch, step 8), run Nix commands throughnu scripts/via-github.nu …. That switch can complain that sops cannot decryptkcpassword: expected, the host key is new (step 7 fixes it). - One
ssh-keygen -Kper additional key: plug the next FIDO2 key, thencd ~/.ssh && ssh-keygen -K(the bootstrap only handled the first one). - Screen Sharing: System Settings → General → Sharing → Screen Sharing on (not declarative). Remote Login (sshd) is declared.
- sops identities: put the two
AGE-PLUGIN-FIDO2-HMAC-1…lines from the password manager into~/.config/sops/age/keys.txt(on the machine where step 7 runs;jibanitself is fine). Each decryption then takes a touch of either key; the admin key stays in the password manager (break-glass, see.sops.yaml). - Re-key: the reinstall generated a new SSH host key, so the old age recipient is dead.
On jiban,
nix run .#rekey-host -- jibanreads the local public host key. From another machine, pass--public-key <verified-key.pub>using a key copied from jiban's console or another independently verified source. Review and commit.sops.yamland every changed file undersecrets/, including shared secrets (pull them on jiban if it ran elsewhere). - Second switch:
nix run .#switch(ordrs): the secrets now decrypt and/etc/kcpasswordis installed. - Immediate screen lock:
sysadminctl -screenLock immediate -password -(type the account password when prompted). TheaskForPassworddefault alone is not honoured by recent macOS, and the command needs the password, so it cannot be declared. Check withsysadminctl -screenLock status. - Reboot and check: auto-login works, the screen is locked (password asked), and
ssh jibanstill answers.
A classic NixOS machine (own disk, own /nix/store, systemd-boot) booted in EFI mode by vfkit
(Virtualization.framework). A LaunchAgent of the owner's session (org.nixos.vm-ishizue) starts
it at login, i.e. at boot thanks to auto-login. vCPU, RAM, disk size and MAC are declared on the
Mac side: sekkeizu.vms.ishizue in modules/hosts/jiban.nix. Reachable over kekkai
(ishizue.kekkai.uchi.<domain>, used by deploys) and as ishizue.local from jiban
(NAT bridge, the deploy fallback).
The bridge address in sekkeizu.bridgeAddresses is reserved for the VM's MAC in
/etc/bootptab, managed by vfkit-host. A fixed MAC alone does not reserve a DHCP address.
After first installing or changing this reservation, reboot jiban before relying on it: this
reloads bootpd and makes the guest obtain a new lease. Do not delete live DHCP leases or assign
the address manually inside the guest. Check /etc/bootptab and, over ssh ishizue.local,
ip -4 address against bridgeAddresses before checking annai, kekkai and the observability
stores, whose listeners, firewall rules and clients all use that address. An existing lease
held by another VM must be resolved before starting the reserved VM.
State, in ~/.local/state/vm/ishizue/:
disk.raw: the disk (sparse; the guest's weekly fstrim gives freed blocks back to the Mac).efi-vars: the EFI variable store (boot order, systemd-boot one-shot entries). Keep it with the disk; without it the VM still boots (fallbackEFI/BOOT/BOOTAA64.EFI) but loses those.console.log(guest console) andvfkit.log, rotated at each start (3 previous kept as.1-.3): vfkit never reopens them, so newsyslog couldn't rotate them while the VM runs.
/ is a 1 GB tmpfs, rebuilt empty at every boot. The disk (ext4, label nixos) is mounted on
/persist and carries /nix (bind of /persist/nix) and everything declared to survive. Each
feature adds its own state to sekkeizu.persist.directories / .files (the kajiba runner keeps
its source cache…); modules/nixos/impermanence.nix aggregates them (via
preservation) and keeps the machine-id, the
uid/gid map, /var/lib/systemd, /var/log and the owner's whole home. The SSH host key lives
directly at /persist/etc/ssh/ssh_host_ed25519_key (sops decrypts before the bind mounts exist).
Anything installed by hand outside the declared paths is gone at the next reboot: declare it.
Day to day:
- Deploy:
nix run .#deploy-ishizue(nixos-rebuild buildinside the VM; the profile andswitch-to-configurationthen run in a transientsekkeizu-switch-<time>unit, so a dropped session cannot interrupt them: the app follows its journal, reconnects for up to 3 min and exits with its status). Connects asroot@over kekkai (key-only, FIDO2 keys, allowed only from the Mac's NAT bridge and kekkai), one shared SSH connection: one touch per deploy. When kekkai or annai is broken:DEPLOY_HOST=root@ishizue.local nix run .#deploy-ishizue(the bridge;DEPLOY_HOST=root@torii-cdg.scorsi.devfor torii-cdg, its public SSH). Interactivesudoin the VM still uses pam_rssh (a touch each). - Rollback:
nix run .#deploy-ishizue -- --rollback, or for one boot only,sudo bootctl set-oneshot nixos-generation-<n>.confin the VM, then reboot. - Restart:
launchctl kickstart -k gui/$(id -u)/org.nixos.vm-ishizue. A clean poweroff of the guest stays stopped; start it again withlaunchctl kickstart gui/$(id -u)/org.nixos.vm-ishizue. - Resources: edit
sekkeizu.vms.ishizue, switch jiban, restart the VM. A biggerdiskSizeonly applies to a new install.
- Linux builder: uncomment
darwin.linux-builderinmodules/hosts/jiban.nix,nix run .#switch. - Install:
nix run .#install-ishizuebuilds the disk image (~4 min), copies it sparse, grows it todiskSize, writes ishizue's identity into it and starts the VM. It refuses to overwrite an existing disk without-- --force. The builder's disk is 40 GB (sparse, recreated at each start). - First boot (~15 s): the partition grows. The identity comes from
secrets/ishizue/identity.yaml(sops, admin key: SSH host key), written into/persistoffline withdebugfsbefore the first boot: same host key (known_hosts,.sops.yamlunchanged, the secrets decrypt at once). Nothing else to do; go to 6. - Without
identity.yaml(a genuinely new machine): a new SSH host key is generated. Obtain/etc/ssh/ssh_host_ed25519_key.pubthrough the VM's trusted console and save it asishizue-host-key.pub. Verify its fingerprint (ssh-keygen -lf ishizue-host-key.pub) before replacing the old known_hosts entries (ssh-keygen -R ishizue.local; ssh-keygen -R ishizue). Check the fingerprint when connecting withssh ishizue.local. - Re-key (only after 4):
nix run .#rekey-host -- ishizue --public-key ishizue-host-key.pub. Review and commit.sops.yamland all changed secrets, includingsecrets/hanko/. The command updates tracked files selected by SOPS rules and restores their original ciphertext if an update fails. After an interrupted process, inspectgit diffand rerun it to finish. To keep this new identity for the next reinstall, store it insecrets/ishizue/identity.yaml(ssh_host_ed25519_key,ssh_host_ed25519_key_pub: the files under/persist, piped straight intosops set --value-stdin). - Deploy:
nix run .#deploy-ishizue, built inside the VM. - Drop the linux builder: comment
darwin.linux-builderagain,nix run .#switch(nix-darwin deletes its disk).
The web services are <service>.uchi.<domain> names, which only annai resolves (CNAME to
genkan.uchi, which has both hashira's kekkai addresses): genkan on 443 on each of them, the same
sites, each with the *.uchi wildcard of its own hanko, reached over kekkai (its allowInbound
opens tcp/443 to jiban); the LAN keeps 443 closed. The nodes' hikyaku and azukari-backup pin genkan.uchi and
azukari.uchi to both genkan addresses in /etc/hosts (the nodes resolve through Quad9) and reach
genkan's services listener on 9443: SNI passthrough only, no web site, so kekkai opens it to torii-cdg's
hikyaku without opening the web sites. Git over
SSH uses the same Forgejo name: genkan's tcp passthrough on 2222 forwards it raw, with a PROXY v2
header, to Forgejo's own SSH server on ishizue over kekkai. A name served on one hashira only
(résumé, Nix cache) reaches the other's 443 and is relayed raw by SNI, behind a PROXY v2 header, to
the owner's relay listener on 7443 (kekkai opens it between the two hashira only, PROXY headers
trusted from the other hashira's kekkai address only), so the owner logs the real client.
genkan's TLS ports all end in 443, the prefix gives the role:
| Port | Listener | Role |
|---|---|---|
| 443 | default |
the web sites, over kekkai |
| 7443 | relay |
the web sites, from the other hashira's genkan only, PROXY v2 |
| 8443 | edge |
public names from torii-cdg's genkan, PROXY v2 (hashira-02 only) |
| 9443 | services |
machine-to-machine SNI passthrough, no web site |
| Service | Address | Behind |
|---|---|---|
| Forgejo | https://forgejo.uchi.<domain> |
genkan → ishizue:3000 over kekkai |
| Git (SSH) | ssh://git@forgejo.uchi.<domain>:2222 |
genkan passthrough → Forgejo's SSH server |
| Résumé | https://rirekisho.uchi.<domain> |
genkan, static files (no publisher since the Forgejo runners were removed); hashira-01's genkan relays the name by SNI to hashira-02's relay (7443) |
| Nix cache | https://oroshi.uchi.<domain>/nix |
hashira-01's genkan → oroshi on loopback; hashira-02's genkan relays the name by SNI to hashira-01's relay (7443) |
| Backups | https://azukari.uchi.<domain>:9443 |
genkan passthrough by SNI → azukari-server (hashira-01:5000), mTLS end to end |
| Metrics, logs | https://genkan.uchi.<domain>:9443, TLS name masu.internal / nisshi.internal |
genkan passthrough by SNI → masu / nisshi (hashira-01:9472, 9473), the nodes' hikyaku |
Addresses are declared once, in modules-private/meta/endpoints.nix (sekkeizu.services.*);
genkan's sites, annai's records and Forgejo's ROOT_URL read them from there.
Public exposure: only the résumé. Its public names (rirekisho.public in endpoints.nix:
rirekisho.soto.<domain>, with rirekisho.<domain> and cv.scorsi.me as CNAMEs to it, records in
modules-private/meta/public.nix) point at torii-cdg, where genkan v1.0 listens on tcp/443 and
forwards them by SNI, TLS untouched, behind a PROXY v2 header, to hashira-02's edge listener
(<hashira-02 kekkai IPv4>:8443, kekkai allowInbound from torii-cdg only, PROXY headers trusted from
torii-cdg's kekkai address only), hashira-02 alone: a genkan tcp route has one backend.
hashira-02 terminates TLS with hanko's rirekisho-public certificate.
Only sites that name the edge listener are served there (genkan ADR 0013): Forgejo and every other
*.uchi name answer 404 through a public SNI. tcp/80 on torii-cdg is genkan's redirect listener
(v1.1): every request gets a 301 to https:// on the same host and path, answered on torii; port 80
never crosses kekkai. No git SSH on a public port.
- Git over SSH on 2222: Forgejo's own SSH server, not the system sshd, which stays key-only for
the owner. kekkai's
allowInboundopens tcp/2222 to jiban. No sharedgitaccount on the system, noAllowUserschange; the server only speaks git, with the keys stored in Forgejo (owner.sshKeys, added by theforgejo-adminunit). - Backups: azukari (
modules/backup/azukari.nix). Each export of a node has its ownazukari-backup-<export>unit and timer (1 h random delay): daily,masu-daysandnisshi-daysat 01:00 UTC (after their stores seal the previous day at 00:10 UTC). A run first refreshes its export in/persist/backups/<export>, then sends it to the store on hashira-01 (bucketbackup, DAS disk ZN1374ZM). Exports:forgejo-dumpon ishizue (forgejo dump, one tar replaced each run),hanko-accounton hashira-01 and hashira-02 (each one's ACME account key,account.key),masu-daysandnisshi-dayson hashira-01 (each store's closed days, hard-linked; the open day is never exported, so the last day lags until it closes). Retention runs dry (7-day keep,enabled = false). The store replicates the bucket every 6 h to two copies (azukari ADR 0008):offsite, the Storage Box'sbackupsubaccount underazukari/(rsync over SSH, keyazukari-offsite-keyinsecrets/hashira-01/azukari-offsite.yaml, the box's host key pinned; the directory was made once with that key from hashira-01, the owner having no SSH access to the box), andlocal, the USB disk 53RFWOD0T (modules/nixos/replica-disk.nix, its own LUKS key,/mnt/replica/53RFWOD0T/azukari; a run is skipped while it is not mounted). Each copy is a restore source as it is. Each export is its own snapshot (azukari ADR 0030). Run one now:systemctl start azukari-backup-<export>; list:sudo -u azukari-backup azukari backup snapshots /etc/azukari/azukari-backup.toml <export>; restore withazukari backup restore <config> <export> <snapshot> <empty dir>(as root to restore owners), orrestore --verifyto read everything back without writing. Without the store (azukari ADR 0029), add--from-dir <copy>/backup(the USB replica, or the box'sazukari/backupfetched with rsync): only the node's config and data key are needed. The former restic repository was deleted from the Storage Box (2026-10-30) once a restore from both copies was checked; the box's weekly snapshots (.zfs/) keep it for about 10 weeks, readable withrestic-passwordandbackup-pull-keyfromsecrets/jiban/secrets.yaml: drop both once the last snapshot holding it has expired. - Observability retention: masu and nisshi keep 400 days of data, configured from
modules/observability/retention-days.json. Themasu-daysandnisshi-daysexports mirror what the store holds: a day the store drops leaves the export too, and stays in earlier azukari snapshots. - Hanko account recovery: the
hanko-accountexport holds the current ACME account key; hanko never replaces it by itself (hanko ADR-0008), and earlier keys stay in earlier snapshots. On a replacement host, restore the key before enabling Hanko. On an existing host, first stophanko-node.timer,hanko-node-renew.serviceandhanko-node.service. Select the key belonging to the account URI pinned insekkeizu.acmeAccounts, then install it as/var/lib/hanko/account.key, owner and grouphanko, mode0600(state directoryhanko:hanko, mode0751). Do not overwrite an existing key without comparing it and keeping its backup. Starthanko-node.timeronly after restoring the identity; a new key would create a different account and fail the pinned CAA policy. Restore the key from a trusted backup, never by creating an ACME account as a recovery test. A missing key fails the export, hence the backup run, including at first boot before restoration. This also reports a lost identity on an existing host instead of silently skipping it. - CI: kajiba runners (
modules/nixos/kajiba.nix, featurekajiba-runner) on hashira-01, hashira-02 and ishizue. On each, the runner and nix-daemon shareci.slice(OOM kill beyond), with per-host values inrunnerHosts: 2 jobs × 4 cores in 9 GiB / 8 CPUs on the hashira, 1 job × 2 cores in 5 GiB / 2 CPUs (plus up to 2 GiB of swap) on ishizue. This also limits manual builds using that daemon. Finish existing builds before deploying a slice change, or reboot: a daemon restart alone can leave old build processes in their previous cgroup. - Résumé: repository
rirekisho(Astro, its own flake), served by genkan from/var/lib/rirekisho, on the overlay and publicly through torii-cdg (above). Its Forgejo Actions workflow no longer has a runner: nothing publishes there until kajiba's CI does.
- Certificate: hanko (
modules/network/hanko.nix) issues*.uchi.<domain>before genkan needs it; until then genkan runs and fails the handshakes (certificate-not-ready). - Deploy ishizue:
nix run .#deploy-ishizue. - Log in: user =
owner.name, password:sops -d --extract '["forgejo-admin-password"]' secrets/ishizue/secrets.yaml(theforgejo-adminunit resets the account to that password at each Forgejo start).
The repositories live on Forgejo (origin) and are push-mirrored to GitHub (the fallback) at every
commit. Which repositories exist, their settings and their mirrors are declared in
koseki (OpenTofu): sekkeizu runs Forgejo, koseki says what is in it.
-
Inputs come from Forgejo: the
scorsi-*inputs aregit+sshURLs on Forgejo (LAN, no dependence on GitHub). GitHub is the recovery path, for a fresh install or when Forgejo is down:nu scripts/via-github.nu <command>(e.g.nix run .#switch) rewrites the Forgejo URLs to the mirrors through git's environment; Nix still checks the revs and hashes offlake.lock(identical either way: checked). The bootstrap clones sekkeizu from GitHub and fetches the inputs that way by itself. -
Owner keys: the
forgejo-adminunit reconciles only the keys it manages (sekkeizu:owner:titles, or legacy keys adopted by exact title and content and recorded in Forgejo's state directory); a failed API request fails provisioning and is retried on the next run. -
switchas root: kiso'sswitchfetches the inputs as the user (SSH agent, a touch) beforesudo darwin-rebuild, which then finds them in the store. -
Mirror token: kept in koseki; only its expiry date is declared here (
modules/meta/github-mirror-token.nix,sekkeizu.expiringSecrets): jiban notifies daily and every switch warns from 30 days before. -
Verified commits: each FIDO2 key must be verified once in Forgejo (Settings → SSH / GPG keys → Verify, then the
ssh-keygen -Y signcommand it shows, with that key plugged in). Forgejo only offers this through the web form; redo it for a new key or a reinstalled Forgejo.
secrets/ and modules-private/ are encrypted by git-crypt
(.gitattributes): plain in an unlocked clone, ciphertext in the repository and on GitHub. Secrets
stay sops files underneath: whatever Nix reads ends up in the world-readable store, so modules-private/
holds values only, never a secret.
- Key: one symmetric key, in the password manager (base64) and in sops
(
secrets/<host>/git-crypt-key). From an unlocked clone:sops -d secrets/jiban/git-crypt-key | base64. - Unlock a clone:
base64 -d > key,git-crypt unlock key, deletekey, thengit config core.hooksPath scripts/hooks(the bootstrap does all of it with--git-crypt-key). - The leak to avoid: in a clone that was never unlocked, git skips the filter and would commit a
new file of these trees in clear.
scripts/hooks/pre-commitrefuses that commit. - A locked clone does not evaluate: the modules of
modules-private/are ciphertext. - sops keys (
.sops.yaml): every file is encrypted to its host (activation, unattended), the two FIDO2 keys and the admin key. No private key on disk:keys.txtonly holds the FIDO2 identities (age-plugin-fido2-hmac -g, touch only, separate identity; useless without the physical key), so any human decryption takes a touch. The admin key is the break-glass, kept only in the password manager. A new FIDO2 key: generate it, add its classicage1…recipient to.sops.yaml(the anchor names the serial number printed on the key),sops updatekeysevery file. Recipient order is the touch count: sops tries them in order and the plugin needs a touch for each stanza it tries, its own or not. The daily key comes first in every rule and first inkeys.txt, so one touch per decryption (updatekeyskeeps a file's existing order).rekey-hostchanges recipients, not data keys. For a compromised host key, remove its recipient, runsops rotateon the affected current files and rotate the credentials themselves. Old Git ciphertext remains decryptable with the compromised key; re-encryption cannot revoke that history.
On macOS, the first switch without saved ciphertext fingerprints restarts hikyaku
and kekkai-node once. A failed restart aborts activation and skips subsequent
steps. Its fingerprint is not saved, so rerunning the switch retries it; successful earlier
restarts are already recorded.
What runs outside the house, in plain HCL under infra/. Each stack has its own state; modules are
shared between stacks.
infra/
encryption.tf state and plan encryption, symlinked into every stack
modules/
vultr-node/ instance, firewall group (given ports and ICMP, v4 and v6), reserved IPv4
dns-zone/ one Porkbun zone: records, optional null-mail (null MX, SPF -all, DMARC reject)
stacks/
torii/ Vultr, `torii-<region>`, region `cdg` (Paris) by default; ICMP, tcp/22, 53, 80, 443, udp/53, 4800-4802
storage/ Hetzner Storage Box BX11 (fsn1), weekly snapshots, subaccount `backup`: azukari's replica
dns/ scorsi.dev and scorsi.me at Porkbun: the delegation to annai soto (NS, glue); reads torii's addresses
- Tooling: the
infrashell (OpenTofu behind atofuwrapper, sops, the FIDO2 age plugin,tofu-state-key), loaded by direnv underinfra/(direnv allow infraonce), ornix develop .#infra. Run tofu from a stack directory. - Providers: exact versions in each stack,
.terraform.lock.hclcommitted with the hashes ofdarwin_arm64,linux_amd64andlinux_arm64. After a version bump:tofu providers lock -platform=darwin_arm64 -platform=linux_amd64 -platform=linux_arm64. - State: local
terraform.tfstate, committed, encrypted by OpenTofu itself (AES-GCM, key from a passphrase through PBKDF2,enforced). Commit it after every apply. No locking: one operator. - Secrets:
secrets/infra/tofu.yaml(sops, keys as in "Encrypted trees", no host key): decrypting takes a touch. Keys:vultr_api_key,porkbun_api_key,porkbun_secret_key,hcloud_token,state_passphrase,install_password(the NixOS ISO'snixosuser while installing a Vultr host, seemodules/nixos/vultr-guest.nix). The shell'stofudecrypts the file once perplan,apply,destroy,refresh,importorconsole(one touch) and passes the run the API keys the stack declares as ephemeral variables (TF_VAR_*, never in the state or the plan) and the state passphrase, which the external key providertofu-state-keyhands to OpenTofu (modules/flake/infra.nix). For that run they sit in the environment of tofu and its providers. A bare OpenTofu still works for the state (tofu-state-keythen calls sops each time) but asks for the keys. - Order:
storageandtoriiare independent;dnsneeds torii applied (its state holds the addresses).
- Porkbun: Domain Management → API Access on for scorsi.dev and scorsi.me (per domain;
without it the API answers
API_ACCESS_DISABLED). API key limited to the DNS permission on those two domains. Delete the default parking records (ALIAS/CNAMEtopixie.porkbun.com) if the domains have them. - Vultr: API key, access restricted to your IP addresses (access control of the API settings).
- Hetzner: Console project → Security → API token, read and write.
- Secrets file:
sops secrets/infra/tofu.yamlwith the five keys (state_passphrase:openssl rand -base64 36). - Apply, from each stack:
tofu init,tofu plan,tofu apply; committerraform.tfstate. - DNSSEC and delegation: annai's
sotozones are currently unsigned. Leave the domain's DNSSEC section at Porkbun empty: no DS record at the parent zone. Before delegating to annai, remove any DS from the previous DNS provider and wait for its TTL to expire, then change the nameservers (and glue records). A stale DS makes validating resolvers reject the unsigned zone. Publish a DS only after every authoritative server serves a signed zone and its DNSKEY has been verified; Porkbun's DNSSEC form publishes that DS, it does not sign annai's zones. - restic's password:
restic-passwordinsecrets/jiban/secrets.yaml(already set; a new one means a new repository). jiban's and azukari-server's keys reach thebackupsubaccount at apply (terraform_data.backup_key, the box'sinstall-ssh-keyover the subaccount's password), never through the box resource: changing itsssh_keysrecreates the box, data included.
./scripts/bootstrap.sh --repo git@github.com:<you>/sekkeizu.git --git-crypt-key <file> # see --helpIdempotent: on an already configured machine it skips what is done and ends with a switch.
The shell part only installs Nix; everything else is scripts/bootstrap.nim.
The only file meant to be edited per-user is modules/meta/owner.nix:
the values of kiso's options (account name, display name, email, the FIDO2 (YubiKey/Thetis) SSH
keys used both to log in and to sign commits, where this repo is cloned, state versions).
To change kiso itself: edit ~/repositories/kiso, test with
nix run .#switch -- --override-input scorsi-kiso path:$HOME/repositories/kiso, push it, then
nix flake update scorsi-kiso here and commit flake.lock. kiso is public: nothing about these
machines goes there.
The Neovim config is its own repo and flake, kanna, consumed as
the input scorsi-kanna (from Forgejo, GitHub mirror for recovery). Feature kanna: the config from the store, frozen with
flake.lock. Feature kanna-dev (jiban): ~/.config/nvim links to the clone in
~/repositories/kanna (sekkeizu.reposDir), so Lua edits apply without a rebuild. Nix changes
in kanna: see its README (--override-input scorsi-kanna path:…, then nix flake update scorsi-kanna).