Deploy a NixOS Host
Use this when building, deploying, or rolling back a NixOS host from this repo. Host inventory lives in Fleet; architecture background lives in Architecture/NixOS.
Quick checks
Confirm the host exists in the flake:
nix eval --json .#nixosConfigurations --apply builtins.attrNamesBuild the system closure without deploying:
nix build .#nixosConfigurations.<hostname>.config.system.build.toplevel --no-linkOperator-run ARM host builds always use Fleet/forge; use the exact pre-PR build command in Runbooks/Validate Infra Changes.
Run a harmless remote command through the host app:
nix run .#<hostname> -- date
Deploy safely
Prefer
bootfor remote or headless hosts. It builds and installs the new generation, but activation waits until the next reboot:nixos-rebuild boot --sudo --target-host <hostname> --flake .#<hostname>Use
switchwhen immediate activation is intended:nixos-rebuild switch --flake .#<hostname> --target-host <hostname> --sudoFor offsite or Tailscale-only paths, use the reachable target host name:
nixos-rebuild boot --sudo --target-host <hostname>.<tailnet-name> --flake .#<hostname>
After deploying
Verify the host answers:
nix run .#<hostname> -- hostname nix run .#<hostname> -- systemctl --failed --no-pagerIf the change touched a service, check that unit explicitly:
nix run .#<hostname> -- systemctl --no-pager --full status <unit>.service nix run .#<hostname> -- journalctl -u <unit>.service -n 80 --no-pager
Roll back
If the host is reachable and the current generation is bad:
nix run .#<hostname> -- sudo nixos-rebuild switch --rollbackIf remote access is risky, use the bootloader console or local access and select the previous generation.
Adding a host
Kubernetes nodes are declared inline in
nixosConfigurationsinflake.nixviamkHost; the hostname is the attr name and cluster membership comes fromtags = [ "folly" ]or[ "offsite" ].Standalone hosts with unique config get a file under
nix/hosts/<hostname>.nixand aflake.nixhost entry pointing at it.Validate after adding a host:
nix flake check nix build .#nixosConfigurations.<hostname>.config.system.build.toplevel --no-link
Dotfiles
Dotfiles are mise-managed from the in-repo
dotfiles/tree.nix/system/mise-dotfiles.nixcarries that subtree into the system closure and runsmise run bootstrapduring activation.Shell tooling (eza, fzf, neovim, bat, ripgrep, fd, delta, jq, gh, btop, sd, 1password-cli) and zsh plugins (pure, fzf-tab, autosuggestions, syntax-highlighting, kube-ps1) come from home-manager for the
jawnuser vianix/system/home-manager.nixandnix/home/jawn.nix. Activation setsHM_ACTIVATED=1sodotfiles/scripts/deploy-dotfiles.shskips deploying~/.config/zshon those hosts.The bootstrap task routes by OS; there is no dotfiles-only bootstrap flag.
Auto-upgrade caveat
Hosts auto-rebuild from GitHub
main. A config deployed from a branch can be reverted by the next auto-upgrade unless the branch merges promptly. Treat a branch deploy as a test unless it has merged.
Linked references 5
Step-by-step: Runbooks/Deploy a NixOS Host. Host inventory: Fleet. Layer background: Architecture/NixOS.
Layer 1: bare metal. Every host in the fleet is declared as NixOS in one flake at the repo root (flake.nix), configured under nix/. A few hosts run something else and are being brought across — Fleet lists the machine inventory and the known divergence. Runbooks/Deploy a NixOS Host has the build/deploy/rollback commands; this page is architecture only.
Actual nixos-rebuild/nix build invocations, adding a new host, rollback, and the auto-upgrade branch-revert caveat in command form: Runbooks/Deploy a NixOS Host.
Runbooks/Deploy a NixOS Host — build, deploy, verify, and roll back NixOS hosts