Files
nix-config/modules/nixos/hardware/raspberry-pi/modesetting.nix
2025-12-29 19:22:11 -06:00

35 lines
1.0 KiB
Nix

{ config, lib, pkgs, namespace, ... }:
let
cfg = config.${namespace}.hardware.raspberry-pi.modesetting;
variant = config.${namespace}.hardware.raspberry-pi.variant;
in
{
options.${namespace}.hardware.raspberry-pi.modesetting = {
enable = lib.mkEnableOption "enable modesetting dt overlays";
};
config = lib.mkIf cfg.enable {
hardware.deviceTree = {
overlays =
[
{
name = "vc4-fkms-v3d-pi4-overlay";
dtsFile = "${pkgs.${namespace}.raspberrypi-overlays}/share/raspberrypi-overlays/vc4-fkms-v3d-pi4-overlay.dts";
}
] ++ (if (variant == "5") then
[
{
name = "vc4-kms-v3d-pi5-overlay";
dtsFile = "${pkgs.${namespace}.raspberrypi-overlays}/share/raspberrypi-overlays/vc4-kms-v3d-pi5-overlay.dts";
}
]
else
[
{
name = "vc4-kms-v3d-pi4-overlay";
dtsFile = "${pkgs.${namespace}.raspberrypi-overlays}/share/raspberrypi-overlays/vc4-kms-v3d-pi4-overlay.dts";
}
]);
};
};
}