|
|
|
@@ -1,6 +1,12 @@
|
|
|
|
{ config, lib, pkgs, namespace, ... }:
|
|
|
|
{
|
|
|
|
|
|
|
|
config,
|
|
|
|
|
|
|
|
lib,
|
|
|
|
|
|
|
|
pkgs,
|
|
|
|
|
|
|
|
namespace,
|
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
let
|
|
|
|
inherit (lib.${namespace}) mkOpt mkBoolOpt;
|
|
|
|
inherit (lib.${namespace}) mkOpt;
|
|
|
|
cfg = config.${namespace}.hardware.raspberry-pi.overlays;
|
|
|
|
cfg = config.${namespace}.hardware.raspberry-pi.overlays;
|
|
|
|
|
|
|
|
|
|
|
|
firmware = "${pkgs.${namespace}.raspberrypifw}/share/raspberrypi/boot/overlays";
|
|
|
|
firmware = "${pkgs.${namespace}.raspberrypifw}/share/raspberrypi/boot/overlays";
|
|
|
|
@@ -115,140 +121,140 @@ in
|
|
|
|
description = "Apply Raspberry Pi Device Tree Overlays";
|
|
|
|
description = "Apply Raspberry Pi Device Tree Overlays";
|
|
|
|
script = ''
|
|
|
|
script = ''
|
|
|
|
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 -p ${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
|
|
|
|
else
|
|
|
|
else
|
|
|
|
rm -rf ${toString configfsPath}/disable-wifi-pi5
|
|
|
|
rm -rf ${toString configfsPath}/disable-wifi-pi5
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ ${if cfg.pi5DisableBluetooth.enable then "true" else "false"} ]; then
|
|
|
|
if [ ${if cfg.pi5DisableBluetooth.enable then "true" else "false"} ]; then
|
|
|
|
mkdir -p ${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
|
|
|
|
else
|
|
|
|
else
|
|
|
|
rm -rf ${toString configfsPath}/disable-bt-pi5
|
|
|
|
rm -rf ${toString configfsPath}/disable-bt-pi5
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ ${if cfg.pi5i2c0.enable then "true" else "false"} ]; then
|
|
|
|
if [ ${if cfg.pi5i2c0.enable then "true" else "false"} ]; then
|
|
|
|
mkdir -p ${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
|
|
|
|
else
|
|
|
|
else
|
|
|
|
rm -rf ${toString configfsPath}/i2c0-pi5
|
|
|
|
rm -rf ${toString configfsPath}/i2c0-pi5
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ ${if cfg.pi5i2c1.enable then "true" else "false"} ]; then
|
|
|
|
if [ ${if cfg.pi5i2c1.enable then "true" else "false"} ]; then
|
|
|
|
mkdir -p ${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
|
|
|
|
else
|
|
|
|
else
|
|
|
|
rm -rf ${toString configfsPath}/i2c1-pi5
|
|
|
|
rm -rf ${toString configfsPath}/i2c1-pi5
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ ${if cfg.pi5i2c2.enable then "true" else "false"} ]; then
|
|
|
|
if [ ${if cfg.pi5i2c2.enable then "true" else "false"} ]; then
|
|
|
|
mkdir -p ${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
|
|
|
|
else
|
|
|
|
else
|
|
|
|
rm -rf ${toString configfsPath}/i2c2-pi5
|
|
|
|
rm -rf ${toString configfsPath}/i2c2-pi5
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ ${if cfg.pi5i2c3.enable then "true" else "false"} ]; then
|
|
|
|
if [ ${if cfg.pi5i2c3.enable then "true" else "false"} ]; then
|
|
|
|
mkdir -p ${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
|
|
|
|
else
|
|
|
|
else
|
|
|
|
rm -rf ${toString configfsPath}/i2c3-pi5
|
|
|
|
rm -rf ${toString configfsPath}/i2c3-pi5
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ ${if cfg.pi5Sdio.enable then "true" else "false"} ]; then
|
|
|
|
if [ ${if cfg.pi5Sdio.enable then "true" else "false"} ]; then
|
|
|
|
mkdir ${toString configfsPath}/sdio-pi5
|
|
|
|
mkdir ${toString configfsPath}/sdio-pi5
|
|
|
|
cp ${cfg.pi5Sdio.overlay} ${configfsPath}/sdio-pi5/dtbo
|
|
|
|
cp ${cfg.pi5Sdio.overlay} ${configfsPath}/sdio-pi5/dtbo
|
|
|
|
else
|
|
|
|
else
|
|
|
|
rm -rf ${toString configfsPath}/sdio-pi5
|
|
|
|
rm -rf ${toString configfsPath}/sdio-pi5
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ ${if cfg.pi5Spi21cs.enable then "true" else "false"} ]; then
|
|
|
|
if [ ${if cfg.pi5Spi21cs.enable then "true" else "false"} ]; then
|
|
|
|
mkdir ${toString configfsPath}/spi2-1cs-pi5
|
|
|
|
mkdir ${toString configfsPath}/spi2-1cs-pi5
|
|
|
|
cp ${cfg.pi5Spi21cs.overlay} ${configfsPath}/spi2-1cs-pi5/dtbo
|
|
|
|
cp ${cfg.pi5Spi21cs.overlay} ${configfsPath}/spi2-1cs-pi5/dtbo
|
|
|
|
else
|
|
|
|
else
|
|
|
|
rm -rf ${toString configfsPath}/spi2-1cs-pi5
|
|
|
|
rm -rf ${toString configfsPath}/spi2-1cs-pi5
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ ${if cfg.pi5Spi22cs.enable then "true" else "false"} ]; then
|
|
|
|
if [ ${if cfg.pi5Spi22cs.enable then "true" else "false"} ]; then
|
|
|
|
mkdir ${toString configfsPath}/spi2-2cs-pi5
|
|
|
|
mkdir ${toString configfsPath}/spi2-2cs-pi5
|
|
|
|
cp ${cfg.pi5Spi22cs.overlay} ${configfsPath}/spi2-2cs-pi5/dtbo
|
|
|
|
cp ${cfg.pi5Spi22cs.overlay} ${configfsPath}/spi2-2cs-pi5/dtbo
|
|
|
|
else
|
|
|
|
else
|
|
|
|
rm -rf ${toString configfsPath}/spi2-2cs-pi5
|
|
|
|
rm -rf ${toString configfsPath}/spi2-2cs-pi5
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ ${if cfg.pi5Spi31cs.enable then "true" else "false"} ]; then
|
|
|
|
if [ ${if cfg.pi5Spi31cs.enable then "true" else "false"} ]; then
|
|
|
|
mkdir ${toString configfsPath}/spi3-1cs-pi5
|
|
|
|
mkdir ${toString configfsPath}/spi3-1cs-pi5
|
|
|
|
cp ${cfg.pi5Spi31cs.overlay} ${configfsPath}/spi3-1cs-pi5/dtbo
|
|
|
|
cp ${cfg.pi5Spi31cs.overlay} ${configfsPath}/spi3-1cs-pi5/dtbo
|
|
|
|
else
|
|
|
|
else
|
|
|
|
rm -rf ${toString configfsPath}/spi3-1cs-pi5
|
|
|
|
rm -rf ${toString configfsPath}/spi3-1cs-pi5
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ ${if cfg.pi5Spi32cs.enable then "true" else "false"} ]; then
|
|
|
|
if [ ${if cfg.pi5Spi32cs.enable then "true" else "false"} ]; then
|
|
|
|
mkdir ${toString configfsPath}/spi3-2cs-pi5
|
|
|
|
mkdir ${toString configfsPath}/spi3-2cs-pi5
|
|
|
|
cp ${cfg.pi5Spi32cs.overlay} ${configfsPath}/spi3-2cs-pi5/dtbo
|
|
|
|
cp ${cfg.pi5Spi32cs.overlay} ${configfsPath}/spi3-2cs-pi5/dtbo
|
|
|
|
else
|
|
|
|
else
|
|
|
|
rm -rf ${toString configfsPath}/spi3-2cs-pi5
|
|
|
|
rm -rf ${toString configfsPath}/spi3-2cs-pi5
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ ${if cfg.pi5Spi51cs.enable then "true" else "false"} ]; then
|
|
|
|
if [ ${if cfg.pi5Spi51cs.enable then "true" else "false"} ]; then
|
|
|
|
mkdir ${toString configfsPath}/spi5-1cs-pi5
|
|
|
|
mkdir ${toString configfsPath}/spi5-1cs-pi5
|
|
|
|
cp ${cfg.pi5Spi51cs.overlay} ${configfsPath}/spi5-1cs-pi5/dtbo
|
|
|
|
cp ${cfg.pi5Spi51cs.overlay} ${configfsPath}/spi5-1cs-pi5/dtbo
|
|
|
|
else
|
|
|
|
else
|
|
|
|
rm -rf ${toString configfsPath}/spi5-1cs-pi5
|
|
|
|
rm -rf ${toString configfsPath}/spi5-1cs-pi5
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ ${if cfg.pi5Spi52cs.enable then "true" else "false"} ]; then
|
|
|
|
if [ ${if cfg.pi5Spi52cs.enable then "true" else "false"} ]; then
|
|
|
|
mkdir ${toString configfsPath}/spi5-2cs-pi5
|
|
|
|
mkdir ${toString configfsPath}/spi5-2cs-pi5
|
|
|
|
cp ${cfg.pi5Spi52cs.overlay} ${configfsPath}/spi5-2cs-pi5/dtbo
|
|
|
|
cp ${cfg.pi5Spi52cs.overlay} ${configfsPath}/spi5-2cs-pi5/dtbo
|
|
|
|
else
|
|
|
|
else
|
|
|
|
rm -rf ${toString configfsPath}/spi5-2cs-pi5
|
|
|
|
rm -rf ${toString configfsPath}/spi5-2cs-pi5
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ ${if cfg.pi5Uart0.enable then "true" else "false"} ]; then
|
|
|
|
if [ ${if cfg.pi5Uart0.enable then "true" else "false"} ]; then
|
|
|
|
mkdir ${toString configfsPath}/uart0-pi5
|
|
|
|
mkdir ${toString configfsPath}/uart0-pi5
|
|
|
|
cp ${cfg.pi5Uart0.overlay} ${configfsPath}/uart0-pi5/dtbo
|
|
|
|
cp ${cfg.pi5Uart0.overlay} ${configfsPath}/uart0-pi5/dtbo
|
|
|
|
else
|
|
|
|
else
|
|
|
|
rm -rf ${toString configfsPath}/uart0-pi5
|
|
|
|
rm -rf ${toString configfsPath}/uart0-pi5
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ ${if cfg.pi5Uart1.enable then "true" else "false"} ]; then
|
|
|
|
if [ ${if cfg.pi5Uart1.enable then "true" else "false"} ]; then
|
|
|
|
mkdir ${toString configfsPath}/uart1-pi5
|
|
|
|
mkdir ${toString configfsPath}/uart1-pi5
|
|
|
|
cp ${cfg.pi5Uart1.overlay} ${configfsPath}/uart1-pi5/dtbo
|
|
|
|
cp ${cfg.pi5Uart1.overlay} ${configfsPath}/uart1-pi5/dtbo
|
|
|
|
else
|
|
|
|
else
|
|
|
|
rm -rf ${toString configfsPath}/uart1-pi5
|
|
|
|
rm -rf ${toString configfsPath}/uart1-pi5
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ ${if cfg.pi5Uart2.enable then "true" else "false"} ]; then
|
|
|
|
if [ ${if cfg.pi5Uart2.enable then "true" else "false"} ]; then
|
|
|
|
mkdir ${toString configfsPath}/uart2-pi5
|
|
|
|
mkdir ${toString configfsPath}/uart2-pi5
|
|
|
|
cp ${cfg.pi5Uart2.overlay} ${configfsPath}/uart2-pi5/dtbo
|
|
|
|
cp ${cfg.pi5Uart2.overlay} ${configfsPath}/uart2-pi5/dtbo
|
|
|
|
else
|
|
|
|
else
|
|
|
|
rm -rf ${toString configfsPath}/uart2-pi5
|
|
|
|
rm -rf ${toString configfsPath}/uart2-pi5
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ ${if cfg.pi5Uart3.enable then "true" else "false"} ]; then
|
|
|
|
if [ ${if cfg.pi5Uart3.enable then "true" else "false"} ]; then
|
|
|
|
mkdir ${toString configfsPath}/uart3-pi5
|
|
|
|
mkdir ${toString configfsPath}/uart3-pi5
|
|
|
|
cp ${cfg.pi5Uart3.overlay} ${configfsPath}/uart3-pi5/dtbo
|
|
|
|
cp ${cfg.pi5Uart3.overlay} ${configfsPath}/uart3-pi5/dtbo
|
|
|
|
else
|
|
|
|
else
|
|
|
|
rm -rf ${toString configfsPath}/uart3-pi5
|
|
|
|
rm -rf ${toString configfsPath}/uart3-pi5
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ ${if cfg.pi5Uart4.enable then "true" else "false"} ]; then
|
|
|
|
if [ ${if cfg.pi5Uart4.enable then "true" else "false"} ]; then
|
|
|
|
mkdir ${toString configfsPath}/uart4-pi5
|
|
|
|
mkdir ${toString configfsPath}/uart4-pi5
|
|
|
|
cp ${cfg.pi5Uart4.overlay} ${configfsPath}/uart4-pi5/dtbo
|
|
|
|
cp ${cfg.pi5Uart4.overlay} ${configfsPath}/uart4-pi5/dtbo
|
|
|
|
else
|
|
|
|
else
|
|
|
|
rm -rf ${toString configfsPath}/uart4-pi5
|
|
|
|
rm -rf ${toString configfsPath}/uart4-pi5
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ ${if cfg.pi5Vc4Kms.enable then "true" else "false"} ]; then
|
|
|
|
if [ ${if cfg.pi5Vc4Kms.enable then "true" else "false"} ]; then
|
|
|
|
mkdir ${toString configfsPath}/vc4-kms-v3d-pi5
|
|
|
|
mkdir ${toString configfsPath}/vc4-kms-v3d-pi5
|
|
|
|
cp ${cfg.pi5Vc4Kms.overlay} ${configfsPath}/vc4-kms-v3d-pi5/dtbo
|
|
|
|
cp ${cfg.pi5Vc4Kms.overlay} ${configfsPath}/vc4-kms-v3d-pi5/dtbo
|
|
|
|
else
|
|
|
|
else
|
|
|
|
rm -rf ${toString configfsPath}/vc4-kms-v3d-pi5
|
|
|
|
rm -rf ${toString configfsPath}/vc4-kms-v3d-pi5
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ ${if cfg.bcm2712d0.enable then "true" else "false"} ]; then
|
|
|
|
if [ ${if cfg.bcm2712d0.enable then "true" else "false"} ]; then
|
|
|
|
mkdir ${toString configfsPath}/bcm2712d0
|
|
|
|
mkdir ${toString configfsPath}/bcm2712d0
|
|
|
|
cp ${cfg.bcm2712d0.overlay} ${configfsPath}/bcm2712d0/dtbo
|
|
|
|
cp ${cfg.bcm2712d0.overlay} ${configfsPath}/bcm2712d0/dtbo
|
|
|
|
|