Never-committed working tree state found in the dev worktree: a Pi 4 hardware module, a setup walkthrough, an upboard-serial refactor, and flake wiring that does not evaluate (aarch64 packages block nested inside packages.x86_64-linux; pkgs-aarch64 built with `inherit aarch64` instead of `system`, so it is really x86; references a nixosConfigurations.rpi4-installed that is never defined). Parked verbatim for reference. The real Pi 4 target is rebuilt on top of #87's mkPiInstalled/mkPiImage shape in feat/rpi4-target. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013A6683cCHnQxFUosx1krY4
124 lines
3.1 KiB
Nix
124 lines
3.1 KiB
Nix
# Raspberry Pi 4 Hardware Configuration
|
|
# For bitSpire deployments on Raspberry Pi 4
|
|
# Requires: 4GB+ RAM (8GB recommended for Electron + kiosk)
|
|
# Storage: SD card or external SSD/eMMC (minimum 32GB)
|
|
#
|
|
# Note: Import shared serial peripheral configuration for consistency
|
|
# with other bitSpire hardware (useful for future extensions).
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
{
|
|
# Import shared serial peripheral configuration (useful for future hardware extensions)
|
|
imports = [ ./upboard-serial.nix ];
|
|
|
|
# Raspberry Pi 4 uses aarch64 architecture
|
|
boot.kernelPackages = pkgs.linuxPackages_rpi4;
|
|
|
|
boot = {
|
|
loader = {
|
|
# Raspberry Pi 4 uses the Raspberry Pi firmware bootloader (rpi-bootloader)
|
|
grub.enable = lib.mkForce false;
|
|
# raspberryPi.enable has been removed in recent nixpkgs
|
|
# rpi-bootloader is now built into rpi4 kernel packages
|
|
};
|
|
|
|
initrd.availableKernelModules = [
|
|
"xhci_pci"
|
|
"usb_storage"
|
|
"sdhci_pci"
|
|
"sdhci"
|
|
"sd_mod"
|
|
"brcmmac"
|
|
"brcmfmac"
|
|
"mmc_block"
|
|
"cma"
|
|
];
|
|
|
|
initrd.kernelModules = [
|
|
"sdhci_pci"
|
|
"sdhci"
|
|
"mmc_block"
|
|
"brcmmac"
|
|
"brcmfmac"
|
|
"cma"
|
|
];
|
|
|
|
kernelModules = [
|
|
"kvm-arm"
|
|
"uas"
|
|
];
|
|
|
|
kernelParams = [
|
|
"console=tty1"
|
|
"console=ttyAMA0,115200n8"
|
|
"console=ttyS0,115200n8"
|
|
"root=/dev/mmcblk0p2"
|
|
"rootfstype=ext4"
|
|
"rootwait"
|
|
"rw"
|
|
# Disable PCIe to save power (optional - uncomment if needed)
|
|
# "pcie_aspm=off"
|
|
];
|
|
};
|
|
|
|
# Filesystem layout: SD card with GPT partition table
|
|
# Partition 1: EFI System Partition (FAT32)
|
|
# Partition 2: Root filesystem (ext4)
|
|
fileSystems."/" = {
|
|
device = "/dev/disk/by-label/nixos";
|
|
fsType = "ext4";
|
|
options = [ "noatime" ];
|
|
};
|
|
|
|
fileSystems."/boot" = {
|
|
device = "/dev/disk/by-label/ESP";
|
|
fsType = "vfat";
|
|
options = [ "defaults" "nofail" ];
|
|
};
|
|
|
|
# Swap configuration for better reliability on SD cards
|
|
swapDevices = [{
|
|
device = "/swapfile";
|
|
size = 2048; # 2GB swap
|
|
}];
|
|
|
|
# Power management for Raspberry Pi
|
|
powerManagement = {
|
|
enable = true;
|
|
cpuFreqGovernor = "ondemand";
|
|
};
|
|
|
|
# Disable suspend/hibernate for kiosk stability
|
|
systemd.targets = {
|
|
sleep.enable = false;
|
|
suspend.enable = false;
|
|
hibernate.enable = false;
|
|
hybrid-sleep.enable = false;
|
|
};
|
|
|
|
# Hardware-specific settings
|
|
hardware = {
|
|
# Raspberry Pi 4 has no discrete GPU (uses VideoCore)
|
|
graphics = {
|
|
enable = true;
|
|
};
|
|
|
|
# USB mass storage drivers (not applicable for ARM - handled by kernel modules)
|
|
# usb.enable = true;
|
|
# usb.enableUSBHub = true;
|
|
|
|
# RPi4-specific tweaks
|
|
enableRedistributableFirmware = true;
|
|
# CPU firmware (not applicable for ARM - no x86 microcode)
|
|
# cpu.amd64.updateMicrocode = false; # Not applicable for ARM
|
|
};
|
|
|
|
# USB configuration (not applicable for ARM)
|
|
# hardware.usb.enable = true;
|
|
# hardware.usb.enableUSBHub = true;
|
|
|
|
# Network configuration
|
|
# useDHCP is set in configuration.nix (base config)
|
|
networking.interfaces.eth0.useDHCP = true;
|
|
}
|