Generate bootable images straight to the disk.
Note
Pro Tipp: When working in this repository use just
to run the build commands. This allows to skip the build
section
For building and booting Raspberry Pi 5 images, refer to the important discussion here: NixOS Issue #260754.
Run the following command to build the SD card image for Raspberry Pi 5:
nix --experimental-features 'nix-command flakes' build './boot/#nixosConfigurations.pi.config.system.build.sdImage'
For other Linux devices, such as physical servers, use the raw-efi
format for UEFI-compatible bootable images.
Run the following command to build the bootable disk image:
nix --experimental-features 'nix-command flakes' build './boot/#diskImage'
This uses nixos-generators to produce the image in raw-efi
format.
Warning
🔴 IMPORTANT: The Linux ISO that is built is currently not tested.
To write the generated image to a disk, ensure zstd
is available by running:
nix-shell -p zstd
Then copy the image to your disk with the following command:
For SD card images:
zstdcat result/nixos-sd-image-24.05.20241116.e8c38b7-aarch64-linux.img.zst | dd of=/dev/sdX status=progress
For raw or raw-efi images:
zstdcat result/disk-image.img.zst | dd of=/dev/sdX status=progress
Replace /dev/sdX
with the appropriate disk or SD card device.
- Integrate disko-nix for better disk partitioning and management.