What it is
The running instance of my NixOS IaC: a public VPS (Netcup), a ZFS NAS at home, and my desktops and laptops, all declared from one flake, all monitored, all backed up, all reachable over a self-hosted private network. It's the platform I operate every day.
Zoom
Why it exists
I wanted my daily workstations and a real production platform (public services, persistent data) in one system, not two separate worlds. It has to survive reboots, power cuts, driver upgrades, hardware migrations (TrueNAS → NixOS in March 2026) and my own mistakes, and recover from the flake without manual steps.
The second reason is practice. My password vault, photos and project management run here, so the reliability bar is a small company's: alerts when things break, backups I can verify, a runbook for every recurring issue.
Architecture
Public apps reach the internet through Cloudflare Tunnel from the VPS; the ones that aren't meant to be open sit behind Cloudflare Access with my own single sign-on (Pocket ID). Admin tools and internal names answer only on Nginx bound to the VPS's Tailscale address, so they're reachable only from devices on my self-hosted Tailscale network (Headscale, also on the VPS). A WireGuard site-to-site tunnel links the VPS to pfSense at home. There are no inbound port forwards at home.
Observability sits in the middle: Prometheus and Grafana on the VPS scrape exporters on every machine, Alertmanager sends alerts to a Telegram bot, and Uptime Kuma runs independent HTTP probes. Backups are Restic-encrypted, hourly and daily, and pushed to the NAS over Tailscale.
Zoom
What I built
- VPS services in rootless Docker — Plane (project management), Nextcloud (file sync, on MariaDB), Immich (photos), Pocket ID (single sign-on), n8n, Uptime Kuma, this portfolio, plus native NixOS services: Vaultwarden, Gitea, Headscale, Grafana, Postfix. Every compose stack on the VPS runs under rootless Docker; NixOS wires health checks, log rotation and systemd ordering.
- NAS migration from TrueNAS SCALE to NixOS (March 2026) — ZFS pools imported, the media stack (Jellyfin and its companions) re-hosted in Docker, mostly rootless. Not all of it: the VPN-routed download stack runs under rootful Docker, because the VPN container needs network admin rights. Some stacks run on demand only (UniFi controller, RomM, Calibre). See
truenas-to-nixos-migration. - Multi-tenant PostgreSQL 17 — one cluster, one user and one database per app, scram-sha-256 only, PgBouncer in transaction mode. Hourly and daily dumps through Restic to the NAS. See
postgres-multi-tenant. - Observability stack — Prometheus + Grafana + exporters (node, blackbox, SNMP for pfSense, WireGuard, postgres, mariadb, redis, cadvisor) and a stream of pfSense's packet-filter stats. Alertmanager to Telegram for critical events (service down, backup failure, certificate near expiry). Uptime Kuma runs the public status page.
- Network layer — pfSense with split-DNS at home, a WireGuard site-to-site tunnel to the VPS, Headscale as my own Tailscale control plane so the private network doesn't depend on a SaaS. See
vps-wireguard. - Postfix relay + Telegram — native Postfix forwards through SMTP2GO; systemd failure hooks send both email and Telegram notifications.
Monitoring a NAS that sleeps on a schedule
The NAS sleeps overnight and wakes itself mid-afternoon. For hours each day, every NAS panel in Grafana said "No data", and a sleeping NAS looked the same as a dead one.
So the NAS now announces its sleep. Before suspending, it writes a "going to sleep" metric with the scheduled wake time and waits for one Prometheus scrape; on resume it clears it. A recording rule turns that into one state: Online, Asleep (scheduled) or DOWN. That state is on the NAS, media and overview dashboards, the public one included. Pool status and capacity keep their last value while it sleeps; the other NAS panels say Asleep instead of showing nothing.
While I was there, I swept the whole Grafana setup for "No data". I pulled every panel query out of every dashboard, ran each one against Prometheus over the last hour, and re-ran the empty ones over seven days to separate "the NAS was asleep" from "this never worked". The broken ones:
- The WireGuard dashboard and its alerts read metrics that nothing exported, so those alerts could never fire. Added a WireGuard exporter and rewrote the alerts.
- The tunnel health probe pinged the VPS's own end of the tunnel, so it was always green. It now probes the far end at home.
- The pfSense packet-filter panels expected the stats from SNMP, which pfSense's SNMP agent never provided. They now come from
pfctlover one long-lived SSH session, with an alert if the stream goes stale. - The disk temperature alerts could never fire either: the sensor label was a hardware path, not a chip name. Fixed with a join on the chip names.
Before the sweep, a quiet dashboard could mean "fine" or "not measured". After it, an empty panel means the NAS is asleep, and the panel says so.
Results
- One flake builds the VPS, the NAS and my workstations (
my-nixos-infrastructure). - Alerts reach my phone through Alertmanager and Telegram; Uptime Kuma checks from outside.
- Restic-encrypted backups hourly and daily, pushed to the NAS over Tailscale.
- No inbound port forwards at home; admin tools only on the private network.
- The NAS shows Online / Asleep (scheduled) / DOWN instead of "No data".
Stack
NixOS, Nix flakes, Docker (rootless), Docker Compose, pfSense, WireGuard, Tailscale, Headscale, Nginx, Cloudflare Tunnel, Pocket ID, PostgreSQL 17, PgBouncer, MariaDB, Redis, Prometheus, Alertmanager, Grafana, Uptime Kuma, Restic, Postfix + SMTP2GO, Plane, Nextcloud, Immich, Gitea, Jellyfin, ZFS.
Status
- Repo: private. The flake is the one in
my-nixos-infrastructure. - Running daily: my workstations, laptops, a production VPS and a ZFS NAS.
- Related portfolio entries:
my-nixos-infrastructure(the codebase),vps-wireguard(the networking layer),vps-prod-consolidation(how the services got to the VPS).