nixos, modules: rename myFlake.nixos.hardware.{cpu,gpu,misc} -> myFlake.nixos.hardware.components.{cpu,gpu,misc}

This commit is contained in:
Guanran Wang 2023-11-30 02:37:42 +08:00
parent 43f3ba8a43
commit 81ebafa0df
Signed by: nyancat
SSH key fingerprint: SHA256:8oWGKciPALWut/6WA27oFKofX+6Wtc0gQnsefXLQx/8
16 changed files with 42 additions and 37 deletions

View file

@ -7,7 +7,7 @@
(modulesPath + "/installer/scan/not-detected.nix") # what is this (modulesPath + "/installer/scan/not-detected.nix") # what is this
]; ];
myFlake.nixos.hardware = { myFlake.nixos.hardware.components = {
cpu.intel.enable = true; cpu.intel.enable = true;
gpu.intel.enable = true; gpu.intel.enable = true;

View file

@ -3,10 +3,10 @@
config, config,
... ...
}: let }: let
cfg = config.myFlake.nixos.hardware.cpu.intel; cfg = config.myFlake.nixos.hardware.components.cpu.intel;
in { in {
options = { 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 { config = lib.mkIf cfg.enable {

View file

@ -0,0 +1,7 @@
{...}: {
imports = [
./cpu
./gpu
./misc
];
}

View file

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

View file

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

View file

@ -3,11 +3,11 @@
config, config,
... ...
}: let }: let
cfg = config.myFlake.nixos.hardware.gpu.nvidia; cfg = config.myFlake.nixos.hardware.components.gpu.nvidia;
in { in {
options = { options = {
myFlake.nixos.hardware.gpu.nvidia.enable = lib.mkEnableOption "Whether to enable NVIDIA GPU."; myFlake.nixos.hardware.components.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.prime = lib.mkEnableOption "Whether to enable NVIDIA Prime.";
}; };
# https://nixos.wiki/wiki/Nvidia # https://nixos.wiki/wiki/Nvidia

View file

@ -3,11 +3,11 @@
config, config,
... ...
}: let }: let
cfg = config.myFlake.nixos.hardware.misc.audio; cfg = config.myFlake.nixos.hardware.components.misc.audio;
in { in {
options = { options = {
myFlake.nixos.hardware.misc.audio.enable = lib.mkEnableOption "Whether to enable audio."; myFlake.nixos.hardware.components.misc.audio.enable = lib.mkEnableOption "Whether to enable audio.";
myFlake.nixos.hardware.misc.audio.soundServer = lib.mkOption { myFlake.nixos.hardware.components.misc.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.nixos.hardware.misc.bluetooth; cfg = config.myFlake.nixos.hardware.components.misc.bluetooth;
in { in {
options = { 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 # https://nixos.wiki/wiki/Bluetooth

View file

@ -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;
};
}

View file

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

View file

@ -1,8 +1,6 @@
{...}: { {...}: {
imports = [ imports = [
./accessories ./accessories
./cpu ./components
./gpu
./misc
]; ];
} }

View file

@ -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;
};
}

View file

@ -44,10 +44,10 @@
getty.greetingLine = lib.strings.concatLines [ getty.greetingLine = lib.strings.concatLines [
''NixOS ${config.system.nixos.label} ${config.system.nixos.codeName} (\m) - \l'' ''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") "--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") "[ 5.996722] amdgpu 0000:67:00.0: Fatal error during GPU init")
]; ];