mio-ops/hardware/raspberry_pi_3_model_B.nix

86 lines
2.3 KiB
Nix
Raw Normal View History

2019-06-26 13:25:32 +00:00
# Configuration common to all Raspberry Pi 3 Model B devices
{
2022-03-07 14:26:15 +00:00
config,
pkgs,
lib,
...
}: {
2019-10-15 23:21:58 +00:00
boot = {
initrd = {
availableKernelModules = [
2021-11-16 04:57:23 +00:00
"bcm2835_dma" # Allows early (earlier) mode setting
"i2c_bcm2835" # Allows early (earlier) mode setting
2019-10-15 23:21:58 +00:00
"usbhid"
"usb_storage"
2021-11-16 04:57:23 +00:00
"vc4" # Allows early (earlier) mode setting
2019-10-15 23:21:58 +00:00
];
};
2022-05-03 09:05:55 +00:00
kernelPackages = pkgs.linuxPackages_5_15; # For a Raspberry Pi 2 or 3)
2019-10-17 01:50:37 +00:00
kernelParams = [
2024-02-06 14:06:27 +00:00
"cma=320M" # Needed for the virtual console to work on the RPi 3
2021-11-16 04:57:23 +00:00
"console=ttyS0,115200n8" # Enable the serial console
2020-03-09 14:00:17 +00:00
"console=tty0"
2019-10-17 01:50:37 +00:00
];
2019-10-15 23:21:58 +00:00
loader = {
generic-extlinux-compatible = {
2021-11-16 04:57:23 +00:00
enable = true; # Enables the generation of /boot/extlinux/extlinux.conf
2019-10-15 23:21:58 +00:00
};
grub = {
2021-11-16 04:57:23 +00:00
enable = false; # NixOS wants to enable GRUB by default.
2019-10-15 23:21:58 +00:00
};
raspberryPi = {
enable = false;
2019-10-15 23:21:58 +00:00
version = 3;
2019-10-17 03:52:29 +00:00
firmwareConfig = ''
2019-10-17 03:56:15 +00:00
arm_64bit=1 # Force kernel loading system to assume a 64-bit kernel
2024-02-06 14:06:27 +00:00
display_auto_detect=1 # Enable auto detection of screen resolution
gpu_mem=128
2019-10-17 03:56:15 +00:00
hdmi_force_hotplug=1 # Enable headless booting
2019-10-17 03:52:29 +00:00
'';
2019-10-15 23:21:58 +00:00
};
};
};
2019-06-26 13:25:32 +00:00
# File systems configuration for using the installer's partition layout
fileSystems = {
"/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
};
2020-03-09 14:00:17 +00:00
"/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.
2022-03-07 14:26:15 +00:00
options = ["nofail" "noauto"];
2020-03-09 14:00:17 +00:00
};
2021-01-07 00:09:42 +00:00
#"/var" = {
# device = "/dev/disk/by-label/var";
# fsType = "ext4";
#};
2019-06-26 13:25:32 +00:00
};
# !!! Adding a swap file is optional, but strongly recommended!
2022-03-07 14:26:15 +00:00
swapDevices = [
{
device = "/swapfile";
size = 1024;
}
];
2019-06-26 13:25:32 +00:00
2019-10-15 23:21:58 +00:00
hardware = {
2021-11-16 04:57:23 +00:00
enableRedistributableFirmware = true; # Enable support for Pi firmware blobs
2019-10-15 23:21:58 +00:00
};
2019-06-26 13:25:32 +00:00
2019-10-16 01:54:23 +00:00
networking = {
2022-07-11 05:52:41 +00:00
enableB43Firmware = true; # If true, enable Pi wireless firmware
2019-10-16 01:54:23 +00:00
};
2022-07-11 05:52:41 +00:00
nixpkgs.config.allowUnfree = true; # required by B34Firmare above
2022-03-07 14:26:15 +00:00
environment.systemPackages = with pkgs; [
libraspberrypi # Userland tools for the Raspberry Pi board
];
2019-06-26 13:25:32 +00:00
}