You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.0 KiB
Nix
55 lines
1.0 KiB
Nix
{ config, lib, ... }:
|
|
let
|
|
cpu = config.hardware.cpu;
|
|
anyArg = builtins.any (x: x) [
|
|
# list of conditions which require cpu type to be known
|
|
cpu.updateMicrocode
|
|
];
|
|
cpuOpts =
|
|
type:
|
|
lib.mkIf (anyArg && cpu.type == type) {
|
|
# options for all cpu types
|
|
updateMicrocode = lib.mkDefault cpu.updateMicrocode;
|
|
};
|
|
in
|
|
{
|
|
|
|
options = {
|
|
|
|
hardware.cpu = {
|
|
|
|
type = lib.mkOption {
|
|
description = ''
|
|
Configures the CPU type to expect this configuration to run on.
|
|
|
|
This setting is required when using generalizing options
|
|
like option{hardware.cpu.updateMicrocode}.
|
|
'';
|
|
type =
|
|
with lib.types;
|
|
nullOr (enum [
|
|
"amd"
|
|
"intel"
|
|
]);
|
|
# required
|
|
};
|
|
|
|
updateMicrocode = lib.mkEnableOption ''
|
|
microcode updates for CPU type selected in option{hardware.cpu.type}
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
config = {
|
|
|
|
hardware.cpu = {
|
|
amd = cpuOpts "amd";
|
|
intel = cpuOpts "intel";
|
|
};
|
|
|
|
};
|
|
|
|
}
|