From 776f44f0bb7b403a34bcb1d744151e2ee26537de Mon Sep 17 00:00:00 2001 From: ooks-io Date: Sun, 7 Apr 2024 23:27:14 +1200 Subject: [PATCH] refactor(hardware): add options to module file --- system/modules/hardware/backlight.nix | 11 ----------- system/modules/hardware/backlight/default.nix | 16 ++++++++++++++++ .../{bluetooth.nix => bluetooth/default.nix} | 8 +++++++- system/modules/hardware/default.nix | 16 +++------------- 4 files changed, 26 insertions(+), 25 deletions(-) delete mode 100644 system/modules/hardware/backlight.nix create mode 100644 system/modules/hardware/backlight/default.nix rename system/modules/hardware/{bluetooth.nix => bluetooth/default.nix} (70%) diff --git a/system/modules/hardware/backlight.nix b/system/modules/hardware/backlight.nix deleted file mode 100644 index b797786..0000000 --- a/system/modules/hardware/backlight.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ lib, config, ... }: - -let - cfg = config.systemModules.hardware.backlight; -in - -{ - config = lib.mkIf cfg.enable { - hardware.brillo.enable = true; - }; -} diff --git a/system/modules/hardware/backlight/default.nix b/system/modules/hardware/backlight/default.nix new file mode 100644 index 0000000..9a0d0f4 --- /dev/null +++ b/system/modules/hardware/backlight/default.nix @@ -0,0 +1,16 @@ +{ lib, config, ... }: + +let + cfg = config.systemModules.hardware.backlight; + inherit (lib) mkIf mkEnableOption; +in + +{ + options.systemModules.hardware.backlight = { + enable = mkEnableOption "Enable backlight module"; + }; + + config = mkIf cfg.enable { + hardware.brillo.enable = true; + }; +} diff --git a/system/modules/hardware/bluetooth.nix b/system/modules/hardware/bluetooth/default.nix similarity index 70% rename from system/modules/hardware/bluetooth.nix rename to system/modules/hardware/bluetooth/default.nix index 6a6d4c6..0c68b3b 100644 --- a/system/modules/hardware/bluetooth.nix +++ b/system/modules/hardware/bluetooth/default.nix @@ -2,10 +2,16 @@ let cfg = config.systemModules.hardware.bluetooth; + inherit (lib) mkIf mkEnableOption; in { - config = lib.mkIf cfg.enable { + options.systemModules.hardware.bluetooth = { + enable = mkEnableOption "Enable bluetooth module"; + }; + + config = mkIf cfg.enable { + hardware.bluetooth = { enable = true; package = pkgs.bluez5-experimental; diff --git a/system/modules/hardware/default.nix b/system/modules/hardware/default.nix index ff8a8a4..cd9c0cf 100644 --- a/system/modules/hardware/default.nix +++ b/system/modules/hardware/default.nix @@ -1,17 +1,7 @@ -{ lib, ... }: - { imports = [ - ./bluetooth.nix - ./backlight.nix + ./bluetooth + ./backlight + ./ssd ]; - - options.systemModules.hardware = { - bluetooth = { - enable = lib.mkEnableOption "Enable bluetooth module"; - }; - backlight= { - enable = lib.mkEnableOption "Enable backlight module"; - }; - }; }