diff --git a/modules/nixos/hardware/raspberry-pi/default.nix b/modules/nixos/hardware/raspberry-pi/default.nix index 605368d..c88f39e 100644 --- a/modules/nixos/hardware/raspberry-pi/default.nix +++ b/modules/nixos/hardware/raspberry-pi/default.nix @@ -233,6 +233,7 @@ in ./audio.nix ./bluetooth.nix ./config.nix + ./overlays ./i2c.nix ./leds.nix ./modesetting.nix diff --git a/modules/nixos/hardware/raspberry-pi/overlays/default.nix b/modules/nixos/hardware/raspberry-pi/overlays/default.nix index 390f680..6e332e9 100644 --- a/modules/nixos/hardware/raspberry-pi/overlays/default.nix +++ b/modules/nixos/hardware/raspberry-pi/overlays/default.nix @@ -12,11 +12,34 @@ in enable = lib.mkEnableOption "Disable wifi on Pi5"; overlay = mkOpt types.str "${firmware}/boot/overlays/disable-wifi-pi5.dtbo" "Location of the dtbo file"; }; + + pi5DisableBluetooth = { + enable = lib.mkEnableOption "Disable bluetooth on Pi5"; + overlay = mkOpt types.str "${firmware}/boot/overlays/disable-bt-pi5.dtbo" "Location of the dtbo file"; + }; + + pi5i2c0 = { + enable = lib.mkEnableOption "Disable pi5i2c0 on Pi5"; + overlay = mkOpt types.str "${firmware}/boot/overlays/i2c0-pi5.dtbo" "Location of the dtbo file"; + }; + + pi5i2c1 = { + enable = lib.mkEnableOption "Disable pi5i2c1 on Pi5"; + overlay = mkOpt types.str "${firmware}/boot/overlays/i2c1-pi5.dtbo" "Location of the dtbo file"; + }; + + pi5i2c2 = { + enable = lib.mkEnableOption "Disable pi5i2c2 on Pi5"; + overlay = mkOpt types.str "${firmware}/boot/overlays/i2c2-pi5.dtbo" "Location of the dtbo file"; + }; + + pi5i2c3 = { + enable = lib.mkEnableOption "Disable pi5i2c3 on Pi5"; + overlay = mkOpt types.str "${firmware}/boot/overlays/i2c3-pi5.dtbo" "Location of the dtbo file"; + }; }; # audremap-pi5.dtbo -# disable-bt-pi5.dtbo -# disable-wifi-pi5.dtbo # i2c0-pi5.dtbo # i2c1-pi5.dtbo # i2c2-pi5.dtbo @@ -60,6 +83,31 @@ in mkdir ${toString configfsPath}/disable-wifi-pi5 cp ${cfg.pi5DisableWifi.overlay} ${configfsPath}/disable-wifi-pi5/dtbo fi + + if [ ${if cfg.pi5DisableBluetooth.enable then "true" else "false"} ]; then + mkdir ${toString configfsPath}/disable-bt-pi5 + cp ${cfg.pi5DisableBluetooth.overlay} ${configfsPath}/disable-bt-pi5/dtbo + fi + + if [ ${if cfg.pi5i2c0.enable then "true" else "false"} ]; then + mkdir ${toString configfsPath}/i2c0-pi5 + cp ${cfg.pi5i2c0.overlay} ${configfsPath}/i2c0-pi5/dtbo + fi + + if [ ${if cfg.pi5i2c1.enable then "true" else "false"} ]; then + mkdir ${toString configfsPath}/i2c1-pi5 + cp ${cfg.pi5i2c1.overlay} ${configfsPath}/i2c1-pi5/dtbo + fi + + if [ ${if cfg.pi5i2c2.enable then "true" else "false"} ]; then + mkdir ${toString configfsPath}/i2c2-pi5 + cp ${cfg.pi5i2c2.overlay} ${configfsPath}/i2c2-pi5/dtbo + fi + + if [ ${if cfg.pi5i2c3.enable then "true" else "false"} ]; then + mkdir ${toString configfsPath}/i2c3-pi5 + cp ${cfg.pi5i2c3.overlay} ${configfsPath}/i2c3-pi5/dtbo + fi ''; wantedBy = [ "multi-user.target" ]; }; diff --git a/systems/aarch64-linux/pi5/default.nix b/systems/aarch64-linux/pi5/default.nix index 3a03ce2..4a3f3dd 100644 --- a/systems/aarch64-linux/pi5/default.nix +++ b/systems/aarch64-linux/pi5/default.nix @@ -51,6 +51,15 @@ modesetting.enable = false; i2c.enable = false; apply-overlays-dtmerge.enable = false; + + overlays = { + pi5DisableWifi.enable = true; + pi5DisableBluetooth.enable = true; + pi5i2c0.enable = true; + pi5i2c1.enable = true; + pi5i2c2.enable = true; + pi5i2c3.enable = true; + }; }; };