modules: hardware: add firmware

add-woodpecker
Bruno BELANYI 8 months ago
parent c987206bc5
commit 256c857ac0
  1. 1
      modules/hardware/default.nix
  2. 38
      modules/hardware/firmware/default.nix

@ -5,6 +5,7 @@
imports = [
./bluetooth
./ergodox
./firmware
./mx-ergo
./networking
./sound

@ -0,0 +1,38 @@
{ config, lib, pkgs, ... }:
let
cfg = config.my.hardware.firmware;
in
{
options.my.hardware.firmware = with lib; {
enable = my.mkDisableOption "firmware configuration";
cpuFlavor = mkOption {
type = with types; nullOr (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;
};
})
]);
}
Loading…
Cancel
Save