2022-05-17 05:47:43 +00:00
|
|
|
|
# this file originates from ‘nixos-generate-config’
|
|
|
|
|
# but has been heavily modified
|
2022-04-27 06:38:39 +00:00
|
|
|
|
{ config, lib, pkgs, modulesPath, ... }:
|
|
|
|
|
|
|
|
|
|
{
|
2022-05-17 21:19:54 +00:00
|
|
|
|
# enables non-free firmware
|
2022-05-17 06:43:24 +00:00
|
|
|
|
hardware.enableRedistributableFirmware = true;
|
2022-04-27 06:38:39 +00:00
|
|
|
|
|
2022-05-17 05:47:43 +00:00
|
|
|
|
# XXX colin: these four statements were autogenerated and placed here: why?
|
|
|
|
|
# boot.initrd.availableKernelModules = [ "xhci_pci" "usbhid" "usb_storage" ];
|
|
|
|
|
# boot.initrd.kernelModules = [ ];
|
|
|
|
|
# boot.kernelModules = [ ];
|
|
|
|
|
# boot.extraModulePackages = [ ];
|
2022-04-27 06:38:39 +00:00
|
|
|
|
|
2022-05-17 21:19:54 +00:00
|
|
|
|
# default nixos-21.11 kernel of 5.10 doesn't have the rpi-400 device tree blob.
|
|
|
|
|
# turns out 5.15, 5.16, 5.17 are all unable to boot the pi from usb (they fail to "direct load" certain broadcom firmware).
|
|
|
|
|
# linuxPackages_rpi4 uses 5.10, but supplies the pi-400 dtb & boots fine.
|
|
|
|
|
# boot.kernelPackages = pkgs.linuxPackages_latest;
|
|
|
|
|
# boot.kernelPackages = pkgs.linuxPackages_5_15;
|
|
|
|
|
# boot.kernelPackages = pkgs.linuxPackages_5_16;
|
|
|
|
|
boot.kernelPackages = pkgs.linuxPackages_rpi4;
|
|
|
|
|
|
2022-05-17 05:47:43 +00:00
|
|
|
|
# NixOS defaults to grub: we don't want that.
|
|
|
|
|
boot.loader.grub.enable = false;
|
2022-05-17 09:10:26 +00:00
|
|
|
|
# raspberryPi boot loader creates extlinux.conf.
|
|
|
|
|
# otherwise, enable the generic-extlinux-compatible loader below.
|
|
|
|
|
# note: THESE ARE MUTUALLY EXCLUSIVE. generic-extlinux-compatible causes uboot to not be built
|
|
|
|
|
# boot.loader.generic-extlinux-compatible.enable = true;
|
2022-05-17 05:47:43 +00:00
|
|
|
|
boot.loader.raspberryPiColin.enable = true;
|
|
|
|
|
boot.loader.raspberryPiColin.uboot.enable = true;
|
|
|
|
|
boot.loader.raspberryPiColin.version = 4;
|
|
|
|
|
|
|
|
|
|
boot.initrd.availableKernelModules = [
|
|
|
|
|
"bcm2711_thermal"
|
|
|
|
|
"bcm_phy_lib"
|
|
|
|
|
"brcmfmac"
|
|
|
|
|
"brcmutil"
|
|
|
|
|
"broadcom"
|
|
|
|
|
"clk_raspberrypi"
|
|
|
|
|
"drm" # Direct Render Manager
|
|
|
|
|
"enclosure" # SCSI ?
|
|
|
|
|
"fuse"
|
|
|
|
|
"mdio_bcm_unimac"
|
|
|
|
|
"pcie_brcmstb"
|
|
|
|
|
"raspberrypi_cpufreq"
|
|
|
|
|
"raspberrypi_hwmon"
|
|
|
|
|
"ses" # SCSI Enclosure Services
|
|
|
|
|
"uas" # USB attached storage
|
|
|
|
|
"uio" # userspace IO
|
|
|
|
|
"uio_pdrv_genirq"
|
|
|
|
|
"xhci_pci"
|
|
|
|
|
"xhci_pci_renesas"
|
|
|
|
|
];
|
2022-05-17 21:19:54 +00:00
|
|
|
|
# boot.initrd.compressor = "gzip"; # defaults to zstd
|
2022-05-17 05:47:43 +00:00
|
|
|
|
# hack in the `boot.shell_on_fail` arg since it doesn't seem to work otherwise
|
|
|
|
|
boot.initrd.preFailCommands = "allowShell=1";
|
|
|
|
|
# default: 4 (warn). 7 is debug
|
2022-05-17 21:19:54 +00:00
|
|
|
|
boot.consoleLogLevel = 7;
|
2022-05-17 05:47:43 +00:00
|
|
|
|
# boot.kernelParams = [
|
|
|
|
|
# "boot.shell_on_fail"
|
|
|
|
|
# # "boot.trace"
|
|
|
|
|
# # "systemd.log_level=debug"
|
|
|
|
|
# # "systemd.log_target=console"
|
|
|
|
|
# ];
|
2022-04-27 06:38:39 +00:00
|
|
|
|
|
2022-05-17 21:19:54 +00:00
|
|
|
|
# ondemand power scaling keeps the cpu at low frequency when idle, and sets to max frequency
|
|
|
|
|
# when load is detected. (v.s. the "performance" default, which always uses the max frequency)
|
|
|
|
|
powerManagement.cpuFreqGovernor = "ondemand";
|
2022-04-27 06:38:39 +00:00
|
|
|
|
}
|