summaryrefslogtreecommitdiffstats
path: root/modules/hardware/cpu.nix
diff options
context:
space:
mode:
authorJon Santmyer <jon@jonsantmyer.com>2024-01-07 12:00:08 -0500
committerJon Santmyer <jon@jonsantmyer.com>2024-01-07 12:00:08 -0500
commit7b79203f54853733d4fae88943829d0e24e6e49f (patch)
treea352d199fad7453332b9308a6295164157729f27 /modules/hardware/cpu.nix
parent184bd30bcb303104a4981ac742d8f8961c5477e7 (diff)
downloadnix-config-7b79203f54853733d4fae88943829d0e24e6e49f.tar.gz
nix-config-7b79203f54853733d4fae88943829d0e24e6e49f.tar.bz2
nix-config-7b79203f54853733d4fae88943829d0e24e6e49f.zip
massive overhaul
Diffstat (limited to 'modules/hardware/cpu.nix')
-rw-r--r--modules/hardware/cpu.nix27
1 files changed, 27 insertions, 0 deletions
diff --git a/modules/hardware/cpu.nix b/modules/hardware/cpu.nix
new file mode 100644
index 0000000..8bf2923
--- /dev/null
+++ b/modules/hardware/cpu.nix
@@ -0,0 +1,27 @@
+{
+ config,
+ options,
+ lib,
+ ...
+}: let
+ cpuConfig = config.modules.hardware.cpu;
+ device = config.modules.device;
+in {
+ options.modules.hardware.cpu = {
+ enable = lib.mkOption {
+ type = lib.types.bool;
+ default = true;
+ };
+ };
+
+ config = lib.mkIf (cpuConfig.enable) (lib.mkMerge [
+ {
+ hardware.enableRedistributableFirmware = true;
+ environment.systemPackages = [config.boot.kernelPackages.cpupower];
+ }
+ (lib.mkIf (device.cpu == "intel") {
+ hardware.cpu.intel.updateMicrocode = true;
+ boot.kernelModules = ["kvm-intel"];
+ })
+ ]);
+}