Disk Partitioning
When reinstalling NixOS from an existing configuration, the only manual step is often disk partitioning. But even this step can be automated using disko.
Setup
To create a new disko configuration, copy one of the existing disko configurations into configs/nixos/$(hostname)/disko.nix
.
Copy an existing disko configuration into the host’s configuration directory.
Edit the disk layout according to your needs. Replace
disko.devices.disk.main.device
with the name listed bylsblk
for your main drive.Apply the disko configuration.
Generate a new hardware configuration excluding the filesystem configurations provided by disko.