General question about Nvidia On-Demand and snaps

I have a laptop with an Nvidia Optimus setup, and I’ve been taking advantage of the latest Kernel’s support for Nvidia On-Demand. With it, I can do on the fly graphics switching, running some apps on my discrete Nvidia GPU, and some apps on my integrated Intel GPU, without restarting my Gnome session or running a separate X server under Bumblebee. It works quite nicely, at the cost of a little bit of battery life, as the discrete GPU is never completely switched off.

In order to run an app on the Nvidia card, I run it with the following wrapper script:



The problem is that those environment variables don’t reliably get passed into an app that’s running as a snap, making it difficult to run snap based games on my Nvidia card.

Is there a “Canonical” way to run snaps using Nvidia On-Demand? Or is this something that would need to be supported on a per snap basis?

Could you elaborate on this, snaps should still see the environment variables that are passed into them, unless the snap is itself re-writing those environment variables.

It’s also possible that the libraries in the snap are too old or missing some additional files to enable this switching?

Thank you for the reply!

I guess I might be making mistaken assumptions about what happens to environment variables in the typical case. I’ve run into this issue w/ the GoG Games snap and the Magic Arena snap. I guess I should head over and read the Wine helper snap and see if it’s smashing env variables. … and also take a look through my kernel log and see if it’s an app armor thing.

1 Like