nixos-modules: add hardware.cpu.updateMicrocode as generalizing option

secrix-issue25
Felix Stupp 1 year ago
parent 1290388956
commit bc47fe75b4
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -28,6 +28,13 @@ in
# required # required
}; };
updateMicrocode = lib.mkEnableOption ''
microcode updates for CPU type selected in option{hardware.cpu.type}.
Because this module is not yet part of upstream,
it requires option{x-banananetwork.hwCommon.enable} to be enabled.
'';
}; };
@ -50,17 +57,23 @@ in
cpu = lib.mkMerge [ cpu = lib.mkMerge [
# TODO maybe upstream?
( (
lib.mkIf let
(cpu.type == "amd") type = config.hardware.cpu.type;
{ amd.updateMicrocode = true; } opts = isType: {
updateMicrocode = lib.mkDefault (isType && config.hardware.cpu.updateMicrocode);
};
in
{
amd = opts (type == "amd");
intel = opts (type == "intel");
}
) )
( {
lib.mkIf updateMicrocode = lib.mkDefault true;
(cpu.type == "intel") }
{ intel.updateMicrocode = true; }
)
]; ];

Loading…
Cancel
Save