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.
- Fetches AMD microcode binaries from a repository aggregating updates from official sources.
- Processes the microcode binaries to generate a container compatible with the Linux kernel.
- Integrates the generated microcode seamlessly into the NixOS configuration.
- Supports automatic processing or custom selection based on your CPU model.
Add the flake as an input:
inputs.ucodenix.url = "github:e-tho/ucodenix";
Enable the ucodenix
NixOS module:
{ inputs, ... }:
{
imports = [ inputs.ucodenix.nixosModules.default ];
services.ucodenix.enable = true;
}
By default, ucodenix
processes all available microcode binaries, each intended for a specific CPUID identifying a family of CPUs. This behavior is controlled by setting cpuModelId
to "auto"
. The Linux kernel automatically detects and loads the appropriate microcode at boot time.
If you prefer, you can manually specify your processor's model ID to process only the binary needed for your CPU. This reduces the output size and simplifies the build artifacts, making them more focused for targeted deployments.
There are two ways to specify your processor's model ID:
- Directly Provide the Model ID
You can retrieve the model ID using the cpuid
tool. Install it and run the following command:
cpuid -1 -l 1 -r | sed -n 's/.*eax=0x\([0-9a-f]*\).*/\U\1/p'
Update your configuration with the retrieved model ID:
services.ucodenix = {
enable = true;
cpuModelId = "00A20F12"; # Replace with your processor's model ID
};
- Use a NixOS Facter Report File
If you use NixOS Facter, you can specify the path to its generated facter.json
report file for ucodenix
to compute the model ID. Run the following command to generate your report file:
sudo nix run nixpkgs#nixos-facter -- -o facter.json
Update your configuration with the file path:
services.ucodenix = {
enable = true;
cpuModelId = ./path/to/facter.json; # Or config.facter.reportPath if specified
};
Rebuild your configuration and reboot to apply the microcode update.
sudo nixos-rebuild switch --flake path/to/flake/directory
Tip
To confirm that the microcode has been updated, run:
sudo dmesg | grep microcode
If the update was successful, you should see output like this:
# For kernel versions >= v6.6:
[ 0.509186] microcode: Current revision: 0x0a201210
[ 0.509188] microcode: Updated early from: 0x0a201205
# For kernel versions < v6.6:
[ 0.509188] microcode: microcode updated early to new patch_level=0x0a201210
Keep in mind that the provided microcode might not be newer than the one from your BIOS.
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.
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.
This software is provided "as is" without any guarantees.
GPLv3