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.
95 lines
1.3 KiB
Nix
95 lines
1.3 KiB
Nix
# applicable to all hosts running on bare hardware
|
|
|
|
{ config
|
|
, lib
|
|
, pkgs
|
|
, ...
|
|
}:
|
|
let
|
|
cfg = config.x-banananetwork.hwCommon;
|
|
in
|
|
{
|
|
|
|
|
|
options = {
|
|
|
|
x-banananetwork.hwCommon = {
|
|
|
|
enable = lib.mkEnableOption ''
|
|
settings common to all bare hardware-based hosts
|
|
'';
|
|
|
|
cpu = lib.mkOption {
|
|
description = ''
|
|
Configures the CPU type to expect this configuration to run on
|
|
'';
|
|
type = lib.types.enum [ "amd" "intel" ];
|
|
# required
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
|
|
hardware = {
|
|
|
|
cpu = lib.mkMerge [
|
|
|
|
(
|
|
lib.mkIf
|
|
(cfg.cpu == "amd")
|
|
{ amd.updateMicrocode = true; }
|
|
)
|
|
|
|
(
|
|
lib.mkIf
|
|
(cfg.cpu == "intel")
|
|
{ intel.updateMicrocode = true; }
|
|
)
|
|
|
|
];
|
|
|
|
enableRedistributableFirmware = true;
|
|
|
|
};
|
|
|
|
|
|
powerManagement = {
|
|
cpuFreqGovernor = "ondemand";
|
|
enable = true;
|
|
powertop.enable = true;
|
|
scsiLinkPolicy = "med_power_with_dipm";
|
|
};
|
|
|
|
|
|
services = {
|
|
|
|
fwupd = {
|
|
enable = true;
|
|
};
|
|
|
|
smartd = {
|
|
enable = true;
|
|
};
|
|
|
|
};
|
|
|
|
|
|
x-banananetwork = {
|
|
|
|
allCommon.enable = true;
|
|
vmCommon.enable = false;
|
|
usuable.enable = lib.mkDefault true; # add docs & tools for emergencies
|
|
|
|
};
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|