Is it possible to have all GPU drivers (AMD, Nvidia, Intel) enabled? What should my config look like?

This post is a small spinoff of my previous post (which didn’t really get any responses…): Specialisation: did I do it correctly?

I tend to boot NixOS from an external M.2 NVMe drive, and I’ve booted it from different hardware configs.

Let’s say I’m using different system with different dGPUs and iGPUs, from different brands. Let’s say a mix of Nvidia, AMD, and Intel.

Do I need to use create different “specialisations” that allows certain GPUs to be supported, or is there a way to enable all GPU drivers regardless of the system?

For reference, this is what my specialisation looks like:

Good question! I haven’t seen anyone attempt this before, so good luck. I think under wayland it should work out of the box if you don’t do anything weird. In theory, the GPUs just show up under different /dev paths, and wayland picks whichever your firmware booted with as its rendering card (or whichever GPU was forced, depending on your compisitor’s settings, see this file I wrote).

The other GPUs end up sitting idle, until you do something specific to make wayland decide to render a specific window on a different GPU. I don’t know if any compositors implement features for such functionality; for nvidia specifically you can set these variables for a process to make it be rendered with the nvidia GPU, but I don’t know what the nvidia driver does if you have multiple nvidia GPUs.

I wonder if the drivers are smart enough to detect their GPUs aren’t used for rendering and actually shut them off, but that’s for you to find out.

Under X11, well, gooder luck, X11 was never designed to mix two GPUs (which is why the prime stuff even exists), let alone 3. But I don’t see any good reason to stick to X11 in 2026, any still-incompatible software is living on borrowed time anyway, and there are good replacements for most X11 window managers.


In your specializations, you’re currently doing a lot of “weird” though ;p I don’t know what your hardware or software choices look like (except that your nvidia GPU is supported by the latest driver), so I cannot give any firm recommendations, but for what it’s worth:

  • Under wayland, you should never set hardware.nvidia.prime
    • Yes, this means sync/reverse-sync/offload and whatever are meaningless concepts - these things are X11 configuration, your compositor is responsible for choosing the GPU to render with, and wayland compositors are configured differently - see the file I linked earlier
  • The only purpose of services.xserver.videoDrivers is to indicate which drivers are to be used, which means that adding amdgpu to the boot.initrd.kernelModules manually is silly
    • Adding drivers except nvidia to that list is anyway pointless from my experiments, since the kernel detects the hardware and loads missing drivers - nvidia is only needed because it’s a third-party module and adding it to the list enables the nvidia NixOS module
    • Some NixOS modules will read services.xserver.videoDrivers to figure out which GPU vendor is being used; those modules may need adjustment with your triplicate-GPU setup
  • Given what I know about the nvidia drivers, unless your GPU is ancient (which it doesn’t appear to be given you’re using the latest driver), literally all nvidia configuration you have set should probably be removed, and replaced with:
    {
      hardware.nvidia = {
        open = true;
    
        powerManagement = {
          enable = true; # Not, in fact, experimental anymore, as of this month
          fineGrained = true; # To install udev rules, this is intended to be used
        };
      };
    }
    
    But admittedly I don’t know what hardware you have; telling us this would be helpful, nvidia configuration is full of landmines and there are a lot of people who clearly give advice without ever reading the documentation. And you haven’t read the documentation either, given the combination of settings you’re setting; I’d recommend it given how complex your scenario is.
3 Likes

Thanks for chiming in!

I’m unsure if I have any ancient Nvidia GPUs, but the lowest I can imagine is a GTX 850. My goal is to make my external Nixos drives as compatible as possible, so it allows me to boot on any PC system.

I do enjoy external booting Linux the most; you never know whose computer you’ll be able to borrow and use.

Between AMD and Intel with Nvidia dGPUs, this configurations been working fine, but whether if my configuration is effective or not is a moot discussion. I haven’t done enough “trial and error” or assessment of any logs.

I got the ideas for my nvidia configuration from an unofficial wiki about 2~3 years ago: https://nixos.wiki/wiki/Nvidia ; but seeing how different it is from the official wiki, I’ll consider the configuration you shared.

In that case, you do not want to use the nvidia driver at all. This is the use case nouveau is good for.

Nvidia’s drivers have very varying GPU support, and need careful adjusting to the specific model you use. Nouveau is the in-kernel implementation, which due to significantly less insight into card internals tends to be much less efficient, but will generally work with just about any card you throw at it, assuming it’s not new enough that there is no kernel support yet.

Both the wikis are pretty wrong, though the official one is better. This is true for a lot of the content, but especially the nvidia drivers, because, well, it needs careful handholding for practically every GPU model/software combo and people assume what they cobbled together applies everywhere, without consulting upstream documentation or even reading the nvidia module.

If you don’t want to take my word for it, read the nvidia docs and cross-reference with the NixOS module. Caveat emptor: the NixOS module also does some odd things, unfortunately, understanding it will make you want to rewrite it from scratch.

1 Like

X11 is pretty fine mixing outputs linked to different GPUs by the way; although I still do have

xrandr --setprovideroutputsource 1 0

in my setup, which might even be unnecessary nowadays (at some point ten years ago or whatever it helped with using a display connected to the second GPU, and with the offload it worked perfectly fine)

There is also offloadsink like that, although I am not sure whether it ever works automatically between different-vendor GPUs. DRI_PRIME does work.

Nvidia proprietary drivers force everything to be setup differently, if you want to just boot the same configuration and have the same environment — or if you want any interesting X11 features actually working reliably — yeah, just user Nouveau.

2 Likes