From 1ee4b0ca9ab316830bfc4d81cc45f84a1fb044d1 Mon Sep 17 00:00:00 2001 From: Guanran Wang Date: Sun, 17 Dec 2023 20:43:24 +0800 Subject: [PATCH] nixos: modules: hardware: simplify --- nixos/hosts/Aristotle/default.nix | 2 +- nixos/modules/hardware/components/{misc => }/audio.nix | 6 +++--- nixos/modules/hardware/components/{misc => }/bluetooth.nix | 4 ++-- nixos/modules/hardware/components/default.nix | 4 +++- nixos/modules/hardware/components/misc/default.nix | 7 ------- nixos/modules/hardware/components/{misc => }/tpm.nix | 4 ++-- 6 files changed, 11 insertions(+), 16 deletions(-) rename nixos/modules/hardware/components/{misc => }/audio.nix (78%) rename nixos/modules/hardware/components/{misc => }/bluetooth.nix (72%) delete mode 100644 nixos/modules/hardware/components/misc/default.nix rename nixos/modules/hardware/components/{misc => }/tpm.nix (76%) diff --git a/nixos/hosts/Aristotle/default.nix b/nixos/hosts/Aristotle/default.nix index ce16d9b..744ea9f 100644 --- a/nixos/hosts/Aristotle/default.nix +++ b/nixos/hosts/Aristotle/default.nix @@ -9,7 +9,7 @@ ]; services.hdapsd.enable = false; - myFlake.hardware.components.misc = { + myFlake.hardware.components = { audio.enable = true; bluetooth.enable = true; tpm.enable = true; diff --git a/nixos/modules/hardware/components/misc/audio.nix b/nixos/modules/hardware/components/audio.nix similarity index 78% rename from nixos/modules/hardware/components/misc/audio.nix rename to nixos/modules/hardware/components/audio.nix index 4a73dc8..8cc21d6 100755 --- a/nixos/modules/hardware/components/misc/audio.nix +++ b/nixos/modules/hardware/components/audio.nix @@ -3,11 +3,11 @@ config, ... }: let - cfg = config.myFlake.hardware.components.misc.audio; + cfg = config.myFlake.hardware.components.audio; in { options = { - myFlake.hardware.components.misc.audio.enable = lib.mkEnableOption "Whether to enable audio."; - myFlake.hardware.components.misc.audio.soundServer = lib.mkOption { + myFlake.hardware.components.audio.enable = lib.mkEnableOption "Whether to enable audio."; + myFlake.hardware.components.audio.soundServer = lib.mkOption { type = lib.types.enum ["pipewire" "pulseaudio"]; default = "pipewire"; example = "pulseaudio"; diff --git a/nixos/modules/hardware/components/misc/bluetooth.nix b/nixos/modules/hardware/components/bluetooth.nix similarity index 72% rename from nixos/modules/hardware/components/misc/bluetooth.nix rename to nixos/modules/hardware/components/bluetooth.nix index 5c04796..120697b 100755 --- a/nixos/modules/hardware/components/misc/bluetooth.nix +++ b/nixos/modules/hardware/components/bluetooth.nix @@ -4,10 +4,10 @@ pkgs, ... }: let - cfg = config.myFlake.hardware.components.misc.bluetooth; + cfg = config.myFlake.hardware.components.bluetooth; in { options = { - myFlake.hardware.components.misc.bluetooth.enable = lib.mkEnableOption "Whether to enable bluetooth."; + myFlake.hardware.components.bluetooth.enable = lib.mkEnableOption "Whether to enable bluetooth."; }; # https://nixos.wiki/wiki/Bluetooth diff --git a/nixos/modules/hardware/components/default.nix b/nixos/modules/hardware/components/default.nix index 1bd6a41..ca4fda4 100644 --- a/nixos/modules/hardware/components/default.nix +++ b/nixos/modules/hardware/components/default.nix @@ -1,5 +1,7 @@ {...}: { imports = [ - ./misc + ./audio.nix + ./bluetooth.nix + ./tpm.nix ]; } diff --git a/nixos/modules/hardware/components/misc/default.nix b/nixos/modules/hardware/components/misc/default.nix deleted file mode 100644 index ca4fda4..0000000 --- a/nixos/modules/hardware/components/misc/default.nix +++ /dev/null @@ -1,7 +0,0 @@ -{...}: { - imports = [ - ./audio.nix - ./bluetooth.nix - ./tpm.nix - ]; -} diff --git a/nixos/modules/hardware/components/misc/tpm.nix b/nixos/modules/hardware/components/tpm.nix similarity index 76% rename from nixos/modules/hardware/components/misc/tpm.nix rename to nixos/modules/hardware/components/tpm.nix index 14bc344..c6ac17a 100644 --- a/nixos/modules/hardware/components/misc/tpm.nix +++ b/nixos/modules/hardware/components/tpm.nix @@ -3,10 +3,10 @@ config, ... }: let - cfg = config.myFlake.hardware.components.misc.tpm; + cfg = config.myFlake.hardware.components.tpm; in { options = { - myFlake.hardware.components.misc.tpm.enable = lib.mkEnableOption "Whether to enable TPM."; + myFlake.hardware.components.tpm.enable = lib.mkEnableOption "Whether to enable TPM."; }; # https://nixos.wiki/wiki/TPM