The problem
Setting up a PC by hand cost me most of a day. The shell, Docker, SSH hardening, games. Then the same again on the second PC.
And again after every reinstall.
Example: two PCs
This example is made up to show the idea, with my rough estimates. Two PCs, four modules, set up by hand:
| Module | Desktop | Laptop |
|---|---|---|
| Shell + prompt | 2 h | 1 h |
| Docker | 2 h | 1 h |
| SSH hardening | 1 h | 1 h |
| Games | 2 h | — |
| Total | 7 h | 3 h |
Now each module is written once in the flake. Each PC says yes or no with one line:
| Module | Desktop | Laptop |
|---|---|---|
| Shell + prompt | on | on |
| Docker | on | on |
| SSH hardening | on | on |
| Games | on | off |
The desktop and the laptop share the shell, Docker and the SSH hardening. Only the desktop gets the games.
When I change a module, both PCs pick it up on the next update. So a fix can't be forgotten on the other machine.
How it works
Zoom
- One defaults file. Every switch lives in
lib/defaults.nix. Almost all are off. - Profiles turn things on. A machine profile inherits a type base and sets only what it needs.
- Modules only read switches. A module never asks which machine it's on. GPU code checks the GPU type, never the machine name.
A module is plain Nix. The Steam module, for example:
Adding a machine is a type base plus the switches it needs.
What's shared, what's not
| Concern | Where it's on |
|---|---|
| Firewall | every profile |
| Backups | desktops and laptops |
| Disk encryption | desktop, laptop, VPS and NAS (not WSL) |
How it deploys
- Every push is built by a build farm.
- The servers and a few other machines deploy weekly on a schedule, with a post-deploy check and automatic rollback.
- My own desktop and laptop deploy when I click.
More on the deploy side in deploy-sh-guardrail.
Today
| What | Count |
|---|---|
| Machine profiles | 10 (desktops, laptops, a Windows WSL setup, a VPS, a NAS) |
Switches in lib/defaults.nix | 219, 204 off by default |
Tracked .nix files | 354 |
| Commits | over 3,000 since July 2024 |
It started as a fork of LibrePhoenix's nixos-config. The switches, the profile inheritance, the server profiles and the deploy tooling came after.
Stack
NixOS, Nix flakes, Home Manager, NixOS-WSL, systemd, Sway, Stylix, LUKS, Restic, fail2ban, Bash, Git, git-crypt.
Status
The repo is private. It runs daily on my workstations, laptops, a production VPS and a ZFS NAS.
Related: my-homelab (what runs on top of it) and vps-wireguard (the network that connects it).




