From 7b79203f54853733d4fae88943829d0e24e6e49f Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Sun, 7 Jan 2024 12:00:08 -0500 Subject: massive overhaul --- modules/hardware/cpu.nix | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 modules/hardware/cpu.nix (limited to 'modules/hardware/cpu.nix') 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"]; + }) + ]); +} -- cgit v1.2.1