Updating to mesa 25.0.2

So, unstable has somewhat recently shaken up how mesa is used in NixOS. Before these changes, it was technically unsafe to mix channels, because packages would be linked to the version of libgbm provided by the mesa in nixpkgs, and the drivers provided by the host system would require the libgbm from the host’s version of mesa. It was often the case that this would work out, but it certainly wasn’t guaranteed.

The recent change is that the libgbm linked to by applications now is only a stub that dynamically links in the libgbm from the host system, which is much the same as how drivers are linked at runtime. But this is a hard break in compatibility; packages built with nixos-unstable right now will not find the host’s libgbm if the host is running 24.11. The incompatibility goes the other way too: packages built with nixos-24.11 will be linked at build time to the libgbm in 24.11, which drivers from nixos-unstable won’t be compatible with.

The good news is that going forward, compatibility will be increased. Packages built with revisions of nixpkgs that have the recent changes will work on any host system built with a revision of nixpkgs that has those changes, even if those two versions of nixpkgs have different mesa versions.

With this improvement, it is now safe with nixos-unstable to set hardware.graphics.package and hardware.graphics.package32 to change the system’s drivers to a different build of mesa. But as I said, this only applies to systems running nixos-unstable right now. Once 25.05 is released, it will be possible to run stable 25.05 and set the system’s drivers to the mesa from unstable.

5 Likes