zion/modules/device.nix

52 lines
1.1 KiB
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
with pkgs;
{
# A bunch of boot parameters needed for optimal runtime on RPi 4B
boot.kernelPackages = linuxPackages_rpi4;
boot.kernelParams = [
"zfs.zfs_arc_max=134217728"
"console=TTYAMA0,115200"
"console=tty1"
"8250.nr_uarts=1"
"iomem=relaxed"
"strict-devmem=0"
];
# Enable SATA-HAT GPIO features
boot.loader.grub.enable = false;
boot.loader.raspberryPi = {
enable = true;
version = 4;
firmwareConfig = ''
iomem=relaxed
strict-devmem=0
dtoverlay=pwm-2chan,pin=12,func=4,pin2=13,func2=4
dtoverlay=w1-gpio
dtparam=i2c1=on
'';
};
# Load PWM hardware timers
boot.kernelModules = [ "pwm_bcm2835" "w1-gpio" "w1-therm" ];
hardware.deviceTree = {
enable = true;
filter = "*-rpi-*.dtb";
overlays = [
{
name = "pwm-2chan";
dtboFile = "${device-tree_rpi.overlays}/pwm-2chan.dtbo";
}
{
name = "w1-gpio";
dtboFile = "${device-tree_rpi.overlays}/w1-gpio.dtbo";
}
];
};
# Enable I2C
hardware.i2c.enable = true;
}