This is the monorepo to control the FoxDen homelab pretty much in its entirety.
The gateway, a UniFi Dream Machine Pro Max (unifi), is configured from nix by unifi/unifi.py: networks, WireGuard, DHCP reservations, local DNS, port forwards, firewall policies and DDNS. Its admins and the WireGuard keys are set up by hand (see unifi/README.md). The addressing plan (VLANs, gateway and DHCP ranges) lives in nix/modules/lib/routers.nix, written for the MikroTik routers it replaced.
- Locator: Rack; 2U, Supermicro chassis
- OS: NixOS
- CPU: Dual Xeon E5-2690v4
- RAM: 256GB, DDR4-ECC, 2400 MT/s
- Storage:
- nix: XFS: RAID1: 2 * 2TB NVMe SSD
- zhdd: ZFS:
- RAIDZ2: 8 * 18 TB SATA3 HDD
- metadata special RAID1: 2 * 1TB SAS3 SSD (partition)
- zssd: XFS: RAID1: 2 * 3TB SAS3 SSD (partition)
- Network: 25GbE (SFP28; Mellanox ConnectX-6 Dx)
- Locator: Rack; Miniforum UM980 Pro
- OS: NixOS
- CPU: AMD Ryzen 9 PRO 8945HS
- RAM: 96GB, DDR5, 5600 MT/s
- Storage:
- nix: XFS: RAID1: 2 * 2TB NVMe SSS
- Network: 25GbE (SFP28; Mellanox ConnectX-4 Lx USB4)
- Locator: OVH
- OS: NixOS
- CPU: Xeon D-2141I
- RAM: 32GB, DDR4, 2133 MT/s
- Storage:
- nix: xfs: RAID1: 2 * 480GB SATA3 SSD
- ztank: ZFS:
- MIRROR: 2 * 8 TB SATA3 HDD
- Network: 1GbE (no traffic limit)
- Locator: Rack; 1U, UniFi Dream Machine Pro Max
- OS: UniFi OS
Merging to main deploys. Two workflows do it:
-
deploy.yml: NixOS hosts, on changes tonix/or the Go sources nix builds (vpn/,packetfox/). Each host pullsmainand runsnixos-rebuild switch. -
apply.yml: public DNS, the CDN and the UniFi gateway, on changes tonix/,dns/,cdn/orunifi/(and by hand from the Actions tab). It runs these in order and stops at the first failure:dns/dns.py apply --yes,cdn/cdn.py apply --yes,unifi/unifi.py apply --yes.
Both reconcilers run on every push the workflow matches. They're idempotent, so this is a no-op where nothing changed. Runs are queued and never cancelled.
Repository secrets (Settings → Actions → Secrets). Workflows on any branch pushed to this repo can read them, including Renovate's.
| Secret | Used by | What |
|---|---|---|
EXT_GITHUB_TOKEN |
all | exists already (nix's GitHub rate limit) |
CLOUDNS_AUTH_ID, CLOUDNS_PASSWORD |
dns | a ClouDNS API user (not a sub-user, since dns.py creates zones). Give it its own API user and set its allowed IPs to the home WAN addresses. |
OVH_APPLICATION_KEY, OVH_APPLICATION_SECRET, OVH_CONSUMER_KEY |
dns | an OVH application whose consumer key is limited to GET /ip, GET /ip/*/reverse, GET /ip/*/reverse/*, POST /ip/*/reverse and DELETE /ip/*/reverse/* |
FASTLY_API_KEY |
cdn | a Fastly automation token, scope global. It must cover the whole account, since cdn.py searches services and manages domains and TLS subscriptions. |
UNIFI_USERNAME, UNIFI_PASSWORD |
unifi | a local admin of the console (not a UI.com account) |
SOPS_AGE_KEY |
unifi | age identity (AGE-SECRET-KEY-…) that decrypts unifi/secrets/ (the ci_foxden_core_apply recipient in .sops.yaml) |
UNIFI_SSH_KEY |
unifi | private SSH key for root on the console (the apps section) |
OVH_ENDPOINT is a variable rather than a secret and defaults to ovh-us.
The sops key: age-keygen -o foxden-ci.age prints its public key. Make it the ci_foxden_core_apply recipient in .sops.yaml, run sops updatekeys unifi/secrets/*.yaml and commit the result. Store the private key as SOPS_AGE_KEY, then delete foxden-ci.age.
The SSH key: ssh-keygen -t ed25519 -N '' -C foxden-ci-apply -f foxden-ci, store foxden-ci as UNIFI_SSH_KEY, and add the public half to sshKeys in nix/modules/lib/udm.nix as from="10.6.11.0/24",restrict ssh-ed25519 AAAA… foxden-ci-apply. unifi.py apply --only apps installs it; run that by hand the first time, since CI needs the key to do it. CI connects over IPv4 to the console's VLAN 6 address (10.6.0.1), since over IPv6 the runners pick a SLAAC source address outside that range. The console puts the keys back at every boot (unifi/README.md, apps). The console's SSH host key is pinned in unifi/known_hosts: update it if the console is replaced or reset.
The runners reach foxMail's DKIM keys (for dns.py) through the forward rules in nix/systems/x86_64-linux/landevices/ci-firewall.nix.
- Every GitHub release artifact download where upstream does not have a digest (likely big files, currently njs/acme.js)
- ZFS Linux kernel lag-behind
- Kanidm version in nix
- UniFi OS and Network application
- zfs must be mountpoint=legacy
- DO NOT use /var/run, always use /run, or the entire OS explodes