diff options
Diffstat (limited to 'modules/hardware/cpu.nix')
-rw-r--r-- | modules/hardware/cpu.nix | 27 |
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"]; + }) + ]); +} |