sd-image.nix imports all-hardware.nix which adds modules like dw-hdmi that don't exist in the RPi4 kernel. mkForce the availableKernelModules list to only include Pi-relevant modules.
38 lines
807 B
Nix
38 lines
807 B
Nix
# SD Card image configuration for Raspberry Pi
|
|
{
|
|
config,
|
|
modulesPath,
|
|
lib,
|
|
...
|
|
}:
|
|
|
|
{
|
|
imports = [
|
|
(modulesPath + "/installer/sd-card/sd-image-aarch64.nix")
|
|
];
|
|
|
|
sdImage = {
|
|
# Compress with zstd for smaller download
|
|
compressImage = true;
|
|
|
|
# Auto-expand root partition on first boot
|
|
expandOnBoot = true;
|
|
};
|
|
|
|
# Image filename based on hostname
|
|
image.fileName = "${config.networking.hostName}-sd-image.img";
|
|
|
|
# Disable ZFS to avoid build issues on SD image
|
|
boot.supportedFilesystems = lib.mkForce [
|
|
"vfat"
|
|
"ext4"
|
|
];
|
|
|
|
# sd-image.nix imports all-hardware.nix which adds x86 modules like dw-hdmi
|
|
# that don't exist in the RPi4 kernel. Filter them out.
|
|
boot.initrd.availableKernelModules = lib.mkForce [
|
|
"xhci_pci"
|
|
"usbhid"
|
|
"usb_storage"
|
|
];
|
|
}
|