Current Process
I manage multiple NixOS machines using a flake. When adding a new machine, I follow this manual process:
- Boot from NixOS installation ISO
- Partition, format, and mount disks
- Run
nixos-generate-config
- Copy the generated hardware-config.nix to my flake repo
- Edit configuration.nix to enable SSH and root login
- Run
nixos-install
- Perform remote build using
nix run nixpkgs#nixos-rebuild -- --fast --target-host root@<machine> --build-host root@<machine> --flake . --use-remote-sudo switch
Proposed Improvement
I want to streamline this using colmena and nixos-anywhere for fleet management. While these tools solve many aspects, handling hardware configurations remains challenging.
Current Pain Points
Currently, I must:
- Manually copy each machine’s hardware-config.nix to my repo
- Maintain separate hardware configs for each machine
- Clean up hardware-config.nix files when machines are destroyed
- Repeat the process for each new machine in bulk deployments
- Deal with configuration drift if hardware changes
- Manage an ever-growing collection of hardware-specific files
Is there a more efficient way to handle hardware configurations in a dynamic fleet environment? Thanks to nixos-anywhere, automating the initial installation process is straightforward, but managing hardware configurations after deployment remains challenging. Ideally, I’d like a solution that reduces manual intervention and makes machine addition/removal more seamless.