reciproka-ops/hardware/raspberry_pi_3_model_B.nix
2024-09-11 23:57:46 +10:00

87 lines
2.4 KiB
Nix

# Configuration common to all Raspberry Pi 3 Model B devices
{
config,
pkgs,
lib,
...
}: {
boot = {
initrd = {
availableKernelModules = [
"bcm2835_dma" # Allows early (earlier) mode setting
"i2c_bcm2835" # Allows early (earlier) mode setting
"usbhid"
"usb_storage"
"vc4" # Allows early (earlier) mode setting
];
};
kernelPackages = pkgs.linuxPackages_5_15; # For a Raspberry Pi 2 or 3)
kernelParams = [
"cma=320M" # Needed for the virtual console to work on the RPi 3
"console=ttyS0,115200n8" # Enable the serial console
"console=tty0"
];
loader = {
generic-extlinux-compatible = {
enable = true; # Enables the generation of /boot/extlinux/extlinux.conf
configurationLimit = 5;
};
grub = {
enable = false; # NixOS wants to enable GRUB by default.
};
raspberryPi = {
enable = false;
version = 3;
firmwareConfig = ''
arm_64bit=1 # Force kernel loading system to assume a 64-bit kernel
display_auto_detect=1 # Enable auto detection of screen resolution
gpu_mem=128
hdmi_force_hotplug=1 # Enable headless booting
'';
};
};
};
# File systems configuration for using the installer's partition layout
fileSystems = {
"/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
};
"/boot/firmware" = {
device = "/dev/disk/by-label/FIRMWARE";
fsType = "vfat";
# Alternatively, this could be removed from the configuration.
# The filesystem is not needed at runtime, it could be treated
# as an opaque blob instead of a discrete FAT32 filesystem.
options = ["nofail" "noauto"];
};
#"/var" = {
# device = "/dev/disk/by-label/var";
# fsType = "ext4";
#};
};
# !!! Adding a swap file is optional, but strongly recommended!
swapDevices = [
{
device = "/swapfile";
size = 1024;
}
];
hardware = {
enableRedistributableFirmware = true; # Enable support for Pi firmware blobs
};
networking = {
enableB43Firmware = true; # If true, enable Pi wireless firmware
};
nixpkgs.config.allowUnfree = true; # required by B34Firmare above
environment.systemPackages = with pkgs; [
libraspberrypi # Userland tools for the Raspberry Pi board
];
}