mangohud: 0.6.8 -> 0.6.9

+65 -58
+34 -41
pkgs/tools/graphics/mangohud/default.nix
··· 13 13 , hwdata 14 14 , mangohud32 15 15 , addOpenGLRunpath 16 - , appstream 17 16 , glslang 18 - , makeWrapper 19 17 , mako 20 18 , meson 21 19 , ninja ··· 24 22 , libXNVCtrl 25 23 , wayland 26 24 , libX11 25 + , nlohmann_json 27 26 , spdlog 28 27 , glew 29 28 , glfw 30 - , nlohmann_json 31 29 , xorg 32 30 , gamescopeSupport ? true # build mangoapp and mangohudctl 33 31 , nix-update-script ··· 41 39 owner = "ocornut"; 42 40 repo = "imgui"; 43 41 rev = "refs/tags/v${version}"; 44 - sha256 = "sha256-rRkayXk3xz758v6vlMSaUu5fui6NR8Md3njhDB0gJ18="; 42 + hash = "sha256-rRkayXk3xz758v6vlMSaUu5fui6NR8Md3njhDB0gJ18="; 45 43 }; 46 44 patch = fetchurl { 47 45 url = "https://wrapdb.mesonbuild.com/v2/imgui_${version}-1/get_patch"; 48 - sha256 = "sha256-bQC0QmkLalxdj4mDEdqvvOFtNwz2T1MpTDuMXGYeQ18="; 46 + hash = "sha256-bQC0QmkLalxdj4mDEdqvvOFtNwz2T1MpTDuMXGYeQ18="; 49 47 }; 50 48 }; 51 49 ··· 66 64 in 67 65 stdenv.mkDerivation (finalAttrs: { 68 66 pname = "mangohud"; 69 - version = "0.6.8"; 67 + version = "0.6.9"; 70 68 71 69 src = fetchFromGitHub { 72 70 owner = "flightlessmango"; 73 71 repo = "MangoHud"; 74 72 rev = "refs/tags/v${finalAttrs.version}"; 75 73 fetchSubmodules = true; 76 - sha256 = "sha256-jfmgN90kViHa7vMOjo2x4bNY2QbLk93uYEvaA4DxYvg="; 74 + hash = "sha256-wvidO9LAZwVUZhYYWnelSiP0Q1WTPoCg6pMXsoJBPPg="; 77 75 }; 78 76 79 77 outputs = [ "out" "doc" "man" ]; ··· 85 83 cp -R --no-preserve=mode,ownership ${vulkan-headers.src} Vulkan-Headers-${vulkan-headers.version} 86 84 )''; 87 85 88 - env.NIX_CFLAGS_COMPILE = "-I${vulkan-headers.src}/include"; 86 + patches = [ 87 + # Add @libraryPath@ template variable to fix loading the preload 88 + # library and @dataPath@ to support overlaying Vulkan apps without 89 + # requiring MangoHud to be installed 90 + ./preload-nix-workaround.patch 89 91 90 - patches = [ 91 92 # Hard code dependencies. Can't use makeWrapper since the Vulkan 92 93 # layer can be used without the mangohud executable by setting MANGOHUD=1. 93 94 (substituteAll { ··· 105 106 libdbus = dbus.lib; 106 107 inherit hwdata; 107 108 }) 108 - ] ++ lib.optionals (stdenv.hostPlatform.system == "x86_64-linux") [ 109 - # Support 32bit OpenGL applications by appending the mangohud32 110 - # lib path to LD_LIBRARY_PATH. 111 - # 112 - # This workaround is necessary since on Nix's build of ld.so, $LIB 113 - # always expands to lib even when running an 32bit application. 114 - # 115 - # See https://github.com/NixOS/nixpkgs/issues/101597. 116 - (substituteAll { 117 - src = ./opengl32-nix-workaround.patch; 118 - inherit mangohud32; 119 - }) 120 109 ]; 121 110 122 - postPatch = ''( 123 - cd subprojects 124 - unzip ${imgui.patch} 125 - unzip ${vulkan-headers.patch} 126 - )''; 111 + postPatch = '' 112 + substituteInPlace bin/mangohud.in \ 113 + --subst-var-by libraryPath ${lib.makeSearchPath "lib/mangohud" ([ 114 + (placeholder "out") 115 + ] ++ lib.optionals (stdenv.hostPlatform.system == "x86_64-linux") [ 116 + mangohud32 117 + ])} \ 118 + --subst-var-by dataDir ${placeholder "out"}/share 119 + 120 + ( 121 + cd subprojects 122 + unzip ${imgui.patch} 123 + unzip ${vulkan-headers.patch} 124 + ) 125 + ''; 127 126 128 127 mesonFlags = [ 129 128 "-Dwith_wayland=enabled" 130 129 "-Duse_system_spdlog=enabled" 130 + "-Dtests=disabled" # Tests require AMD GPU 131 131 ] ++ lib.optionals gamescopeSupport [ 132 + "-Dmangoapp=true" 132 133 "-Dmangoapp_layer=true" 133 - "-Dmangoapp=true" 134 134 "-Dmangohudctl=true" 135 135 ]; 136 136 137 137 nativeBuildInputs = [ 138 138 addOpenGLRunpath 139 - appstream 140 139 glslang 141 - makeWrapper 142 140 mako 143 141 meson 144 142 ninja ··· 154 152 155 153 buildInputs = [ 156 154 dbus 155 + nlohmann_json 157 156 spdlog 158 157 ] ++ lib.optionals gamescopeSupport [ 159 158 glew 160 159 glfw 161 - nlohmann_json 162 160 xorg.libXrandr 163 161 ]; 164 162 165 163 # Support 32bit Vulkan applications by linking in 32bit Vulkan layers 166 - # This is needed for the same reason the 32bit OpenGL workaround is needed. 164 + # This is needed for the same reason the 32bit preload workaround is needed. 167 165 postInstall = lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") '' 168 - ln -s ${mangohud32}/share/vulkan/implicit_layer.d/MangoHud.json \ 169 - "$out/share/vulkan/implicit_layer.d/MangoHud.x86.json" 166 + ln -s ${mangohud32}/share/vulkan/implicit_layer.d/MangoHud.x86.json \ 167 + "$out/share/vulkan/implicit_layer.d" 170 168 171 169 ${lib.optionalString gamescopeSupport '' 172 - ln -s ${mangohud32}/share/vulkan/implicit_layer.d/libMangoApp.json \ 173 - "$out/share/vulkan/implicit_layer.d/libMangoApp.x86.json" 170 + ln -s ${mangohud32}/share/vulkan/implicit_layer.d/libMangoApp.x86.json \ 171 + "$out/share/vulkan/implicit_layer.d" 174 172 ''} 175 173 ''; 176 174 175 + # Add OpenGL driver path to RUNPATH to support NVIDIA cards 177 176 postFixup = '' 178 - # Add OpenGL driver path to RUNPATH to support NVIDIA cards 179 177 addOpenGLRunpath "$out/lib/mangohud/libMangoHud.so" 180 178 ${lib.optionalString gamescopeSupport '' 181 179 addOpenGLRunpath "$out/bin/mangoapp" 182 180 ''} 183 - 184 - # Prefix XDG_DATA_DIRS to support overlaying Vulkan apps without 185 - # requiring MangoHud to be installed 186 - wrapProgram "$out/bin/mangohud" \ 187 - --prefix XDG_DATA_DIRS : "$out/share" 188 181 ''; 189 182 190 183 passthru.updateScript = nix-update-script { };
+5 -5
pkgs/tools/graphics/mangohud/hardcode-dependencies.patch
··· 1 1 diff --git a/src/dbus.cpp b/src/dbus.cpp 2 - index 3b3cccb..1405725 100644 2 + index 7379af1..4eef3fe 100644 3 3 --- a/src/dbus.cpp 4 4 +++ b/src/dbus.cpp 5 5 @@ -152,7 +152,7 @@ bool dbus_manager::get_media_player_metadata(metadata& meta, std::string name) { ··· 12 12 return false; 13 13 } 14 14 diff --git a/src/logging.cpp b/src/logging.cpp 15 - index 1668226..f0c8df5 100644 15 + index 046c847..42782be 100644 16 16 --- a/src/logging.cpp 17 17 +++ b/src/logging.cpp 18 - @@ -24,7 +24,11 @@ string exec(string command) { 18 + @@ -26,7 +26,11 @@ string exec(string command) { 19 19 #endif 20 20 std::array<char, 128> buffer; 21 21 std::string result; ··· 28 28 return "popen failed!"; 29 29 } 30 30 diff --git a/src/pci_ids.cpp b/src/pci_ids.cpp 31 - index feec222..6baa707 100644 31 + index 002a843..5a6262b 100644 32 32 --- a/src/pci_ids.cpp 33 33 +++ b/src/pci_ids.cpp 34 - @@ -24,11 +24,9 @@ std::istream& get_uncommented_line(std::istream& is, std::string &line) 34 + @@ -24,11 +24,9 @@ static std::istream& get_uncommented_line(std::istream& is, std::string &line) 35 35 void parse_pciids() 36 36 { 37 37 std::ifstream file;
-12
pkgs/tools/graphics/mangohud/opengl32-nix-workaround.patch
··· 1 - diff --git a/bin/mangohud.in b/bin/mangohud.in 2 - index e13da99..086443c 100755 3 - --- a/bin/mangohud.in 4 - +++ b/bin/mangohud.in 5 - @@ -23,6 +23,6 @@ fi 6 - # figure out whether the 32 or 64 bit version should be used, and will search 7 - # for it in the correct directory 8 - LD_PRELOAD="${LD_PRELOAD}${LD_PRELOAD:+:}${MANGOHUD_LIB_NAME}" 9 - -LD_LIBRARY_PATH="${LD_LIBRARY_PATH}${LD_LIBRARY_PATH:+:}@ld_libdir_mangohud@" 10 - +LD_LIBRARY_PATH="${LD_LIBRARY_PATH}${LD_LIBRARY_PATH:+:}@ld_libdir_mangohud@:@mangohud32@/lib/mangohud" 11 - 12 - exec env MANGOHUD=1 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" LD_PRELOAD="${LD_PRELOAD}" "$@"
+26
pkgs/tools/graphics/mangohud/preload-nix-workaround.patch
··· 1 + diff --git a/bin/mangohud.in b/bin/mangohud.in 2 + index f975224..24936eb 100755 3 + --- a/bin/mangohud.in 4 + +++ b/bin/mangohud.in 5 + @@ -8,16 +8,18 @@ if [ "$#" -eq 0 ]; then 6 + exit 1 7 + fi 8 + 9 + -MANGOHUD_LIB_NAME="@ld_libdir_mangohud@libMangoHud.so" 10 + +MANGOHUD_LIB_NAME="libMangoHud.so" 11 + 12 + if [ "$1" = "--dlsym" ]; then 13 + MANGOHUD_DLSYM=1 14 + - MANGOHUD_LIB_NAME="@ld_libdir_mangohud@libMangoHud_dlsym.so:${MANGOHUD_LIB_NAME}" 15 + + MANGOHUD_LIB_NAME="libMangoHud_dlsym.so:${MANGOHUD_LIB_NAME}" 16 + shift 17 + fi 18 + 19 + # Preload using the plain filenames of the libs, the dynamic linker will 20 + # figure out whether the 32 or 64 bit version should be used 21 + LD_PRELOAD="${LD_PRELOAD:+$LD_PRELOAD:}${MANGOHUD_LIB_NAME}" 22 + +LD_LIBRARY_PATH="@libraryPath@${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" 23 + +XDG_DATA_DIRS="@dataDir@${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" 24 + 25 + -exec env MANGOHUD=1 LD_PRELOAD="${LD_PRELOAD}" "$@" 26 + +exec env MANGOHUD=1 LD_PRELOAD="${LD_PRELOAD}" LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" XDG_DATA_DIRS="${XDG_DATA_DIRS}" "$@"