Files
nixpkgs/nixos/modules/hardware/facter/firmware.nix
andre4ik3 5dd1dff815 nixos/facter: add enable option
The option defaults to `report != { }` instead of `reportPath != null`,
because since the report may be set externally using `report`, guarding
for `reportPath != null` breaks setups that set it externally, since
none of the modules take effect any longer.
2026-03-11 09:07:52 +00:00

25 lines
824 B
Nix

{ lib, config, ... }:
let
facterLib = import ./lib.nix lib;
inherit (config.hardware.facter) report;
isBaremetal = config.hardware.facter.detected.virtualisation.none.enable;
hasAmdCpu = facterLib.hasAmdCpu report;
hasIntelCpu = facterLib.hasIntelCpu report;
in
{
config = lib.mkIf (config.hardware.facter.enable && isBaremetal) {
# none (e.g. bare-metal)
# provide firmware for devices that might not have been detected by nixos-facter
hardware.enableRedistributableFirmware = lib.mkDefault true;
# update microcode
hardware.cpu.amd.updateMicrocode = lib.mkIf hasAmdCpu (
lib.mkDefault config.hardware.enableRedistributableFirmware
);
hardware.cpu.intel.updateMicrocode = lib.mkIf hasIntelCpu (
lib.mkDefault config.hardware.enableRedistributableFirmware
);
};
}