Silly newbie fails at hardware acceleration(coding/decoding, openGL, vulkan, cuda, etc) in nix

Hi. I’ve been interested in nix for a while. I’m not ready to fully switch to nixOS yet, but I’ve tried to use nix for a while on a few different machines but every single time I ran into hardware acceleration issues and lack of API’s which led to any GUI application to crash. Even with ugly wrappers like nixGL there was no webGL/coding/decoding support in browsers, no nvidia GPU detected in blender and etc. the most I have achieved is support for codecs in the browser using Nix System Graphics with amd IGPU on another machine. Almost any nix tutorial on the internet related to GPU support and hardware acceleration is about nixOS’ configuration, which I lack as I use nix on ubuntu 24.04(with nvidia 570 drivers). Is there anything I can do to properly integrate nix into my environment or am I trying to find a black cat in a black empty room?

The nixGL you mention. Missing hardware acceleration will come down to similar, albeit subtly different things, fixing that would involve a deep read of the nvidia docs as well as your browser and distro’s developer documentation (to the extent that it exists) around this. FWIW, nvidia GPUs don’t support hardware acceleration for media in browsers, at all, there’s only this third party hack which is currently broken, stick to your iGPU.

Graphics/hardware details like this are unfortunately inherently impure, you really need to understand the full stack and how it all fits together - it’s normal to struggle using graphical applications on non-NixOS hosts. Especially for things like blender/browsers I’d recommend sticking to your host distro’s packages; you can still configure them using home-manager.

Thanks for a reply! I honestly wasn’t expecting codecs to work with nvidia, but lack of webGL on amd IGPU is unbearable, honestly. I can see myself using browsers from default package manager, but I really liked nix for its unique features. I guess I’ll have to dig deeper into the rabbit hole to get things working. Which I hope is possible since I saw other people do it, but I don’t know how to do it myself for now. My first guess would be to find non-nixOS configuration.nix or to configure correctly flakes.

home-manager is the closest equivalent. It will not help, because it cannot change OS-level settings. Though you might want to have a look at it anyway, using nix-env isn’t recommended.

You’ll have to read the code of the applications you’re using (or their documentation) and learn how they identify whether a GPU is present. Then check the nix packages to see how they get in the way.

There’s a chance someone else has gone through this rabbit hole, I suppose, share exactly what you’re installing, how, as well as the errors you see.

Flakes are effectively just a style guide for structuring nix projects. They won’t help, and don’t do much for home-manager/NixOS setups.

What about system manager? That’s a system equivalent of home manager, if I recall it correctly that’s what I used for Nix System Graphics resulting in using no wrapper for openGL apps.

That’s the problem for me. I have seen people include various packages and settings in home manager for specific apps to enable hardware acceleration or codecs support(like hardware.vulkan), which I struggle to find documentation anywhere. Renaming those options in newer versions worsens the situation.