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