Perform a fresh NixOS installation with disko-install
masterUse disko-install to automate partitioning and NixOS installation on a target disk. This is useful for fresh installations or creating bootable USB sticks from a workstation.
Requirements:
- A Linux system with Nix installed.
- A target disk or partition.
- A Nix flake defining your NixOS configuration.
Workflow:
- Generate a base configuration using
nixos-generate-config --root /tmp/config --no-filesystems. - Edit
configuration.nixand create aflake.nixin/tmp/config/etc/nixosthat includesdisko.nixosModules.diskoand yourdisko.devicesdefinition. - Identify your target device using
lsblk. - Run the
disko-installcommand vianix run.
sudo nix run 'github:nix-community/disko/latest#disko-install' -- --flake <flake-url>#<flake-attr> --disk <disk-name> <disk-device>