66 lines
1.6 KiB
Nix
66 lines
1.6 KiB
Nix
|
# Configuration common to all Raspberry Pi 4 Model B devices
|
||
|
{
|
||
|
config,
|
||
|
pkgs,
|
||
|
lib,
|
||
|
...
|
||
|
}: {
|
||
|
boot = {
|
||
|
initrd = {
|
||
|
availableKernelModules = [
|
||
|
"usbhid"
|
||
|
"usb_storage"
|
||
|
];
|
||
|
};
|
||
|
kernelPackages = pkgs.linuxKernel.kernels.linux_rpi4; # For a Raspberry Pi 4
|
||
|
kernelParams = [
|
||
|
"cma=128M" # Many GUI programs need this, nearly all wayland applications
|
||
|
"8250.nr_uarts=1"
|
||
|
"console=ttyAMA0,115200" # the serial console broken out to the GPIO
|
||
|
"console=tty1"
|
||
|
];
|
||
|
loader = {
|
||
|
grub = {
|
||
|
enable = false; # NixOS wants to enable GRUB by default.
|
||
|
};
|
||
|
raspberryPi = {
|
||
|
enable = true;
|
||
|
version = 4;
|
||
|
};
|
||
|
};
|
||
|
tmpOnTmpfs = true;
|
||
|
};
|
||
|
|
||
|
# 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"];
|
||
|
};
|
||
|
};
|
||
|
|
||
|
# !!! Adding a swap file is optional, but strongly recommended!
|
||
|
swapDevices = [
|
||
|
{
|
||
|
device = "/swapfile";
|
||
|
size = 1024;
|
||
|
}
|
||
|
];
|
||
|
|
||
|
hardware = {
|
||
|
enableRedistributableFirmware = true; # Enable support for Pi firmware blobs
|
||
|
};
|
||
|
|
||
|
environment.systemPackages = with pkgs; [
|
||
|
libraspberrypi # Userland tools for the Raspberry Pi board
|
||
|
];
|
||
|
}
|