I am currently researching how to do an unintended NixOS install via USB stick.
It should re-partition and install a minimal NixOS with just a ssh pub key setup to log into.
All without user interaction.
After searching a bit I came across the following information and repos.
nixos-auto-installer seems like what I am after. nixos-offline-installer would be even cooler - but feels like a cherry on top.
I couldn’t really find an “official” approach yet. Is there one?
Is there any other approach that I should look into?
Or is nixos-auto-installer a good path to follow?
@tfc and I are currently working on a nix.dev tutorial to deploy a fresh NixOS via SSH with nixos-anywhere and partitioning with disko. The difference to what you’re looking for will be minimal.
I currently only have the relevant code in a private repo, but the idea is that you define a regular installer image, and add a tiny extra script that is launched on login and essentially runs:
The auto installer and offline installer both attempt to do the same thing. Please ignore the offline installer, as the auto installer is the newer repository. It does both install automatically and is fully offline-capable.
At Nixcademy, we use it throughout the Nix & NixOS 101 class to prepare training laptops with a standardized NixOS installation.