What it is
I moved my home NAS from TrueNAS SCALE to NixOS. The main reason was control. TrueNAS is an appliance: it decides how the system is managed, and changes go through its web UI or its API. I wasn't using the web UI anyway. Every other machine I run is a profile in one NixOS repo, managed over SSH with Claude Code, and the NAS was the last one outside it.
Same hardware, same ZFS pools, same Docker services. Now every part of it (encrypted ZFS unlock, the 10 GbE bond, network card tuning, file shares, containers) is declared in one Nix profile and rebuilt from git.
The diagram shows the box as it was at the time of the migration (spring 2026).
Zoom
Why I migrated
TrueNAS didn't give me full control. TrueNAS keeps its configuration in its own middleware. In my February 2026 audit of the box, the fixes read like this:
NFS-001 Increase NFS threads to 16:
TrueNAS GUI → Services → NFS → Number of Servers → 16
SMB-001 Enable SMB multichannel via TrueNAS GUI or API:
midclt call smb.update '{"multichannel": true}'
Every change was a click or an API call, and none of it lived in git next to the rest of my config. On NixOS the first one is one line in a file, next to the rest of the NAS config:
I didn't need the web UI. I manage every machine from a shell, with Claude Code. A UI made the NAS the one machine I had to manage differently: its own admin user, a built-in app system I had to switch off to run plain Docker Compose, its own metrics format (Graphite) next to the Prometheus metrics of everything else.
One repo for everything. On NixOS the NAS uses the same modules as my other machines: SSH hardening, the VPN, rootless Docker, the monitoring exporters, the firewall. A fix in a shared module reaches the NAS too.
There was also a hardware reason: the 4 TB NVMe pool sat in a USB enclosure that reset under heavy writes. The reinstall was the moment to move it to an internal M.2 slot.
What I got from it
- Every change is a commit. Over 100 commits have changed the NAS profile and its module since the migration in April 2026. I can see what changed, when and why.
- Rollback from the boot menu. In the second week a deploy didn't boot. I picked the previous generation from the boot menu and the NAS was back, then fixed the cause.
- It deploys itself like the other servers. A build farm builds its profile, the NAS deploys on its schedule, runs a check after the deploy and rolls back if the check fails.
- Claude Code works on it like on any other machine. It reads the profile, changes it, deploys it and reads the metrics, with the same rules and hooks.
- New hardware fits the same pattern. In October 2026 I added an RTX 3090. It took one new driver module; after that, container GPU support, a GPU metrics exporter and the local AI model server I already ran on my desktop were flags in the profile.
- Standard metrics. node-exporter, cAdvisor and a host-health collector feed the same Prometheus and Grafana as the rest.
Architecture
The data stayed where it was: I imported the existing ZFS pools on the new install. The boot drive was reformatted, and the encrypted datasets unlock at boot, before any service that depends on them.
Networking carried over unchanged: same 2× 10 GbE LACP bond. The 2.5 GbE port stays as a fallback, so the box is reachable if the bond ever has issues.
Docker landed in a hybrid model: rootless stacks for the reverse proxy, the login gateway, the tunnel, media, exporters and monitoring. One stack needs extra network privileges, so it runs under the system Docker.
What I built
- One NAS profile that inherits the homelab base and turns on a dedicated module for the NAS-specific parts: ZFS auto-unlock, SMART monitoring, file-share tuning, Docker auto-start.
- ZFS pool import at boot — encrypted datasets unlock at boot after one passphrase.
- NIC tuning — a small service raises the 10 GbE cards' ring buffers to the maximum with
ethtool -G. The default was producingrx_missed_errorsunder sustained traffic. Hash policylayer3+4for proper LACP load distribution. - Docker stacks declared in the profile — a systemd target brings up each compose project after the pools are mounted.
- File shares declared in Nix, not edited by hand. Workstation clients use
softmounts, after the file manager hung for minutes while the NAS was unreachable. - Encrypted backups — the NAS also holds encrypted backups.
- Monitoring rebuilt on node-exporter, cAdvisor and a host-health collector — TrueNAS exposed Graphite metrics; the NixOS NAS exposes Prometheus metrics, and I rebuilt the Grafana dashboards on them. The host-health collector came after the outage below: it asks Docker directly which containers failed or are unhealthy.
Key decisions & tradeoffs
Decision 1: Import pools in place vs. fresh format and rsync. Importing kept all data unchanged: no copy time, no risk of mistakes while copying. The cost: I had to trust the new system to read the pools correctly on first boot. I booted once from a NixOS live ISO with the pools imported read-only, checked them, then installed. The import worked first try.
Decision 2: Hybrid Docker (rootless + system Docker) vs. all-rootless. One stack needs network privileges that rootless Docker can't grant. Two options: redesign that stack, or accept one stack under the system Docker. I accepted it and added a guard so rootless-only projects can't be started under the system Docker by accident.
Decision 3: Keep the TrueNAS-era addresses.
I could have renumbered the NAS and updated every client. I kept its address, and renamed the references in the repo (truenas → nas) in one sweep afterwards. Fewer changes at the same time during the migration.
Implementation highlights
- TCP buffer tuning uses
mkForce, notmkDefault. The upstream NixOS module was overriding my values; the audit flagged it. - ZFS auto-snapshot property set declaratively on every dataset by an activation service. TrueNAS used to set it through its middleware; NixOS leaves it unset unless you declare it.
- Docker dataset ownership — the dataset was created on TrueNAS for its
appsuser. Rootless Docker on NixOS writes as my user. A one-shot activation service fixed the ownership.
What broke after the move
Incident 1: a deploy in the second week skipped hardware-config and didn't boot.
On 2026-04-15 the deploy inventory still listed the NAS with -h, the flag that skips regenerating hardware-configuration.nix. The build inherited another machine's disk layout, ZFS mounts failed and sshd didn't start. I rolled back to the previous generation from the boot menu, fixed the entry and redeployed. install.sh now refuses -h when the committed file belongs to another machine; see the deploy.sh guardrail.
Incident 2: no auto-snapshots for 9 days after the migration. TrueNAS sets the ZFS auto-snapshot property automatically; NixOS doesn't. I found it in the post-migration audit and added a service that sets it on every pool dataset.
Incident 3: default ring buffers → rx_missed_errors.
Symptom: ethtool -S showed rx_missed_errors rising under heavy file-share load. Raising the ring buffers to the card's maximum cleared it.
In October 2026 I replaced the SSD pool with a single 4 TB SSD.
Incident: the 2026-11-04 outage
On 4 November 2026 a routine update unmounted my storage for 14 seconds. The outage lasted 11 hours.
The mistake. I updated the locked versions of my flake inputs. On the NAS that changed the services that import the storage pools. When NixOS applies a new config to a running system, it restarts the services that changed. So the pool imports were stopped, and every dataset was unmounted for 14 seconds.
What the containers found. When the storage came back, some containers had already started on the empty folders underneath, which belong to root. Among them were the reverse proxy, the login gateway in front of it and media services. They failed with "permission denied" and "/config is not writable", and stayed down.
Why did it take 11 hours to notice? Three blind spots:
- The alert watched the wrong metric. My container-down alert read cAdvisor, and cAdvisor drops a container from its metrics once it stops. A failed container just disappeared, so the alert never fired.
- The post-deploy check counted the wrong Docker. It asked the system Docker instead of the rootless one my services run under. On my server it saw 0 containers where 26 were running.
- Nothing checked that the services answer. No probe asks them over HTTP. That's still open.
What changed:
- Storage imports never restart on a live switch. The import and mount services are marked so a configuration switch leaves them alone; a change to them waits for the next boot. NixOS reads that flag from the new config, so the deploy that added it didn't restart them either.
- New alerts read Docker itself. The host-health collector on the server and the NAS asks Docker which containers failed to start or exited badly under a restart policy, and which running ones are unhealthy. Grafana alerts on both: a failed container is critical after 5 minutes, an unhealthy one a warning after 10. On its first day the unhealthy alert found a local model server that had been unhealthy all along; its health check was fixed the same day.
- The deploy check counts the right Docker.
Next: a check that the services actually answer over HTTP. It isn't done yet.
Results
- Zero data loss in the migration: pools imported in place, all datasets and snapshots kept.
- One profile rebuilds the whole NAS, from the same repo and the same deploy pipeline as every other machine.
- No web UI. The same operating pattern as the rest of my machines: a shell, Claude Code and a declarative profile.
- The cost: everything TrueNAS did for me, I declare myself now. I missed the automatic snapshots for 9 days, and the outage above came from a live switch I control too. Now a service sets those ZFS properties on every dataset.
Stack
NixOS, ZFS, LUKS, Docker (rootless + system Docker), Docker Compose, Jellyfin and companions, node-exporter, cAdvisor, a Docker host-health collector, NFSv4, 10GbE, LACP 802.3ad, Prometheus + Grafana alerting.
Status
- Repo: private dotfiles flake (same codebase as
my-nixos-infrastructure). - Running daily: scheduled weekly deploys with a post-deploy check and rollback, ZFS scrubs scheduled, failed and unhealthy container alerts.
- Related portfolio entries:
my-homelab(the running platform and its dashboards),vps-wireguard(the network the NAS rides on),postgres-multi-tenant(the databases on the VPS),deploy-sh-guardrail.
Edited with Claude.




