33 lines
796 B
Nix
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";
|
|
}
|
|
];
|
|
};
|
|
};
|
|
}
|