Changes to rpi setup
This commit is contained in:
+16
-50
@@ -2,56 +2,37 @@
|
||||
|
||||
# Hardware configuration for the primary Raspberry Pi 4 (8 GB).
|
||||
#
|
||||
# SD card layout assumed:
|
||||
# /dev/mmcblk0p1 — /boot/firmware (FAT32, ~256 MB)
|
||||
# /dev/mmcblk0p2 — / (ext4)
|
||||
# nixos-raspberrypi's raspberry-pi-4.base module (imported in flake.nix)
|
||||
# provides everything that nixos-hardware.raspberry-pi-4 previously did:
|
||||
# - linuxPackages_rpi4 vendor kernel + matching firmware
|
||||
# - u-boot bootloader with /boot/firmware partition management
|
||||
# - initrd modules (xhci_pci, usbhid, usb_storage, vc4, pcie_brcmstb, etc.)
|
||||
# - config.txt generation
|
||||
#
|
||||
# This file adds only host-specific overrides on top of that.
|
||||
#
|
||||
# External HD:
|
||||
# Set homey.storage.device to the by-id path of your USB drive.
|
||||
# Example: /dev/disk/by-id/usb-WD_Elements_12345-0:0-part1
|
||||
# Find it with: ls -la /dev/disk/by-id/
|
||||
#
|
||||
# To generate this file fresh after installing NixOS on the Pi, run:
|
||||
# nixos-generate-config --show-hardware-config
|
||||
# and merge the output here.
|
||||
# TODO: Verify SD card partition labels after first flash.
|
||||
# The config assumes labels NIXOS_SD (root) and FIRMWARE (boot).
|
||||
# Check with: lsblk -o NAME,LABEL
|
||||
# Update fileSystems entries below if they differ.
|
||||
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
# tmpfs for /tmp — keep the SD card writes down
|
||||
boot.tmp.useTmpfs = true;
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Boot loader — Raspberry Pi 4 uses U-Boot / extlinux
|
||||
# -------------------------------------------------------------------------
|
||||
boot = {
|
||||
loader = {
|
||||
grub.enable = false;
|
||||
generic-extlinux-compatible.enable = true;
|
||||
};
|
||||
|
||||
# Pi 4 kernel — use the mainline kernel with RPi patches
|
||||
kernelPackages = pkgs.linuxPackages_rpi4;
|
||||
|
||||
# tmpfs for /tmp — keep the SD card writes down
|
||||
tmp.useTmpfs = true;
|
||||
|
||||
# Modules needed for USB storage (external HD)
|
||||
initrd.availableKernelModules = [ "xhci_pci" "usbhid" "usb_storage" "uas" ];
|
||||
kernelModules = [];
|
||||
extraModulePackages = [];
|
||||
};
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Filesystems
|
||||
# -------------------------------------------------------------------------
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-label/NIXOS_SD"; # label the root partition NIXOS_SD when flashing
|
||||
device = "/dev/disk/by-label/NIXOS_SD";
|
||||
fsType = "ext4";
|
||||
options = [ "noatime" ];
|
||||
};
|
||||
|
||||
fileSystems."/boot/firmware" = {
|
||||
device = "/dev/disk/by-label/FIRMWARE"; # FAT32 boot partition
|
||||
device = "/dev/disk/by-label/FIRMWARE";
|
||||
fsType = "vfat";
|
||||
options = [ "fmask=0022" "dmask=0022" ];
|
||||
};
|
||||
@@ -61,24 +42,9 @@
|
||||
|
||||
swapDevices = [];
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Hardware
|
||||
# -------------------------------------------------------------------------
|
||||
hardware = {
|
||||
# Enable the RPi firmware (needed for GPU, WiFi, Bluetooth)
|
||||
raspberry-pi."4".apply-overlays-dtmerge.enable = true;
|
||||
|
||||
# Disable GPU memory split for a headless server (gives more RAM to OS)
|
||||
# Set via config.txt if needed: gpu_mem=16
|
||||
};
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Platform
|
||||
# -------------------------------------------------------------------------
|
||||
nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
# Power management
|
||||
# -------------------------------------------------------------------------
|
||||
powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user