Commit 35ca84f9 authored by John Titor's avatar John Titor Committed by Masum Reza
Browse files

nixos/cpu/amd: allow overriding microcode pkg

parent e6a500c4
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -4,6 +4,10 @@
  pkgs,
  ...
}:

let
  cfg = config.hardware.cpu.amd;
in
{
  ###### interface
  options = {
@@ -16,12 +20,13 @@
      '';
    };

    hardware.cpu.amd.microcodePackage = lib.mkPackageOption pkgs "microcode-amd" { };
  };

  ###### implementation
  config = lib.mkIf config.hardware.cpu.amd.updateMicrocode {
    # Microcode updates must be the first item prepended in the initrd
    boot.initrd.prepend = lib.mkOrder 1 [ "${pkgs.microcode-amd}/amd-ucode.img" ];
    boot.initrd.prepend = lib.mkOrder 1 [ "${cfg.microcodePackage}/amd-ucode.img" ];
  };

}