Move Raspberry Pi 4 support to a module

This commit is contained in:
Greg Hellings
2022-04-25 22:18:41 -05:00
parent 64cbe3dd1f
commit a992c7c560
5 changed files with 64 additions and 53 deletions
+1
View File
@@ -3,5 +3,6 @@
{
imports = [
./proxy.nix
./rpi4.nix
];
}
+43
View File
@@ -0,0 +1,43 @@
{ config, lib, pkgs, ... }:
let
cfg = config.greg.rpi4;
in with lib; {
options = {
greg.rpi4 = {
enable = mkEnableOption "Enable support for Raspberry Pi 4s";
};
};
config = mkIf cfg.enable {
boot = {
# This prevents us from having to compile our own kernel
kernelPackages = pkgs.linuxPackages_rpi4;
kernelParams = [
"8250.nr_uarts=1"
"console=ttyAMA0,115200"
"console=tty1"
"cma=128M"
];
loader = {
raspberryPi = {
enable = true;
version = 4;
};
# Use the extlinux boot loader. (NixOS wants to enable GRUB by default)
grub.enable = false;
# Enables the generation of /boot/extlinux/extlinux.conf
#generic-extlinux-compatible.enable = true;
};
};
environment.systemPackages = with pkgs; [
raspberrypifw
usbutils
];
};
}