work // nixos

Celestial: one flake, four machines

:: updated 30 November 2026 :: 5 min :: source

contents

Celestial is the repository that defines every machine I use day to day: one desktop and three laptops, all NixOS, all built from a single flake. The hosts are named after moons and goddesses (io, ganymedes, nymphe, aphrodite) because I needed names and Jupiter had plenty.

This page is about the design: which decisions the structure rests on and what each one costs. The procedures (installing, keys, Secure Boot) are in the README.

The problem

Four machines drift. A package installed on one, a tweak on another, a laptop that hasn’t been updated in a month because it lives in a drawer. Configuration management tools fix the what but not the when: something still has to run on each machine, and it still has to build.

I wanted three things. Every machine described by the same repository. A change made once and picked up everywhere. And no machine ever compiling anything, because a laptop on battery should not be building a kernel.

Hosts are folders

flake.nix doesn’t keep a list of hosts. Every folder under system/per_host/ is one, and mkHost builds each with the same layers:

system/                     baseline every machine gets
system/per_host/<name>/     what makes this one different
diy-modules/                the host.* options those folders fill in
user/artesia/               home-manager, the same on every host
imports/                    third-party modules (home-manager, sops-nix, disko, lanzaboote)
overlays/                   newer versions of a few apps, plus my own packages as pkgs.diy

Adding a machine is creating a folder. CI asks the flake for nixosConfigurations, gets the folder names back and builds one job per host. There is nothing to keep in sync, which also means the folder name is load-bearing: rename it and you’ve renamed the machine.

Facts stated once

The most useful pattern in the repo is host.* options in diy-modules/. A machine’s facts are written down once, in its own folder, and everything else reads them back:

FactRead by
host.monitorsniri and sway output blocks, generated
host.diskdisko’s partition layout
host.dmithe installer, to recognise the machine
host.gpu, host.cursordrivers, cursor size in the user layer

The monitors are the clearest win. Three screens on io, one on each laptop, and two compositors that each want positions and scales in their own syntax. Writing them once as data and generating both configs means they can’t disagree.

Feature switches sit on top: host.laptop, host.secureboot, host.gaming, host.upgrade. Each bundles several settings behind one option, so a host file reads like a description of the machine rather than a list of tweaks.

Secrets that switch things on

There is one sops file, encrypted for every host’s age key plus a backup key. Some modules have no enable option at all: they turn on because their secret exists. host_backup.nix starts a daily restic backup of the home directory once the file holds <hostname>-restic. host_atuin.nix logs in to the sync server once it holds atuin.

The trade-off is discoverability. Reading a host’s folder doesn’t tell you it’s backed up; you have to know the convention. I accepted that because the alternative, an enable flag and a secret, gives you two things to get out of sync and a config that evaluates but fails at runtime.

Build once, download everywhere

This is the part that makes four machines feel like one.

  1. I run deploy "message" on whichever machine I’m at. It rebases onto main, formats, lints, switches locally, and only then commits and pushes.
  2. GitHub Actions builds every host on that push and pushes the closures to attic, my self-hosted binary cache. The handful of packages that take ages to build also go to cachix.
  3. Every other machine follows main by itself, twice a day, and only ever downloads what CI built. That mechanism has its own page.

Nothing is compiled on a host. If CI hasn’t built it, the host doesn’t take it, and a machine I’ve switched by hand is left alone until I say otherwise.

Lock file updates go through the same pipeline. update-flake.yml bumps flake.lock every Monday, and the pinned extras (AppImage browsers, the Pangolin client, VS Code extensions) daily. It builds every host first and only opens a pull request if that passes, so an open PR is already known good and merging it is the whole upgrade.

The installer carries no configuration

The installer ISO is deliberately dumb. It boots, clones the repo, and runs the same scripts/setup-host.sh I’d run on an existing NixOS machine. A machine whose DMI name matches some host’s host.dmi is recognised and installed as that host. A new machine gets a folder generated from what the hardware reports.

Because the stick clones at runtime, it never goes stale when hosts change. CI only rebuilds the image when installer/, flake.nix or the lock changes.

An optional second stick labelled CEL_KEYS carries the host’s age key, disk passphrase and wifi profiles. With it the install asks nothing and secrets work from the first boot.

What it costs

Following main means a bad merge reaches every machine. Three things soften that: hosts take the new generation at next boot rather than switching live, a generation made by hand is never overwritten, and nothing lands that CI couldn’t build. It still trusts that “it built” means “it works”, and nix flake check with a VM test of the upgrade unit is most of what stands between those two.

The cache sits behind my home uplink. Every CI job pushes through it and every remote machine pulls through it, so a slow connection at home makes everything slow. Cachix is the CDN fallback for the packages that matter most, but its free tier is 5 GB, so only a short list goes there.

Nix itself is the biggest cost. I spent weeks learning the language before the structure here made sense, and it’s still easy to write something that evaluates and does the wrong thing.

Where to look

The structure doc has the diagrams and a “where does a change go” table. Anyone can clone and use it, but my secrets are no use to you and the layout is whatever made sense to me at the time.