Rewrite the Raspi4 configs to prober modules
This commit is contained in:
parent
7553caca49
commit
1a3c748c8e
|
@ -4,6 +4,7 @@
|
|||
./hardware/bluetooth
|
||||
./hardware/dvd
|
||||
./hardware/nvidia
|
||||
./hardware/raspi4
|
||||
./misc/common
|
||||
./misc/username
|
||||
./profiles/desktop
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
# Raspberry Pi 4 Module
|
||||
|
||||
Do not import this module into the main `default.nix` file. Otherwise the other
|
||||
systems aren't buildable anymore because some options from the `nixos-hardware`
|
||||
input get applied immediately.
|
||||
|
||||
Just import it in any system you need with the following code where variant is
|
||||
either `ethernet` or `usb`. `ethernet` is for a Pi which is intended as a
|
||||
server and is connected with a fixed IP to the network. `usb` is for a
|
||||
Raspberry Pi which can be connected via USB-C to another device, e.g. an iPad.
|
||||
The ethernet port is configured to get its IP via DHCP and via uSB-C the Pi is
|
||||
reachable via the IP provided in the configuration.
|
||||
|
||||
```nix
|
||||
imports = [
|
||||
"${inputs.self}/modules/hardware/raspi4-VARIANT"
|
||||
];
|
||||
hardware = {
|
||||
az-raspi4-VARIANT = {
|
||||
enable = true;
|
||||
hostname = "some-hostname";
|
||||
ip = "10.7.89.150";
|
||||
};
|
||||
};
|
||||
```
|
|
@ -1,50 +0,0 @@
|
|||
{ inputs, lib, pkgs, ... }:
|
||||
{
|
||||
boot = {
|
||||
supportedFilesystems = lib.mkForce [ "f2fs" "ntfs" "cifs" "ext4" "vfat" "nfs" "nfs4" ];
|
||||
};
|
||||
fileSystems = {
|
||||
"/" = {
|
||||
device = "/dev/disk/by-label/NIXOS_SD";
|
||||
fsType = "ext4";
|
||||
options = [ "noatime" ];
|
||||
};
|
||||
};
|
||||
|
||||
boot = {
|
||||
initrd.availableKernelModules = [
|
||||
"usbhid"
|
||||
"usb_storage"
|
||||
"vc4"
|
||||
"pcie_brcmstb" # required for the pcie bus to work
|
||||
"reset-raspberrypi" # required for vl805 firmware to load
|
||||
];
|
||||
|
||||
loader = {
|
||||
grub.enable = false;
|
||||
generic-extlinux-compatible.enable = true;
|
||||
};
|
||||
};
|
||||
boot.extraModulePackages = [ ];
|
||||
boot.kernelParams = [ ];
|
||||
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
hardware.pulseaudio.enable = true;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
libraspberrypi
|
||||
raspberrypi-eeprom
|
||||
];
|
||||
|
||||
environment.shellAliases = {
|
||||
raspi-cpu = ''
|
||||
sudo vcgencmd get_throttled && sudo vcgencmd measure_temp
|
||||
'';
|
||||
raspi-firmware-update = ''
|
||||
sudo mkdir -p /mnt && \
|
||||
sudo mount /dev/disk/by-label/FIRMWARE /mnt && \
|
||||
BOOTFS=/mnt FIRMWARE_RELEASE_STATUS=stable sudo -E rpi-eeprom-update -d -a && \
|
||||
sudo umount /mnt
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./raspi-base.nix
|
||||
./raspi-ethernet.nix
|
||||
./raspi-usb.nix
|
||||
];
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.hardware.az-raspi4-base;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
hardware.az-raspi4-base.enable = lib.mkEnableOption "Enable the base config for a Raspberry Pi 4.";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
boot = {
|
||||
supportedFilesystems = lib.mkForce [ "f2fs" "ntfs" "cifs" "ext4" "vfat" "nfs" "nfs4" ];
|
||||
};
|
||||
fileSystems = {
|
||||
"/" = {
|
||||
device = "/dev/disk/by-label/NIXOS_SD";
|
||||
fsType = "ext4";
|
||||
options = [ "noatime" ];
|
||||
};
|
||||
};
|
||||
|
||||
boot = {
|
||||
initrd.availableKernelModules = [
|
||||
"usbhid"
|
||||
"usb_storage"
|
||||
"vc4"
|
||||
"pcie_brcmstb" # required for the pcie bus to work
|
||||
"reset-raspberrypi" # required for vl805 firmware to load
|
||||
];
|
||||
|
||||
loader = {
|
||||
grub.enable = false;
|
||||
generic-extlinux-compatible.enable = true;
|
||||
};
|
||||
};
|
||||
boot.extraModulePackages = [ ];
|
||||
boot.kernelParams = [ ];
|
||||
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
hardware.pulseaudio.enable = true;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
libraspberrypi
|
||||
raspberrypi-eeprom
|
||||
];
|
||||
|
||||
environment.shellAliases = {
|
||||
raspi-cpu = ''
|
||||
sudo vcgencmd get_throttled && sudo vcgencmd measure_temp
|
||||
'';
|
||||
raspi-firmware-update = ''
|
||||
sudo mkdir -p /mnt && \
|
||||
sudo mount /dev/disk/by-label/FIRMWARE /mnt && \
|
||||
BOOTFS=/mnt FIRMWARE_RELEASE_STATUS=stable sudo -E rpi-eeprom-update -d -a && \
|
||||
sudo umount /mnt
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -3,10 +3,6 @@ let
|
|||
cfg = config.hardware.az-raspi4-ethernet;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./base.nix
|
||||
];
|
||||
|
||||
options = {
|
||||
hardware.az-raspi4-ethernet = {
|
||||
enable = lib.mkEnableOption "Enable options required for Raspberry Pi 4.";
|
||||
|
@ -22,6 +18,7 @@ in
|
|||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
hardware.az-raspi4-base.enable = true;
|
||||
networking = {
|
||||
useDHCP = false;
|
||||
hostName = cfg.hostname;
|
||||
|
|
|
@ -3,10 +3,6 @@ let
|
|||
cfg = config.hardware.az-raspi4-usb;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./base.nix
|
||||
];
|
||||
|
||||
options = {
|
||||
hardware.az-raspi4-usb = {
|
||||
enable = lib.mkEnableOption "Enable options required for Raspberry Pi 4.";
|
||||
|
@ -22,6 +18,8 @@ in
|
|||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
hardware.az-raspi4-base.enable = true;
|
||||
|
||||
boot = {
|
||||
kernelModules = [ "libcomposite" ];
|
||||
loader.raspberryPi.firmwareConfig = "dtoverlay=dwc2";
|
||||
|
|
Loading…
Reference in New Issue