/ucodenix

Nix flake providing AMD microcode updates for unsupported CPUs

Primary LanguageNixGNU General Public License v3.0GPL-3.0

ucodenix

About

ucodenix is a Nix flake providing AMD microcode updates for unsupported CPUs.

Note

Microcodes are fetched from this repository, which aggregates them from official sources provided and made public by various manufacturers.

Features

  • Fetches the microcode binary based on your processor's model ID.
  • Generates the microcode container as used by the Linux kernel.
  • Integrates the generated microcode into the NixOS configuration.

Installation

Add the flake as an input:

inputs.ucodenix.url = "github:e-tho/ucodenix";

Usage

Install cpuid and run the following command to retrieve your processor's model ID:

cpuid -1 -l 1 -r | sed -n 's/.*eax=0x\([0-9a-f]*\).*/\U\1/p'

Enable the ucodenix NixOS module and set the model ID in your configuration:

{ inputs, ... }:
{
  imports = [ inputs.ucodenix.nixosModules.default ];

  services.ucodenix = {
    enable = true;
    cpuModelId = "00A20F12"; # Replace with your processor's model ID
  };
}

Setting cpuModelId to "auto" enables automatic detection of the CPU model ID at build time. Note that this makes the build non-reproducible, so specifying cpuModelId manually is recommended.

FAQ

Why would I need this if AMD already provides microcodes for Linux?

AMD only provides microcodes to linux-firmware for certain server-grade CPUs. For consumer CPUs, updates are distributed through BIOS releases by motherboard and laptop manufacturers, which can be inconsistent, delayed, or even discontinued over time. This flake ensures you have the latest microcodes directly on NixOS, without depending on BIOS updates.

Is there any risk in using this flake?

The microcodes are obtained from official sources and are checked for integrity and size. The Linux kernel has built-in safeguards and will only load microcode that is compatible with your CPU, otherwise defaulting to the BIOS-provided version. As a result, using this flake can be considered safe and should carry no significant risks.

Disclaimer

This software is provided "as is" without any guarantees.

License

GPLv3