at master 655 B view raw
1{ 2 config, 3 lib, 4 pkgs, 5 ... 6}: 7 8let 9 cfg = config.hardware.cpu.amd; 10in 11{ 12 ###### interface 13 options = { 14 15 hardware.cpu.amd.updateMicrocode = lib.mkOption { 16 default = false; 17 type = lib.types.bool; 18 description = '' 19 Update the CPU microcode for AMD processors. 20 ''; 21 }; 22 23 hardware.cpu.amd.microcodePackage = lib.mkPackageOption pkgs "microcode-amd" { }; 24 }; 25 26 ###### implementation 27 config = lib.mkIf config.hardware.cpu.amd.updateMicrocode { 28 # Microcode updates must be the first item prepended in the initrd 29 boot.initrd.prepend = lib.mkOrder 1 [ "${cfg.microcodePackage}/amd-ucode.img" ]; 30 }; 31 32}