dtsoverlays
This commit is contained in:
26
modules/nixos/hardware/raspberry-pi/pwm.nix
Normal file
26
modules/nixos/hardware/raspberry-pi/pwm.nix
Normal file
@@ -0,0 +1,26 @@
|
||||
{ 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}/share/raspberrypi-overlays/pwm-pio-rp1.dts"
|
||||
else "${pkgs.${namespace}.raspberrypi-overlays}/share/raspberrypi-overlays/pwm1-overlay.dts"
|
||||
);
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user