Files
nix-config/modules/nixos/hardware/raspberry-pi/pwm.nix
mjallen18 56154fe941 check
2026-01-02 20:30:05 -06:00

34 lines
812 B
Nix

{
config,
lib,
pkgs,
namespace,
...
}:
let
cfg = config.${namespace}.hardware.raspberry-pi.pwm;
variant = 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"
);
}
];
};
};
}