mirror of
https://github.com/Stunkymonkey/nixos.git
synced 2025-10-15 11:27:18 +02:00
45 lines
887 B
Nix
45 lines
887 B
Nix
{ config, lib, ... }:
|
|
let
|
|
cfg = config.my.hardware.firmware;
|
|
in
|
|
{
|
|
options.my.hardware.firmware = {
|
|
enable = lib.mkEnableOption "firmware configuration";
|
|
|
|
cpuFlavor = lib.mkOption {
|
|
type = lib.types.nullOr (
|
|
lib.types.enum [
|
|
"intel"
|
|
"amd"
|
|
]
|
|
);
|
|
default = null;
|
|
example = "intel";
|
|
description = "Which kind of CPU to activate micro-code updates";
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable (
|
|
lib.mkMerge [
|
|
{
|
|
hardware = {
|
|
enableRedistributableFirmware = true;
|
|
};
|
|
}
|
|
|
|
# Intel CPU
|
|
(lib.mkIf (cfg.cpuFlavor == "intel") {
|
|
hardware = {
|
|
cpu.intel.updateMicrocode = true;
|
|
};
|
|
})
|
|
|
|
# AMD CPU
|
|
(lib.mkIf (cfg.cpuFlavor == "amd") {
|
|
hardware = {
|
|
cpu.amd.updateMicrocode = true;
|
|
};
|
|
})
|
|
]
|
|
);
|
|
}
|