diff --git a/modules/home/home/default.nix b/modules/home/home/default.nix index e2de0c5..3e7ade9 100644 --- a/modules/home/home/default.nix +++ b/modules/home/home/default.nix @@ -128,7 +128,7 @@ in }; services = { - nextcloud-client.enable = false;#lib.mkDefault hasDestopEnvironment; + nextcloud-client.enable = false; # lib.mkDefault hasDestopEnvironment; pass-secret-service = lib.mkDefault enabled; kdeconnect = { enable = lib.mkDefault hasDestopEnvironment; diff --git a/modules/nixos/hardware/raspberry-pi/apply-overlays-dtmerge.nix b/modules/nixos/hardware/raspberry-pi/apply-overlays-dtmerge.nix index 2111ce2..ab6d529 100644 --- a/modules/nixos/hardware/raspberry-pi/apply-overlays-dtmerge.nix +++ b/modules/nixos/hardware/raspberry-pi/apply-overlays-dtmerge.nix @@ -64,4 +64,4 @@ with lib; done''; } -) \ No newline at end of file +) diff --git a/modules/nixos/hardware/raspberry-pi/audio.nix b/modules/nixos/hardware/raspberry-pi/audio.nix index 307182d..0af0485 100644 --- a/modules/nixos/hardware/raspberry-pi/audio.nix +++ b/modules/nixos/hardware/raspberry-pi/audio.nix @@ -1,4 +1,10 @@ -{ config, lib, pkgs, namespace, ... }: +{ + config, + lib, + pkgs, + namespace, + ... +}: let cfg = config.${namespace}.hardware.raspberry-pi.audio; variant = config.${namespace}.hardware.raspberry-pi.variant; @@ -10,21 +16,26 @@ in config = lib.mkIf cfg.enable { hardware.deviceTree = { - overlays = - [ ] ++ (if (variant == "5") then - [ - { - name = "pisound-pi5-overlay"; - dtsFile = "${pkgs.${namespace}.raspberrypi-overlays}/dtbs/raspberrypi-overlays/pisound-pi5-overlay.dts"; - } - ] - else - [ - { - name = "pisound-overlay"; - dtsFile = "${pkgs.${namespace}.raspberrypi-overlays}/dtbs/raspberrypi-overlays/pisound-overlay.dts"; - } - ]); + overlays = + [ ] + ++ ( + if (variant == "5") then + [ + { + name = "pisound-pi5-overlay"; + dtsFile = "${ + pkgs.${namespace}.raspberrypi-overlays + }/dtbs/raspberrypi-overlays/pisound-pi5-overlay.dts"; + } + ] + else + [ + { + name = "pisound-overlay"; + dtsFile = "${pkgs.${namespace}.raspberrypi-overlays}/dtbs/raspberrypi-overlays/pisound-overlay.dts"; + } + ] + ); }; }; -} \ No newline at end of file +} diff --git a/modules/nixos/hardware/raspberry-pi/bluetooth.nix b/modules/nixos/hardware/raspberry-pi/bluetooth.nix index 41cf356..e93d1eb 100644 --- a/modules/nixos/hardware/raspberry-pi/bluetooth.nix +++ b/modules/nixos/hardware/raspberry-pi/bluetooth.nix @@ -1,4 +1,10 @@ -{ config, lib, pkgs, namespace, ... }: +{ + config, + lib, + pkgs, + namespace, + ... +}: let cfg = config.${namespace}.hardware.raspberry-pi.disable-bluetooth; variant = config.${namespace}.hardware.raspberry-pi.variant; @@ -10,21 +16,28 @@ in config = lib.mkIf cfg.enable { hardware.deviceTree = { - overlays = - [ ] ++ (if (variant == "5") then - [ - { - name = "disable-bt-pi5-overlay"; - dtsFile = "${pkgs.${namespace}.raspberrypi-overlays}/dtbs/raspberrypi-overlays/disable-bt-pi5-overlay.dts"; - } - ] - else - [ - { - name = "disable-bt-overlay"; - dtsFile = "${pkgs.${namespace}.raspberrypi-overlays}/dtbs/raspberrypi-overlays/disable-bt-overlay.dts"; - } - ]); + overlays = + [ ] + ++ ( + if (variant == "5") then + [ + { + name = "disable-bt-pi5-overlay"; + dtsFile = "${ + pkgs.${namespace}.raspberrypi-overlays + }/dtbs/raspberrypi-overlays/disable-bt-pi5-overlay.dts"; + } + ] + else + [ + { + name = "disable-bt-overlay"; + dtsFile = "${ + pkgs.${namespace}.raspberrypi-overlays + }/dtbs/raspberrypi-overlays/disable-bt-overlay.dts"; + } + ] + ); }; }; -} \ No newline at end of file +} diff --git a/modules/nixos/hardware/raspberry-pi/config.nix b/modules/nixos/hardware/raspberry-pi/config.nix index c35aab7..ac4aa54 100644 --- a/modules/nixos/hardware/raspberry-pi/config.nix +++ b/modules/nixos/hardware/raspberry-pi/config.nix @@ -4,161 +4,199 @@ # with modifications # https://raw.githubusercontent.com/nvmd/raspberry-pi-nix/refs/heads/master/rpi/config.nix -{ lib, config, pkgs, namespace, ... }: +{ + lib, + config, + namespace, + ... +}: let cfg = config.${namespace}.hardware.raspberry-pi; - render-raspberrypi-config = let + render-raspberrypi-config = + let - render-kvs = kvs: let - render-kv = k: v: - if isNull v.value then k - else "${k}=${toString v.value}"; - in lib.attrsets.mapAttrsToList render-kv - (lib.filterAttrs (k: v: v.enable) kvs); + render-kvs = + kvs: + let + render-kv = k: v: if isNull v.value then k else "${k}=${toString v.value}"; + in + lib.attrsets.mapAttrsToList render-kv (lib.filterAttrs (_k: v: v.enable) kvs); - render-dt-param = x: "dtparam=" + x; - render-dt-params = params: - lib.strings.concatMapStringsSep "\n" render-dt-param (render-kvs params); + render-dt-param = x: "dtparam=" + x; + render-dt-params = params: lib.strings.concatMapStringsSep "\n" render-dt-param (render-kvs params); - render-dt-overlay = { overlay, params }: - lib.concatStringsSep "\n" (lib.filter (x: x != "") [ - ("dtoverlay=" + overlay) - (render-dt-params params) - "dtoverlay=" - ]); + render-dt-overlay = + { overlay, params }: + lib.concatStringsSep "\n" ( + lib.filter (x: x != "") [ + ("dtoverlay=" + overlay) + (render-dt-params params) + "dtoverlay=" + ] + ); - render-options = opts: - lib.strings.concatStringsSep "\n" (render-kvs opts); + render-options = opts: lib.strings.concatStringsSep "\n" (render-kvs opts); - render-base-dt-params = render-dt-params; + render-base-dt-params = render-dt-params; - render-dt-overlays = overlays: - lib.strings.concatMapStringsSep "\n" render-dt-overlay - (lib.attrsets.mapAttrsToList - (overlay: params: { + render-dt-overlays = + overlays: + lib.strings.concatMapStringsSep "\n" render-dt-overlay ( + lib.attrsets.mapAttrsToList (overlay: params: { inherit overlay; inherit (params) params; - }) - (lib.filterAttrs (k: v: v.enable) overlays)); + }) (lib.filterAttrs (_k: v: v.enable) overlays) + ); - render-config-section = conditionalFilter: - { options, base-dt-params, dt-overlays }: - let all-config = lib.concatStringsSep "\n" (lib.filter (x: x != "") [ - (render-options options) - (render-base-dt-params base-dt-params) - (render-dt-overlays dt-overlays) - ]); - in '' - [${conditionalFilter}] - ${all-config} - ''; - in conf: lib.strings.concatStringsSep "\n" - ((lib.attrsets.mapAttrsToList render-config-section conf) - ++ [ cfg.extra-config ]); -in { + render-config-section = + conditionalFilter: + { + options, + base-dt-params, + dt-overlays, + }: + let + all-config = lib.concatStringsSep "\n" ( + lib.filter (x: x != "") [ + (render-options options) + (render-base-dt-params base-dt-params) + (render-dt-overlays dt-overlays) + ] + ); + in + '' + [${conditionalFilter}] + ${all-config} + ''; + in + conf: + lib.strings.concatStringsSep "\n" ( + (lib.attrsets.mapAttrsToList render-config-section conf) ++ [ cfg.extra-config ] + ); +in +{ options.${namespace}.hardware.raspberry-pi = { - config = let - rpi-config-param = { - options = { - enable = lib.mkEnableOption "attr"; - value = lib.mkOption { - type = with lib.types; oneOf [ int str bool ]; - }; - }; - }; - dt-param = { - options = { - enable = lib.mkEnableOption "attr"; - value = lib.mkOption { - type = with lib.types; nullOr (oneOf [ int str bool ]); - default = null; - }; - }; - }; - dt-overlay = { - options = { - enable = lib.mkEnableOption "overlay"; - params = lib.mkOption { - type = with lib.types; attrsOf (submodule dt-param); - default = {}; - }; - }; - }; - raspberry-pi-config-options = { - options = { - options = lib.mkOption { - type = with lib.types; attrsOf (submodule rpi-config-param); - default = { }; - description = '' - Common hardware configuration options, translates to - `