about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-04-05 20:23:51 -0700
committerFranck Cuny <franck@fcuny.net>2022-04-05 20:23:51 -0700
commit2c078669e3b526f3c4ea9d383adddedf30535946 (patch)
treea01656329b8d44012b3799eb573b902a62047091
parentrefactor modules for btrfs, ssd, and fwupd (diff)
downloadworld-2c078669e3b526f3c4ea9d383adddedf30535946.tar.gz
refactor intel related configuration
-rw-r--r--hosts/aptos/default.nix1
-rw-r--r--hosts/aptos/hardware-configuration.nix53
-rw-r--r--hosts/common/hardware/intel.nix4
-rw-r--r--hosts/common/hardware/xps9300.nix5
-rw-r--r--modules/hardware/default.nix2
-rw-r--r--modules/hardware/intel/default.nix13
6 files changed, 40 insertions, 38 deletions
diff --git a/hosts/aptos/default.nix b/hosts/aptos/default.nix
index a469aec..aa012c9 100644
--- a/hosts/aptos/default.nix
+++ b/hosts/aptos/default.nix
@@ -6,7 +6,6 @@
     ./sound.nix
     ./networking.nix
     ../common/desktop
-    ../common/hardware/xps9300.nix
   ];
 
   boot = { initrd = { luks.devices."system".allowDiscards = true; }; };
diff --git a/hosts/aptos/hardware-configuration.nix b/hosts/aptos/hardware-configuration.nix
index 8cdf86f..085db9f 100644
--- a/hosts/aptos/hardware-configuration.nix
+++ b/hosts/aptos/hardware-configuration.nix
@@ -4,43 +4,42 @@
 { config, lib, pkgs, modulesPath, ... }:
 
 {
-  imports =
-    [ (modulesPath + "/installer/scan/not-detected.nix")
-    ];
+  imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
 
-  boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
+  boot.initrd.availableKernelModules =
+    [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
   boot.initrd.kernelModules = [ ];
   boot.extraModulePackages = [ ];
 
-  fileSystems."/" =
-    { device = "/dev/disk/by-uuid/292e07ac-4199-4a97-94a6-bd2fd2a9cf6a";
-      fsType = "btrfs";
-      options = [ "subvol=nixos" ];
-    };
+  fileSystems."/" = {
+    device = "/dev/disk/by-uuid/292e07ac-4199-4a97-94a6-bd2fd2a9cf6a";
+    fsType = "btrfs";
+    options = [ "subvol=nixos" ];
+  };
 
-  boot.initrd.luks.devices."system".device = "/dev/disk/by-uuid/c83a8db7-4215-4864-8a46-b8ca839d8c05";
+  boot.initrd.luks.devices."system".device =
+    "/dev/disk/by-uuid/c83a8db7-4215-4864-8a46-b8ca839d8c05";
 
-  fileSystems."/home" =
-    { device = "/dev/disk/by-uuid/292e07ac-4199-4a97-94a6-bd2fd2a9cf6a";
-      fsType = "btrfs";
-      options = [ "subvol=home" ];
-    };
+  fileSystems."/home" = {
+    device = "/dev/disk/by-uuid/292e07ac-4199-4a97-94a6-bd2fd2a9cf6a";
+    fsType = "btrfs";
+    options = [ "subvol=home" ];
+  };
 
-  fileSystems."/.snapshots" =
-    { device = "/dev/disk/by-uuid/292e07ac-4199-4a97-94a6-bd2fd2a9cf6a";
-      fsType = "btrfs";
-      options = [ "subvol=snapshots" ];
-    };
+  fileSystems."/.snapshots" = {
+    device = "/dev/disk/by-uuid/292e07ac-4199-4a97-94a6-bd2fd2a9cf6a";
+    fsType = "btrfs";
+    options = [ "subvol=snapshots" ];
+  };
 
-  fileSystems."/boot" =
-    { device = "/dev/disk/by-uuid/42D9-6EA8";
-      fsType = "vfat";
-    };
+  fileSystems."/boot" = {
+    device = "/dev/disk/by-uuid/42D9-6EA8";
+    fsType = "vfat";
+  };
 
   swapDevices =
-    [ { device = "/dev/disk/by-uuid/24041034-ff39-44bf-a04c-8fd8318b554d"; }
-    ];
+    [{ device = "/dev/disk/by-uuid/24041034-ff39-44bf-a04c-8fd8318b554d"; }];
 
+  my.hardware.intel.enable = true;
   powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
-  hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
 }
diff --git a/hosts/common/hardware/intel.nix b/hosts/common/hardware/intel.nix
deleted file mode 100644
index ac279fb..0000000
--- a/hosts/common/hardware/intel.nix
+++ /dev/null
@@ -1,4 +0,0 @@
-{
-  hardware.cpu.intel.updateMicrocode = true;
-  boot.kernelModules = [ "kvm-intel" ];
-}
diff --git a/hosts/common/hardware/xps9300.nix b/hosts/common/hardware/xps9300.nix
deleted file mode 100644
index 7934478..0000000
--- a/hosts/common/hardware/xps9300.nix
+++ /dev/null
@@ -1,5 +0,0 @@
-{
-  imports = [
-    ./intel.nix
-  ];
-}
diff --git a/modules/hardware/default.nix b/modules/hardware/default.nix
index 16761db..62208c1 100644
--- a/modules/hardware/default.nix
+++ b/modules/hardware/default.nix
@@ -1,5 +1,5 @@
 { ... }:
 
 {
-  imports = [ ./ssd ./sound ./networking ];
+  imports = [ ./intel ./ssd ./sound ./networking ];
 }
diff --git a/modules/hardware/intel/default.nix b/modules/hardware/intel/default.nix
new file mode 100644
index 0000000..9a53f35
--- /dev/null
+++ b/modules/hardware/intel/default.nix
@@ -0,0 +1,13 @@
+{ config, lib, ... }:
+let cfg = config.my.hardware.intel;
+in {
+  options.my.hardware.intel = with lib; {
+    enable = mkEnableOption "intel related configuration";
+  };
+
+  config = lib.mkIf cfg.enable {
+    # Enable microcode update
+    hardware.cpu.intel.updateMicrocode = true;
+    boot.kernelModules = [ "kvm-intel" ];
+  };
+}