When attempting to run anything with graphics that I’ve installed with Nix I get an error. I’m running on a Pop!_OS 20.04 machine ( which is essentially just Ubuntu ).
For example if I run:
nix run nixpkgs.glxinfo -c glxinfo:
name of display: :1
Error: couldn't find RGB GLX visual or fbconfig
Or if I run
nix run nixpkgs.midori -c midori, I am able to get to the window, but it fails when loading a webpage with this error in the logs:
Cannot get default EGL display: EGL_BAD_PARAMETER
Cannot create EGL context: invalid display (last error: EGL_SUCCESS)
Or if I run
nix run nixpkgs.blender -c blender:
/build/blender-2.83.1/intern/ghost/intern/GHOST_WindowX11.cpp:206: X11 glXChooseVisual() failed, verify working openGL system!
initial window could not find the GLX extension
Not sure if this makes any difference, but if I create an Appimage inside of a
nix-shell that uses
webkitgtk ( the same library that
midori uses ), the Appimage has the same problem when run outside of the Nix shell ( which probably just makes sense ).
If you’re not running NixOS, you may want to check out GitHub - guibou/nixGL: A wrapper tool for nix OpenGL application . I haven’t tried it myself (NixOS only). But I’ve heard good things about it.
I tried that, but it got the same error. It seems like the error that nixGL solves for is different than the one that I’m getting, but I could still be doing something wrong.
As your errors are explicitely complaining about screens or X11 not beeing found…
Is your linux perhaps running a Wayland session?
The environment variable
XDG_SESSION_TYPE might tell you.
I am running X11:
$ echo $XDG_SESSION_TYPE
$ echo $XDG_SESSION_DESKTOP
$ echo $XDG_SESSION_CLASS
Ah, I was able to use nixGL to get the apps working. The example run command in the README was for
bash and I use
fish for my shell and had improperly converted the command to the fish equivalent.
But I’ve still got an issue here. I use nix-shell to create a development environment that I can build my Tauri app in. When I build the Tauri app, it creates an AppImage, but that AppImage now requires the
nixGLIntel program just to run.
Is there any way to build this into Nix packages or my Nix shell so that my app will run without the user having to use
nixGLIntel? It feels like there should be a way to have people depend on a
gl nix package that handles this automatically.