nixos: modules: hardware: simplify

This commit is contained in:
Guanran Wang 2023-12-17 20:43:24 +08:00
parent 933a53f94a
commit 1ee4b0ca9a
Signed by: nyancat
SSH key fingerprint: SHA256:8oWGKciPALWut/6WA27oFKofX+6Wtc0gQnsefXLQx/8
6 changed files with 11 additions and 16 deletions

View file

@ -9,7 +9,7 @@
]; ];
services.hdapsd.enable = false; services.hdapsd.enable = false;
myFlake.hardware.components.misc = { myFlake.hardware.components = {
audio.enable = true; audio.enable = true;
bluetooth.enable = true; bluetooth.enable = true;
tpm.enable = true; tpm.enable = true;

View file

@ -3,11 +3,11 @@
config, config,
... ...
}: let }: let
cfg = config.myFlake.hardware.components.misc.audio; cfg = config.myFlake.hardware.components.audio;
in { in {
options = { options = {
myFlake.hardware.components.misc.audio.enable = lib.mkEnableOption "Whether to enable audio."; myFlake.hardware.components.audio.enable = lib.mkEnableOption "Whether to enable audio.";
myFlake.hardware.components.misc.audio.soundServer = lib.mkOption { myFlake.hardware.components.audio.soundServer = lib.mkOption {
type = lib.types.enum ["pipewire" "pulseaudio"]; type = lib.types.enum ["pipewire" "pulseaudio"];
default = "pipewire"; default = "pipewire";
example = "pulseaudio"; example = "pulseaudio";

View file

@ -4,10 +4,10 @@
pkgs, pkgs,
... ...
}: let }: let
cfg = config.myFlake.hardware.components.misc.bluetooth; cfg = config.myFlake.hardware.components.bluetooth;
in { in {
options = { 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 # https://nixos.wiki/wiki/Bluetooth

View file

@ -1,5 +1,7 @@
{...}: { {...}: {
imports = [ imports = [
./misc ./audio.nix
./bluetooth.nix
./tpm.nix
]; ];
} }

View file

@ -1,7 +0,0 @@
{...}: {
imports = [
./audio.nix
./bluetooth.nix
./tpm.nix
];
}

View file

@ -3,10 +3,10 @@
config, config,
... ...
}: let }: let
cfg = config.myFlake.hardware.components.misc.tpm; cfg = config.myFlake.hardware.components.tpm;
in { in {
options = { 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 # https://nixos.wiki/wiki/TPM