Commit graph iac/nixos/flake.nix
Author SHA1 Message Date
39ed5d17b7
nixos: zsh and fastfetch for the admins
Some checks failed
nixos / nixos (push) Failing after 3m20s
zsh as on the admin's workstation (asxpi/nixOS modules/shell.nix):
completion, autosuggestions, syntax highlighting, the same history
options, key bindings and blue prompt, without what only the
workstation needs. asxpi logs in with it; deploy and root keep bash,
because the app CI and scripts run commands through their login shell.
The new-user wizard is off, since fresh homes have no ~/.zshrc.

fastfetch prints a system summary on interactive SSH logins only, so
scp, CI and `ssh host <command>` stay quiet. bat and eza come along.

Tried on the rehearsal services host.

Assisted-by: Claude:opus-5-5
2026-11-17 07:07:37 +04:00
ebbf458983
docs: the full migration plan; ci: deploy NixOS hosts
All checks were successful
nixos / nixos (push) Successful in 55s
MIGRATION.md is now the complete plan for moving production from
Ansible and Terraform to NixOS and OpenTofu: what was rehearsed and
how, the preparation that needs no downtime, one runbook per host with
its checks and rollback, the clean-up including the branch renames,
and the rules for running restored production data on test servers.

The NixOS workflow now deploys on main, ops first, building on each
host. It checks /etc/NIXOS before touching a host, so it skips both
servers until their conversion and cannot reach a Debian one.
known_hosts moves to the repository root for it.

Renovate learns the Nix files: version comments, the runner's job
images and flake.lock (weekly). The Ansible patterns stay until
Ansible is gone.

Assisted-by: Claude:opus-5-5
2026-11-17 05:15:16 +04:00
cbf14b4b99
nixos: monitoring as native services
Every host runs node_exporter, cAdvisor (now against Podman), Alloy and
the security-metrics script, on its private address. Each service
declares its own expected ports, users and privileged containers next
to its definition, so the security baseline follows the config instead
of a separate inventory list.

On ops: Prometheus, Loki, Grafana, the blackbox prober and the Postgres
exporter, with the same scrape jobs, probes, retention, dashboards and
33 alert rules. Two rules matched container-era names and now match the
native ones: Forgejo's log is unit forgejo.service, Grafana's route is
grafana@file.

Grafana keeps its default secret_key on production, because its
database was written with it; rotating it is a separate step.

Prometheus, Grafana and Alloy come from nixos-unstable: their data is
from newer versions than 26.05 ships.

LLMNR and mDNS are off: the baseline flagged them as public listeners.

Tried on the rehearsal pair: all 28 scrape targets up, logs from both
hosts in Loki, Grafana WireGuard-only, no unexpected port, user or
container on either host.

Assisted-by: Claude:opus-5-5
2026-11-17 04:48:56 +04:00
be68c5adef
nixos: describe both servers as NixOS systems
Start of the move from Ansible to NixOS. Services run as native NixOS
services where nixpkgs has a module and as Podman containers otherwise;
there is no Docker.

Shared: users with their Debian UIDs, SSH with the Ansible role's crypto
settings, nftables firewall, WireGuard (ops is the hub), sops-nix
secrets per host, the restic backup script with its schedule and
retention, mail on unit failure.

asxpio-services: Xray, SillyTavern, Minecraft (Paper) and the ACME
forwarder natively; XMPP stays in containers because the server is a
custom build.

asxpio-ops: Postgres, Garage and Forgejo natively. Roles, buckets, keys
and grants move here from the storage repo's init scripts.

Services that own data wait for /var/lib/.data-in-place, so an install
never creates empty state where a restore is about to land.
migration/*-data.sh move the Debian-era data into the new layout.

hosts/rehearsal turns the two hosts into a test pair with its own keys
and dummy secrets. Everything here ran there, Postgres, Garage, Forgejo,
Minecraft and SillyTavern on a restored copy of production data. Three
differences from the containers showed up and are handled: Garage
rejects a 0440 credential file, Geyser needs libcrypto and netlink,
SillyTavern ignores the module's listen flags.

Production is untouched: both servers still run Debian under Ansible.

Assisted-by: Claude:fable-5-2
2026-11-16 22:59:59 +04:00