Files
nix-config/modules/nixos/hardware/raspberry-pi/pwm.nix
2026-04-05 19:10:23 -05:00

33 lines
796 B
Nix

{
config,
lib,
pkgs,
namespace,
...
}:
let
cfg = config.${namespace}.hardware.raspberry-pi.pwm;
inherit (config.${namespace}.hardware.raspberry-pi) variant;
in
{
options.${namespace}.hardware.raspberry-pi.pwm = {
enable = lib.mkEnableOption "enable pwm dt overlay";
};
config = lib.mkIf cfg.enable {
hardware.deviceTree = {
overlays = [
{
name = "enable-pwm";
filter = if (variant == "5") then "*pi5*" else "*rpi-4-b*";
dtsFile =
if (variant == "5") then
"${pkgs.${namespace}.raspberrypi-overlays}/dtbs/raspberrypi-overlays/pwm-pio-overlay.dts"
else
"${pkgs.${namespace}.raspberrypi-overlays}/dtbs/raspberrypi-overlays/pwm1-overlay.dts";
}
];
};
};
}