mangohud: suport nvidia cards when directly using vulkan layer

Before this change, NVIDIA GPUs were only supported when using the
mangohud & mangoapp binaries.

This extends support to direct use of the Vulkan layer
(enabled through `MANGOHUD=1`).

+10 -10
+10 -10
pkgs/tools/graphics/mangohud/default.nix
··· 12 12 , dbus 13 13 , hwdata 14 14 , mangohud32 15 + , addOpenGLRunpath 15 16 , appstream 16 17 , glslang 17 18 , makeWrapper ··· 28 29 , glfw 29 30 , nlohmann_json 30 31 , xorg 31 - , addOpenGLRunpath 32 32 , gamescopeSupport ? true # build mangoapp and mangohudctl 33 33 }: 34 34 ··· 134 134 ]; 135 135 136 136 nativeBuildInputs = [ 137 + addOpenGLRunpath 137 138 appstream 138 139 glslang 139 140 makeWrapper ··· 167 168 "$out/share/vulkan/implicit_layer.d/MangoHud.x86.json" 168 169 ''; 169 170 170 - # Support Nvidia cards by adding OpenGL path and support overlaying 171 - # Vulkan applications without requiring MangoHud to be installed 172 171 postFixup = '' 172 + # Add OpenGL driver path to RUNPATH to support NVIDIA cards 173 + addOpenGLRunpath "$out/lib/mangohud/libMangoHud.so" 174 + ${lib.optionalString gamescopeSupport '' 175 + addOpenGLRunpath "$out/bin/mangoapp" 176 + ''} 177 + 178 + # Prefix XDG_DATA_DIRS to support overlaying Vulkan apps without 179 + # requiring MangoHud to be installed 173 180 wrapProgram "$out/bin/mangohud" \ 174 - --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ addOpenGLRunpath.driverLink ]} \ 175 181 --prefix XDG_DATA_DIRS : "$out/share" 176 - '' + lib.optionalString (gamescopeSupport) '' 177 - if [[ -e "$out/bin/mangoapp" ]]; then 178 - wrapProgram "$out/bin/mangoapp" \ 179 - --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ addOpenGLRunpath.driverLink ]} \ 180 - --prefix XDG_DATA_DIRS : "$out/share" 181 - fi 182 182 ''; 183 183 184 184 meta = with lib; {