From 6a6c2d0a1be83680d512959d01e6938fb53d289c Mon Sep 17 00:00:00 2001 From: David Gheghea <71325082+DavidutzDev@users.noreply.github.com> Date: Sun, 18 Oct 2026 15:47:45 +0200 Subject: [PATCH] fix(nix): let EGL find NixOS GPU drivers in the FHS environment NixOS keeps the GPU driver's EGL vendor files and external-platform files under /run/opengl-driver, which glvnd and NVIDIA's driver inside the FHS environment do not search. glvnd then only knows Mesa, and NVIDIA cannot open X11 displays because its X11 support is the egl-x11 external platform. The client fell back to Mesa's software rasterizer: garbled text in the client and no way to present the game's NVIDIA Vulkan frames. When /run/opengl-driver provides them, prepend those directories to __EGL_VENDOR_LIBRARY_DIRS and __EGL_EXTERNAL_PLATFORM_CONFIG_DIRS, keeping the FHS paths and any caller-provided value after them. Co-Authored-By: Claude Opus 5.5 --- flake.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/flake.nix b/flake.nix index 54f5ec8..cb1b11f 100644 --- a/flake.nix +++ b/flake.nix @@ -160,6 +160,18 @@ export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/pkgconfig:/usr/lib64/pkgconfig:/usr/share/pkgconfig:''${PKG_CONFIG_PATH:-}" export CMAKE_PREFIX_PATH="/usr/local:/usr:/usr/lib/cmake/llvm:''${CMAKE_PREFIX_PATH:-}" unset NIX_LDFLAGS NIX_CFLAGS_COMPILE NIX_HARDENING_ENABLE CPATH LIBRARY_PATH + # NixOS keeps the GPU driver's EGL vendor and external-platform files under + # /run/opengl-driver, which glvnd and NVIDIA's driver in this FHS environment + # do not search. Without them glvnd only finds Mesa, and NVIDIA cannot open + # X11 displays (its X11 support is the egl-x11 external platform): the + # client renders with Mesa's software rasterizer, which garbles text and + # cannot present the game's NVIDIA Vulkan frames. FHS paths stay as fallback. + if [ -d /run/opengl-driver/share/glvnd/egl_vendor.d ]; then + export __EGL_VENDOR_LIBRARY_DIRS="/run/opengl-driver/share/glvnd/egl_vendor.d:/etc/glvnd/egl_vendor.d:/usr/share/glvnd/egl_vendor.d''${__EGL_VENDOR_LIBRARY_DIRS:+:$__EGL_VENDOR_LIBRARY_DIRS}" + fi + if [ -d /run/opengl-driver/share/egl/egl_external_platform.d ]; then + export __EGL_EXTERNAL_PLATFORM_CONFIG_DIRS="/run/opengl-driver/share/egl/egl_external_platform.d:/etc/egl/egl_external_platform.d:/usr/share/egl/egl_external_platform.d''${__EGL_EXTERNAL_PLATFORM_CONFIG_DIRS:+:$__EGL_EXTERNAL_PLATFORM_CONFIG_DIRS}" + fi ''; runScript = pkgs.writeShellScript "darling-lol-run" ''