How to solve Could not initialize GLX
and similar errors?
export QT_XCB_GL_INTEGRATION=none
-- NixOS/nixpkgs#82959 (comment)
This a workaround that works most of the times, but what about a proper solution?
nix-channel --add https://github.com/nix-community/nixGL/archive/main.tar.gz nixgl && nix-channel --update
nix-env -iA nixgl.auto.nixGLDefault
-- https://github.com/nix-community/nixGL?tab=readme-ov-file#nix-channel-recommended
On some NVIDIA systems, it is necessary to force the loading of NVIDIA libraries by adding this line to .bashrc
or similar:
export __GLX_VENDOR_LIBRARY_NAME=nvidia
-- nix-community/nixGL#177 (comment)
Run you apps as usual:
nixGL nix-shell -p rstudio -p R --run rstudio
To avoid running each command using the nixGL
wrapper, it is possible to set some environmental variables which will do the same (you might put them in your shellHook
):
library_path="$LD_LIBRARY_PATH"
export $(env -i $(which nixGL) $(which printenv))
export LD_LIBRARY_PATH="$library_path:$LD_LIBRARY_PATH"
Thanks, this let me run
anki-bin
(whereexport QT_XCB_GL_INTEGRATION=none
did not help), but installing nixGL took like half a gig :-/