Commit 387d5a5

HPCesia <me@hpcesia.com>
2025-11-12 19:14:32
refactor: kevin hardware config
1 parent fd81529
modules/hosts/kevin/hardware/cpu-intel.nix
@@ -0,0 +1,15 @@
+{inputs, ...}: {
+  flake.modules.nixos."hosts/kevin" = _: {
+    imports = with inputs.nixos-hardware.nixosModules; [
+      common-cpu-intel
+    ];
+
+    hardware.enableRedistributableFirmware = true;
+    hardware.cpu.intel.updateMicrocode = true;
+
+    services.xserver.videoDrivers = ["modesetting"];
+    hardware.graphics.enable = true;
+
+    boot.kernelModules = ["kvm_intel"];
+  };
+}
modules/hosts/kevin/hardware/gpu-nvidia.nix
@@ -0,0 +1,26 @@
+{
+  flake.modules.nixos."hosts/kevin" = {config, ...}: {
+    hardware.nvidia = {
+      package = config.boot.kernelPackages.nvidiaPackages.stable;
+      open = true;
+      nvidiaSettings = true;
+      prime = {
+        intelBusId = "PCI:0:2:0";
+        nvidiaBusId = "PCI:1:0:0";
+        offload = {
+          enable = true;
+          enableOffloadCmd = true;
+        };
+      };
+      powerManagement = {
+        enable = true;
+        finegrained = true;
+      };
+    };
+    services.xserver.videoDrivers = ["nvidia"];
+    hardware.graphics.enable = true;
+    nixpkgs.config.cudaSupport = true;
+
+    boot.initrd.kernelModules = ["nvidia"];
+  };
+}
modules/hosts/kevin/hardware/misc.nix
@@ -0,0 +1,45 @@
+{inputs, ...}: {
+  flake.modules.nixos."hosts/kevin" = {pkgs, ...}: {
+    imports = with inputs.nixos-hardware.nixosModules; [
+      common-pc-laptop
+      common-pc-laptop-ssd
+    ];
+
+    boot.initrd.availableKernelModules = [
+      "xhci_pci"
+      "nvme"
+      "thunderbolt"
+      "usbhid"
+      "sdhci_pci"
+    ];
+
+    # Thunderbolt
+    services.hardware.bolt.enable = true;
+
+    # Bluetooth
+    hardware.bluetooth.enable = true;
+
+    # Fingerprint
+    services.fprintd = {
+      enable = true;
+      tod = {
+        enable = true;
+        driver = pkgs.libfprint-2-tod1-goodix;
+      };
+    };
+    systemd.services.fprintd = {
+      wantedBy = ["multi-user.target"];
+      serviceConfig.Type = "simple";
+    };
+
+    # Lid Settings
+    services.logind.settings.Login = {
+      HandleLidSwitch = "hibernate";
+      HandleLidSwitchExternalPower = "lock";
+      HandleLidSwitchDocked = "ignore";
+    };
+
+    # Cooling management
+    services.thermald.enable = true;
+  };
+}
modules/hosts/kevin/hardware/screen.nix
@@ -0,0 +1,25 @@
+{
+  inputs,
+  lib,
+  ...
+}: {
+  flake.modules.nixos."hosts/kevin" = _: {
+    imports = with inputs.nixos-hardware.nixosModules; [
+      common-hidpi
+    ];
+
+    # √(3200² + 2000²) px / 16 in ≃ 235 dpi
+    services.xserver.dpi = 235;
+
+    services.kmscon.extraConfig = "font-size=20";
+  };
+
+  flake.modules.homeManager."hosts/kevin" = {osConfig, ...}: let
+    hasNiri = osConfig.programs.niri.enable;
+  in
+    lib.optionalAttrs hasNiri {
+      programs.niri.settings.outputs."eDP-1" = {
+        variable-refresh-rate = true;
+      };
+    };
+}
modules/hosts/kevin/home/plasma.nix → modules/hosts/kevin/hardware/touchpad.nix
@@ -1,4 +1,8 @@
 {lib, ...}: {
+  flake.modules.nixos."hosts/kevin" = _: {
+    services.libinput.enable = true;
+  };
+
   flake.modules.homeManager."hosts/kevin" = {osConfig, ...}: let
     hasPlasma = osConfig.services.desktopManager.plasma6.enable;
   in
modules/hosts/kevin/home/niri.nix
@@ -1,10 +0,0 @@
-{lib, ...}: {
-  flake.modules.homeManager."hosts/kevin" = {osConfig, ...}: let
-    hasNiri = osConfig.programs.niri.enable;
-  in
-    lib.optionalAttrs hasNiri {
-      programs.niri.settings.outputs."eDP-1" = {
-        variable-refresh-rate = true;
-      };
-    };
-}
modules/hosts/kevin/boot.nix
@@ -26,17 +26,8 @@
     boot.initrd.systemd = {
       enable = true;
     };
-    boot.initrd.kernelModules = ["nvidia"];
-    boot.initrd.availableKernelModules = [
-      "xhci_pci"
-      "nvme"
-      "thunderbolt"
-      "usbhid"
-      "sdhci_pci"
-    ];
 
     boot.kernelPackages = pkgs.linuxPackages_xanmod_stable;
-    boot.kernelModules = ["kvm_intel"];
     boot.kernelParams = ["mem_sleep_default=deep"];
   };
 }
