Nix configuration to manage multiple machines declaratively.
-
flake.nix— entry point, inputs, and theapplydev shell -
lib/—mksystem.nix(system builder) andidentity.nix(personal data) -
modules/—common.nix,darwin.nix,nixos.nix -
home/— home-manager modules (one file per program) -
machines/<host>/— per-machine overrides and hardware config
Enter the development shell.
nix developApply the configuration for the current machine. The apply script only
rebuilds the local machine; it does not deploy to remote hosts.
applyApply a different host’s configuration explicitly (useful for testing a
config locally before deploying it). Extra arguments are forwarded to the
underlying darwin-rebuild / nixos-rebuild.
apply ms-fw-desktop
apply ms-fw-desktop --show-traceOr, without entering the shell first.
nix develop --command applyFormat all Nix files.
nix fmt .system.stateVersion (NixOS / nix-darwin) and home.stateVersion
(home-manager) are recorded once when a host is first installed and should
not be bumped without first reading the corresponding release notes. They
exist so option defaults remain stable across upgrades; changing them can
silently alter system behavior.
For a new macOS machine, run the following to bootstrap. The URL pins
nix-darwin to the same 0.1 series used by flake.nix for reproducibility.
nix run https://flakehub.com/f/nix-darwin/nix-darwin/0.1 -- \
switch --flake .#ms-macbook-airFor a new NixOS machine, first boot the official NixOS installer, then clone
this repository onto the target machine and generate a hardware config for
the host (see machines/ms-fw-desktop/hardware.nix for an example — that
file was produced by nixos-generate-config and is host-specific). Once a
machine module exists, run:
sudo nixos-rebuild switch --flake .#ms-fw-desktop