Adding mesa from nixpkgs-unstable to a stable flake config

Hello, a little over a month ago, I purchased an RX 9070XT which has been great, however, it requires at least Mesa 25.0, and nixpkgs-24.11 is still on 24.2.8

Up until now, I’ve just been setting my whole system to follow nixpkgs-unstable, however, this introduced a litany of bugs mainly to do with my wayland compositors being completely inoperable, and the X version of KDE Plasma being the glitchiest I’ve ever seen it.

Ultimately, I really don’t need my whole system to follow the unstable branch, only this specific component.

To that end, I’ve been trying to get an overlay in my system flake working, but it feels like no matter what I try, I never get it to build. I’ve tried doing resulted in meson build errors.

Currently, this is what I’ve got in my flake:

"marc-desktop" = nixpkgs.lib.nixosSystem {
        system = "x86_64-linux";
        modules = [ 
          ./system/desktop.nix 
          hyprland.nixosModules.default

          # Unstable mesa for RX 9070XT
          {
            nixpkgs.overlays = [
              (final: prev: {
                mesa = (import nixpkgs-unstable {
                  system = final.system;
                  config.allowUnfree = true;
                }).mesa;
              })
            ];
          }
        ];
      };

This fails to build due to a meson build error ending with include/meson.build:9:10: ERROR: Dependency "dri" not found, tried pkgconfig

In case it’s relevant, here’s the full nix flake which should hopefully include all the necessary context. Be warned, my grasp on the Nix language is tentative at best, and this thing is probably full of bad ideas.

flake.nix
{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
    nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
    nixpkgs-master.url = "github:NixOS/nixpkgs/master";

    chaotic.url = "github:chaotic-cx/nyx/nyxpkgs-unstable";

    home-manager.url = "github:nix-community/home-manager/release-24.11";
    home-manager.inputs.nixpkgs.follows = "nixpkgs-unstable";
    hyprland.url = "github:hyprwm/Hyprland";
  };
  outputs = { self, nixpkgs, nixpkgs-unstable, nixpkgs-master, chaotic, home-manager, hyprland }: {
    defaultPackage = home-manager.defaultPackage;
    homeConfigurations = {
      marc = home-manager.lib.homeManagerConfiguration {
        pkgs = import nixpkgs {
          system = "x86_64-linux";
          config.allowUnfree = true;
          # required by logseq and obsidian
          config.permittedInsecurePackages = [
            "electron-25.9.0"
            "electron-27.3.11"
          ];
        };
        extraSpecialArgs = { 
          pkgs-unstable = import nixpkgs {
            system = "x86_64-linux";
            config.allowUnfree = true;
          };
        };
        modules = [ ./home.nix ];
      };
    };
    nixosConfigurations = {
      "marc-laptop" = nixpkgs.lib.nixosSystem {
        system = "x86_64-linux";
	      modules = [ ./system/laptop.nix ];
      };
      "marc-desktop" = nixpkgs.lib.nixosSystem {
        system = "x86_64-linux";
        modules = [ 
          ./system/desktop.nix 
          hyprland.nixosModules.default

          # Unstable mesa for RX 9070XT
          {
            nixpkgs.overlays = [
              (final: prev: {
                mesa = (import nixpkgs-unstable {
                  system = final.system;
                  config.allowUnfree = true;
                }).mesa;
              })
            ];
          }
        ];
      };
    };
  };
}

See here:

TL;DR: Unstable and 24.11 just don’t mix when it comes to graphics, but 25.05 onward should have that problem pretty much solved.

You have the additional complexity that you’re trying to change mesa in an overlay. This is adding extra problems because changing mesa results in a mass rebuild in nixos 24.11 (which will no longer be the case in 25.05, though there will be better ways to change the drivers than an overlay). Given the change in packaging since mesa 24.3 and the change in linkage, you’re just not going to reasonably be able to get a 24.11 system to build with an overlay changing mesa to the build from unstable.

My advice is to stick with unstable until 25.05 releases. The good news is that then you can probably stick with 25.05 and still get driver updates from unstable.

1 Like

It’s also worth noting that you’ll get all of those issues whenever 25.05 hits anyway (the 5th month isn’t very far away). It’s definitely worth sticking to a stable branch for other reasons, once you’re no longer depending on things only available on unstable, but you’ll probably hit these particular issues eventually and need to figure out what causes them.

The release notes may help figure that out, to be fair.

Well, that’s annoying.

At the moment I just have two builds I switch between at boot, one fully stable one, and one fully unstable one. The unstable one is littered with glitchy behavior, and is kinda painful to use. Really my biggest issue is that I can’t get hyprland to work properly on unstable. Tried debugging it for hours before deciding it was a lost cause.

But yeah, it’d have been nice to update the singular component I’m missing, but I guess I’ve got another monthish to wait and hope that 25.05 works flawlessly.

I’ll just have to live with Vulkan apps having a 50/50 chance of completely bringing the system down when they try to access the GPU on my stable build.

To be fair, hyprland is known to be extremely unreliable, especially with regards to graphics drivers. It is, by far, the most common DE I see people having graphics issues with. I’m not personally familiar with its code, but I know people who say it’s horrendous, so I’m guessing it just doesn’t use graphics drivers correctly.

2 Likes