This machine profile is used for my three Raspberry Pi 4B machines. These machines were set up using the official NixOS SD card images.
{ config, lib, ... }:
let
cfg = config.mjm.profiles.raspberry-pi;
in
{
options.mjm.profiles.raspberry-pi = {
enable = lib.mkEnableOption "Raspberry Pi hardware support";
};
config = lib.mkIf cfg.enable {
<<config>>
};
}nixpkgs.hostPlatform = "aarch64-linux";
Of course, Raspberry Pi is an aarch64 device.
boot.loader.systemd-boot.enable = true;
While I initially provisioned these machines with the NixOS SD card images, which use U-Boot, they now run UEFI firmware and can boot with systemd-boot like everything else.
boot.initrd.systemd.tpm2.enable = false;
Raspberry Pis don't have a TPM. I don't remember at this point what the failure looks like if you leave this enabled, but it did cause problems.
boot.initrd.availableKernelModules = [ "usbhid" "usb_storage" "vc4" "pcie_brcmstb" "reset-raspberrypi" ];
These modules come from the nixos-hardware repo, which I don't use for this because its modules enable their configuration on import rather than gating it behind an option.
hardware.enableRedistributableFirmware = true;
Generally just a good idea to enable redistributable firmware. Little downside, and you like your hardware to work, don't you?
text/gemini;lang=en-USThis content has been proxied by September (UNKNO).