diff --git a/nixos/hardware/lenovo/legion/81fw/default.nix b/nixos/hardware/lenovo/legion/81fw/default.nix index ded7b09..95666c4 100644 --- a/nixos/hardware/lenovo/legion/81fw/default.nix +++ b/nixos/hardware/lenovo/legion/81fw/default.nix @@ -7,7 +7,7 @@ (modulesPath + "/installer/scan/not-detected.nix") # what is this ]; - myFlake.nixos.hardware = { + myFlake.nixos.hardware.components = { cpu.intel.enable = true; gpu.intel.enable = true; diff --git a/nixos/modules/hardware/cpu/default.nix b/nixos/modules/hardware/components/cpu/default.nix similarity index 100% rename from nixos/modules/hardware/cpu/default.nix rename to nixos/modules/hardware/components/cpu/default.nix diff --git a/nixos/modules/hardware/cpu/intel.nix b/nixos/modules/hardware/components/cpu/intel.nix similarity index 57% rename from nixos/modules/hardware/cpu/intel.nix rename to nixos/modules/hardware/components/cpu/intel.nix index 0393195..b7ba211 100755 --- a/nixos/modules/hardware/cpu/intel.nix +++ b/nixos/modules/hardware/components/cpu/intel.nix @@ -3,10 +3,10 @@ config, ... }: let - cfg = config.myFlake.nixos.hardware.cpu.intel; + cfg = config.myFlake.nixos.hardware.components.cpu.intel; in { options = { - myFlake.nixos.hardware.cpu.intel.enable = lib.mkEnableOption "Whether to enable Intel CPU."; + myFlake.nixos.hardware.components.cpu.intel.enable = lib.mkEnableOption "Whether to enable Intel CPU."; }; config = lib.mkIf cfg.enable { diff --git a/nixos/modules/hardware/components/default.nix b/nixos/modules/hardware/components/default.nix new file mode 100644 index 0000000..08405b1 --- /dev/null +++ b/nixos/modules/hardware/components/default.nix @@ -0,0 +1,7 @@ +{...}: { + imports = [ + ./cpu + ./gpu + ./misc + ]; +} diff --git a/nixos/modules/hardware/gpu/amd.nix b/nixos/modules/hardware/components/gpu/amd.nix similarity index 81% rename from nixos/modules/hardware/gpu/amd.nix rename to nixos/modules/hardware/components/gpu/amd.nix index 77188d6..c1c212c 100644 --- a/nixos/modules/hardware/gpu/amd.nix +++ b/nixos/modules/hardware/components/gpu/amd.nix @@ -4,10 +4,10 @@ pkgs, ... }: let - cfg = config.myFlake.nixos.hardware.gpu.amd; + cfg = config.myFlake.nixos.hardware.components.gpu.amd; in { options = { - myFlake.nixos.hardware.gpu.amd.enable = lib.mkEnableOption "Whether to enable AMD GPU."; + myFlake.nixos.hardware.components.gpu.amd.enable = lib.mkEnableOption "Whether to enable AMD GPU."; }; # https://nixos.wiki/wiki/AMD_GPU diff --git a/nixos/modules/hardware/gpu/default.nix b/nixos/modules/hardware/components/gpu/default.nix similarity index 100% rename from nixos/modules/hardware/gpu/default.nix rename to nixos/modules/hardware/components/gpu/default.nix diff --git a/nixos/modules/hardware/gpu/intel.nix b/nixos/modules/hardware/components/gpu/intel.nix similarity index 82% rename from nixos/modules/hardware/gpu/intel.nix rename to nixos/modules/hardware/components/gpu/intel.nix index 5dfe17f..7483a79 100644 --- a/nixos/modules/hardware/gpu/intel.nix +++ b/nixos/modules/hardware/components/gpu/intel.nix @@ -4,10 +4,10 @@ pkgs, ... }: let - cfg = config.myFlake.nixos.hardware.gpu.intel; + cfg = config.myFlake.nixos.hardware.components.gpu.intel; in { options = { - myFlake.nixos.hardware.gpu.intel.enable = lib.mkEnableOption "Whether to enable Intel GPU."; + myFlake.nixos.hardware.components.gpu.intel.enable = lib.mkEnableOption "Whether to enable Intel GPU."; }; # https://nixos.wiki/wiki/Intel_Graphics diff --git a/nixos/modules/hardware/gpu/nvidia.nix b/nixos/modules/hardware/components/gpu/nvidia.nix similarity index 79% rename from nixos/modules/hardware/gpu/nvidia.nix rename to nixos/modules/hardware/components/gpu/nvidia.nix index 240ad7f..7fb8d83 100755 --- a/nixos/modules/hardware/gpu/nvidia.nix +++ b/nixos/modules/hardware/components/gpu/nvidia.nix @@ -3,11 +3,11 @@ config, ... }: let - cfg = config.myFlake.nixos.hardware.gpu.nvidia; + cfg = config.myFlake.nixos.hardware.components.gpu.nvidia; in { options = { - myFlake.nixos.hardware.gpu.nvidia.enable = lib.mkEnableOption "Whether to enable NVIDIA GPU."; - myFlake.nixos.hardware.gpu.nvidia.prime = lib.mkEnableOption "Whether to enable NVIDIA Prime."; + myFlake.nixos.hardware.components.gpu.nvidia.enable = lib.mkEnableOption "Whether to enable NVIDIA GPU."; + myFlake.nixos.hardware.components.gpu.nvidia.prime = lib.mkEnableOption "Whether to enable NVIDIA Prime."; }; # https://nixos.wiki/wiki/Nvidia diff --git a/nixos/modules/hardware/misc/audio.nix b/nixos/modules/hardware/components/misc/audio.nix similarity index 76% rename from nixos/modules/hardware/misc/audio.nix rename to nixos/modules/hardware/components/misc/audio.nix index 6f964a4..51ca106 100755 --- a/nixos/modules/hardware/misc/audio.nix +++ b/nixos/modules/hardware/components/misc/audio.nix @@ -3,11 +3,11 @@ config, ... }: let - cfg = config.myFlake.nixos.hardware.misc.audio; + cfg = config.myFlake.nixos.hardware.components.misc.audio; in { options = { - myFlake.nixos.hardware.misc.audio.enable = lib.mkEnableOption "Whether to enable audio."; - myFlake.nixos.hardware.misc.audio.soundServer = lib.mkOption { + myFlake.nixos.hardware.components.misc.audio.enable = lib.mkEnableOption "Whether to enable audio."; + myFlake.nixos.hardware.components.misc.audio.soundServer = lib.mkOption { type = lib.types.enum ["pipewire" "pulseaudio"]; default = "pipewire"; example = "pulseaudio"; diff --git a/nixos/modules/hardware/misc/bluetooth.nix b/nixos/modules/hardware/components/misc/bluetooth.nix similarity index 70% rename from nixos/modules/hardware/misc/bluetooth.nix rename to nixos/modules/hardware/components/misc/bluetooth.nix index 5d5e796..29d26d4 100755 --- a/nixos/modules/hardware/misc/bluetooth.nix +++ b/nixos/modules/hardware/components/misc/bluetooth.nix @@ -4,10 +4,10 @@ pkgs, ... }: let - cfg = config.myFlake.nixos.hardware.misc.bluetooth; + cfg = config.myFlake.nixos.hardware.components.misc.bluetooth; in { options = { - myFlake.nixos.hardware.misc.bluetooth.enable = lib.mkEnableOption "Whether to enable bluetooth."; + myFlake.nixos.hardware.components.misc.bluetooth.enable = lib.mkEnableOption "Whether to enable bluetooth."; }; # https://nixos.wiki/wiki/Bluetooth diff --git a/nixos/modules/hardware/misc/default.nix b/nixos/modules/hardware/components/misc/default.nix similarity index 100% rename from nixos/modules/hardware/misc/default.nix rename to nixos/modules/hardware/components/misc/default.nix diff --git a/nixos/modules/hardware/components/misc/fstrim.nix b/nixos/modules/hardware/components/misc/fstrim.nix new file mode 100644 index 0000000..da84afe --- /dev/null +++ b/nixos/modules/hardware/components/misc/fstrim.nix @@ -0,0 +1,15 @@ +{ + lib, + config, + ... +}: let + cfg = config.myFlake.nixos.hardware.components.misc.fstrim; +in { + options = { + myFlake.nixos.hardware.components.misc.fstrim.enable = lib.mkEnableOption "Whether to enable SSD triming in background."; + }; + + config = lib.mkIf cfg.enable { + services.fstrim.enable = true; + }; +} diff --git a/nixos/modules/hardware/misc/tpm.nix b/nixos/modules/hardware/components/misc/tpm.nix similarity index 75% rename from nixos/modules/hardware/misc/tpm.nix rename to nixos/modules/hardware/components/misc/tpm.nix index 664866f..4bfbe06 100644 --- a/nixos/modules/hardware/misc/tpm.nix +++ b/nixos/modules/hardware/components/misc/tpm.nix @@ -3,10 +3,10 @@ config, ... }: let - cfg = config.myFlake.nixos.hardware.misc.tpm; + cfg = config.myFlake.nixos.hardware.components.misc.tpm; in { options = { - myFlake.nixos.hardware.misc.tpm.enable = lib.mkEnableOption "Whether to enable TPM."; + myFlake.nixos.hardware.components.misc.tpm.enable = lib.mkEnableOption "Whether to enable TPM."; }; # https://nixos.wiki/wiki/TPM diff --git a/nixos/modules/hardware/default.nix b/nixos/modules/hardware/default.nix index e4a5cb8..71d00cb 100644 --- a/nixos/modules/hardware/default.nix +++ b/nixos/modules/hardware/default.nix @@ -1,8 +1,6 @@ {...}: { imports = [ ./accessories - ./cpu - ./gpu - ./misc + ./components ]; } diff --git a/nixos/modules/hardware/misc/fstrim.nix b/nixos/modules/hardware/misc/fstrim.nix deleted file mode 100644 index 252ef5f..0000000 --- a/nixos/modules/hardware/misc/fstrim.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ - lib, - config, - ... -}: let - cfg = config.myFlake.nixos.hardware.misc.fstrim; -in { - options = { - myFlake.nixos.hardware.misc.fstrim.enable = lib.mkEnableOption "Whether to enable SSD triming in background."; - }; - - config = lib.mkIf cfg.enable { - services.fstrim.enable = true; - }; -} diff --git a/nixos/profiles/core/default.nix b/nixos/profiles/core/default.nix index 2d91b46..5c858ac 100644 --- a/nixos/profiles/core/default.nix +++ b/nixos/profiles/core/default.nix @@ -44,10 +44,10 @@ getty.greetingLine = lib.strings.concatLines [ ''NixOS ${config.system.nixos.label} ${config.system.nixos.codeName} (\m) - \l'' - (lib.strings.optionalString config.myFlake.nixos.hardware.gpu.nvidia.enable + (lib.strings.optionalString config.myFlake.nixos.hardware.components.gpu.nvidia.enable "--my-next-gpu-wont-be-nvidia") - (lib.strings.optionalString config.myFlake.nixos.hardware.gpu.amd.enable + (lib.strings.optionalString config.myFlake.nixos.hardware.components.gpu.amd.enable "[ 5.996722] amdgpu 0000:67:00.0: Fatal error during GPU init") ];