modules/hosts/kevin/default.nix
@@ -17,6 +17,7 @@
         core
         desktop
         dev
+        game
         user-root
         user-hpcesia
         ssh-host-pardofelis
@@ -36,6 +37,7 @@
                 core
                 desktop
                 dev
+                game
                 user-hpcesia
               ])
               ++ [config.flake.modules.homeManager."hosts/kevin"];
modules/hosts/kevin/hardware.nix
@@ -1,76 +0,0 @@
-{inputs, ...}: {
-  flake.modules.nixos."hosts/kevin" = {
-    config,
-    pkgs,
-    ...
-  }: {
-    imports = with inputs.nixos-hardware.nixosModules; [
-      common-cpu-intel
-      common-hidpi
-      common-pc-laptop
-      common-pc-laptop-ssd
-    ];
-
-    hardware.enableRedistributableFirmware = true;
-    hardware.cpu.intel.updateMicrocode = true;
-
-    # NVIDIA
-    hardware.nvidia = {
-      package = config.boot.kernelPackages.nvidiaPackages.stable;
-      open = true;
-      nvidiaSettings = true;
-      prime = {
-        intelBusId = "PCI:0:2:0";
-        nvidiaBusId = "PCI:1:0:0";
-        offload = {
-          enable = true;
-          enableOffloadCmd = true;
-        };
-      };
-      powerManagement = {
-        enable = true;
-        finegrained = true;
-      };
-    };
-    services.xserver.videoDrivers = ["nvidia" "modesetting"];
-    hardware.graphics.enable = true;
-    nixpkgs.config.cudaSupport = true;
-
-    # Thunderbolt
-    services.hardware.bolt.enable = true;
-
-    # Bluetooth
-    hardware.bluetooth.enable = true;
-
-    # Fingerprint
-    services.fprintd = {
-      enable = true;
-      tod = {
-        enable = true;
-        driver = pkgs.libfprint-2-tod1-goodix;
-      };
-    };
-    systemd.services.fprintd = {
-      wantedBy = ["multi-user.target"];
-      serviceConfig.Type = "simple";
-    };
-
-    # Lid Settings
-    services.logind.settings.Login = {
-      HandleLidSwitch = "hibernate";
-      HandleLidSwitchExternalPower = "lock";
-      HandleLidSwitchDocked = "ignore";
-    };
-
-    # Cooling management
-    services.thermald.enable = true;
-
-    # Touchpad
-    services.libinput.enable = true;
-
-    # √(3200² + 2000²) px / 16 in ≃ 235 dpi
-    services.xserver.dpi = 235;
-
-    services.kmscon.extraConfig = "font-size=20";
-  };
-}
modules/hosts/kevin/home/default.nix → modules/hosts/kevin/home.nix
File renamed without changes