Fortunately you don’t have a choice on that point, NVidia drivers are intrinsically linked to the kernel in use, you can’t replace the userspace without replacing kernel space and so you can’t provide a generic NVidia platform in the same capacity as what happens already for Mesa.
snapd brings in some of the libraries directly from the host. Flatpak tends to ship the userspace in its entirety as a separate SDK. Both have problems relating to updates of the host driver to some degree, as even if Flatpak does actually ship the drivers, it has the same issue of those userspace bits need to be kept in sync with the kernel bits, there’s codepaths dedicated in both platforms just for NVidia and both platforms break from time to time on newer drivers.
With that in mind, no, you can’t bundle the NVidia driver, it won’t work. However, you maybe can bundle NVidia-SMI
(subject to licensing I guess), and rely on this integrating with the host.
Unfortunately, I’m not knowledgable on NVidia and graphics here to say much more on that specifically, but I would advise you try sudo snap install snappy-debug
and then run snappy-debug
in your CLI. In a second CLI/window, open your snap, and check if the debug tool can give you any pointers.
The debug tool works by looking for sandbox errors and trying to provide hints to solve them. Do keep in mind, not every problem needs solving to get a fully functional app, a lot of errors are noise, but hopefully it should give you pointers into which subsystem might be interfering and how to correct that.
And, it might be worth adding extensions: [gnome]
to your app definition, as, whilst this is primarily intended for GUI applications and I’m thinking yours might be a CLI app, it does a lot of GPU magic as you’d expect from GUI apps and works fine for CLI apps too. You’ll have a much more “normal” looking environment in your snap with it than without.
This replaces your snapd-glib
bit in entirety should you choose to use it, and to be honest, I’d highly recommend it even if your app is CLI, because it’s still GPU orientated and the extensions are the intended go to way to set up GPU stuff for most use cases.
Edit:
Regarding classic, you’d likely find it solves your problems instantly. I don’t think it’s impossible that you could get it, but I do also expect that it can possibly be done in strict
confinement too; and we encourage people to pursue that first even when it’s difficult because the technical quality is often better, you’ll be asked to justify that strict
can’t do it, which, we can prove if it can or can’t by pushing a bit further.