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:
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME="nvidia" __VK_LAYER_NV_optimus=NVIDIA_only TERM=xterm $@
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?