start dynamic dt overlays

This commit is contained in:
mjallen18
2026-01-22 09:42:16 -06:00
parent a07f694806
commit 871f099dac
2 changed files with 12 additions and 13 deletions

View File

@@ -233,7 +233,6 @@ in
./audio.nix ./audio.nix
./bluetooth.nix ./bluetooth.nix
./config.nix ./config.nix
./overlays
./i2c.nix ./i2c.nix
./leds.nix ./leds.nix
./modesetting.nix ./modesetting.nix

View File

@@ -10,32 +10,32 @@ in
options.${namespace}.hardware.raspberry-pi.overlays = with lib; { options.${namespace}.hardware.raspberry-pi.overlays = with lib; {
pi5DisableWifi = { pi5DisableWifi = {
enable = lib.mkEnableOption "Disable wifi on Pi5"; enable = lib.mkEnableOption "Disable wifi on Pi5";
overlay = mkOpt types.str "${firmware}/boot/overlays/disable-wifi-pi5.dtbo" "Location of the dtbo file"; overlay = mkOpt types.str "${firmware}/share/raspberrypi/boot/overlays/disable-wifi-pi5.dtbo" "Location of the dtbo file";
}; };
pi5DisableBluetooth = { pi5DisableBluetooth = {
enable = lib.mkEnableOption "Disable bluetooth on Pi5"; enable = lib.mkEnableOption "Disable bluetooth on Pi5";
overlay = mkOpt types.str "${firmware}/boot/overlays/disable-bt-pi5.dtbo" "Location of the dtbo file"; overlay = mkOpt types.str "${firmware}/share/raspberrypi/boot/overlays/disable-bt-pi5.dtbo" "Location of the dtbo file";
}; };
pi5i2c0 = { pi5i2c0 = {
enable = lib.mkEnableOption "Disable pi5i2c0 on Pi5"; enable = lib.mkEnableOption "Disable pi5i2c0 on Pi5";
overlay = mkOpt types.str "${firmware}/boot/overlays/i2c0-pi5.dtbo" "Location of the dtbo file"; overlay = mkOpt types.str "${firmware}/share/raspberrypi/boot/overlays/i2c0-pi5.dtbo" "Location of the dtbo file";
}; };
pi5i2c1 = { pi5i2c1 = {
enable = lib.mkEnableOption "Disable pi5i2c1 on Pi5"; enable = lib.mkEnableOption "Disable pi5i2c1 on Pi5";
overlay = mkOpt types.str "${firmware}/boot/overlays/i2c1-pi5.dtbo" "Location of the dtbo file"; overlay = mkOpt types.str "${firmware}/share/raspberrypi/boot/overlays/i2c1-pi5.dtbo" "Location of the dtbo file";
}; };
pi5i2c2 = { pi5i2c2 = {
enable = lib.mkEnableOption "Disable pi5i2c2 on Pi5"; enable = lib.mkEnableOption "Disable pi5i2c2 on Pi5";
overlay = mkOpt types.str "${firmware}/boot/overlays/i2c2-pi5.dtbo" "Location of the dtbo file"; overlay = mkOpt types.str "${firmware}/share/raspberrypi/boot/overlays/i2c2-pi5.dtbo" "Location of the dtbo file";
}; };
pi5i2c3 = { pi5i2c3 = {
enable = lib.mkEnableOption "Disable pi5i2c3 on Pi5"; enable = lib.mkEnableOption "Disable pi5i2c3 on Pi5";
overlay = mkOpt types.str "${firmware}/boot/overlays/i2c3-pi5.dtbo" "Location of the dtbo file"; overlay = mkOpt types.str "${firmware}/share/raspberrypi/boot/overlays/i2c3-pi5.dtbo" "Location of the dtbo file";
}; };
}; };
@@ -80,32 +80,32 @@ in
echo "Applying Device Tree Overlays via ConfigFS" echo "Applying Device Tree Overlays via ConfigFS"
if [ ${if cfg.pi5DisableWifi.enable then "true" else "false"} ]; then if [ ${if cfg.pi5DisableWifi.enable then "true" else "false"} ]; then
mkdir ${toString configfsPath}/disable-wifi-pi5 mkdir -p ${toString configfsPath}/disable-wifi-pi5
cp ${cfg.pi5DisableWifi.overlay} ${configfsPath}/disable-wifi-pi5/dtbo cp ${cfg.pi5DisableWifi.overlay} ${configfsPath}/disable-wifi-pi5/dtbo
fi fi
if [ ${if cfg.pi5DisableBluetooth.enable then "true" else "false"} ]; then if [ ${if cfg.pi5DisableBluetooth.enable then "true" else "false"} ]; then
mkdir ${toString configfsPath}/disable-bt-pi5 mkdir -p ${toString configfsPath}/disable-bt-pi5
cp ${cfg.pi5DisableBluetooth.overlay} ${configfsPath}/disable-bt-pi5/dtbo cp ${cfg.pi5DisableBluetooth.overlay} ${configfsPath}/disable-bt-pi5/dtbo
fi fi
if [ ${if cfg.pi5i2c0.enable then "true" else "false"} ]; then if [ ${if cfg.pi5i2c0.enable then "true" else "false"} ]; then
mkdir ${toString configfsPath}/i2c0-pi5 mkdir -p ${toString configfsPath}/i2c0-pi5
cp ${cfg.pi5i2c0.overlay} ${configfsPath}/i2c0-pi5/dtbo cp ${cfg.pi5i2c0.overlay} ${configfsPath}/i2c0-pi5/dtbo
fi fi
if [ ${if cfg.pi5i2c1.enable then "true" else "false"} ]; then if [ ${if cfg.pi5i2c1.enable then "true" else "false"} ]; then
mkdir ${toString configfsPath}/i2c1-pi5 mkdir -p ${toString configfsPath}/i2c1-pi5
cp ${cfg.pi5i2c1.overlay} ${configfsPath}/i2c1-pi5/dtbo cp ${cfg.pi5i2c1.overlay} ${configfsPath}/i2c1-pi5/dtbo
fi fi
if [ ${if cfg.pi5i2c2.enable then "true" else "false"} ]; then if [ ${if cfg.pi5i2c2.enable then "true" else "false"} ]; then
mkdir ${toString configfsPath}/i2c2-pi5 mkdir -p ${toString configfsPath}/i2c2-pi5
cp ${cfg.pi5i2c2.overlay} ${configfsPath}/i2c2-pi5/dtbo cp ${cfg.pi5i2c2.overlay} ${configfsPath}/i2c2-pi5/dtbo
fi fi
if [ ${if cfg.pi5i2c3.enable then "true" else "false"} ]; then if [ ${if cfg.pi5i2c3.enable then "true" else "false"} ]; then
mkdir ${toString configfsPath}/i2c3-pi5 mkdir -p ${toString configfsPath}/i2c3-pi5
cp ${cfg.pi5i2c3.overlay} ${configfsPath}/i2c3-pi5/dtbo cp ${cfg.pi5i2c3.overlay} ${configfsPath}/i2c3-pi5/dtbo
fi fi
''; '';