Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

mangohud: 0.7.2 -> 0.8.0

https://github.com/flightlessmango/MangoHud/releases/tag/v0.8.0

+33 -72
+23 -54
pkgs/tools/graphics/mangohud/default.nix
··· 1 1 { 2 2 lib, 3 3 stdenv, 4 - fetchFromGitLab, 5 4 fetchFromGitHub, 6 5 fetchurl, 7 6 replaceVars, ··· 15 14 mangohud32, 16 15 addDriverRunpath, 17 16 appstream, 18 - git, 19 17 glslang, 20 18 mako, 21 - mesa-demos, 22 19 meson, 23 20 ninja, 24 21 pkg-config, 25 22 unzip, 23 + libX11, 26 24 libXNVCtrl, 27 25 wayland, 28 - libX11, 29 26 nlohmann_json, 30 27 spdlog, 31 28 glew, ··· 38 35 }: 39 36 40 37 let 41 - # Derived from subprojects/cmocka.wrap 42 - cmocka = { 43 - src = fetchFromGitLab { 44 - owner = "cmocka"; 45 - repo = "cmocka"; 46 - rev = "59dc0013f9f29fcf212fe4911c78e734263ce24c"; 47 - hash = "sha256-IbAZOC0Q60PrKlKVWsgg/PFDV0PLb/yy+Iz/4Iziny0="; 38 + # Derived from subprojects/imgui.wrap 39 + imgui = rec { 40 + version = "1.89.9"; 41 + src = fetchFromGitHub { 42 + owner = "ocornut"; 43 + repo = "imgui"; 44 + tag = "v${version}"; 45 + hash = "sha256-0k9jKrJUrG9piHNFQaBBY3zgNIKM23ZA879NY+MNYTU="; 46 + }; 47 + patch = fetchurl { 48 + url = "https://wrapdb.mesonbuild.com/v2/imgui_${version}-1/get_patch"; 49 + hash = "sha256-myEpDFl9dr+NTus/n/oCSxHZ6mxh6R1kjMyQtChD1YQ="; 48 50 }; 49 51 }; 50 52 ··· 54 56 src = fetchFromGitHub { 55 57 owner = "epezent"; 56 58 repo = "implot"; 57 - rev = "refs/tags/v${version}"; 59 + tag = "v${version}"; 58 60 hash = "sha256-/wkVsgz3wiUVZBCgRl2iDD6GWb+AoHN+u0aeqHHgem0="; 59 61 }; 60 62 patch = fetchurl { ··· 63 65 }; 64 66 }; 65 67 66 - # Derived from subprojects/imgui.wrap 67 - imgui = rec { 68 - version = "1.89.9"; 69 - src = fetchFromGitHub { 70 - owner = "ocornut"; 71 - repo = "imgui"; 72 - rev = "refs/tags/v${version}"; 73 - hash = "sha256-0k9jKrJUrG9piHNFQaBBY3zgNIKM23ZA879NY+MNYTU="; 74 - }; 75 - patch = fetchurl { 76 - url = "https://wrapdb.mesonbuild.com/v2/imgui_${version}-1/get_patch"; 77 - hash = "sha256-myEpDFl9dr+NTus/n/oCSxHZ6mxh6R1kjMyQtChD1YQ="; 78 - }; 79 - }; 80 - 81 68 # Derived from subprojects/vulkan-headers.wrap 82 69 vulkan-headers = rec { 83 70 version = "1.2.158"; 84 71 src = fetchFromGitHub { 85 72 owner = "KhronosGroup"; 86 73 repo = "Vulkan-Headers"; 87 - rev = "refs/tags/v${version}"; 74 + tag = "v${version}"; 88 75 hash = "sha256-5uyk2nMwV1MjXoa3hK/WUeGLwpINJJEvY16kc5DEaks="; 89 76 }; 90 77 patch = fetchurl { ··· 95 82 in 96 83 stdenv.mkDerivation (finalAttrs: { 97 84 pname = "mangohud"; 98 - version = "0.7.2"; 85 + version = "0.8.0"; 99 86 100 87 src = fetchFromGitHub { 101 88 owner = "flightlessmango"; 102 89 repo = "MangoHud"; 103 - rev = "refs/tags/v${finalAttrs.version}"; 90 + tag = "v${finalAttrs.version}"; 104 91 fetchSubmodules = true; 105 - hash = "sha256-cj/F/DWUDm2AHTJvHgkKa+KdIrfxPWLzI570Dp4VFhs="; 92 + hash = "sha256-yITiu+2l7PItAmL+6gX9p5Tvf/P8ovttGIo6kJAOqxs="; 106 93 }; 107 94 108 95 outputs = [ ··· 115 102 postUnpack = '' 116 103 ( 117 104 cd "$sourceRoot/subprojects" 118 - ${lib.optionalString finalAttrs.finalPackage.doCheck '' 119 - cp -R --no-preserve=mode,ownership ${cmocka.src} cmocka 120 - ''} 105 + cp -R --no-preserve=mode,ownership ${imgui.src} imgui-${imgui.version} 121 106 cp -R --no-preserve=mode,ownership ${implot.src} implot-${implot.version} 122 - cp -R --no-preserve=mode,ownership ${imgui.src} imgui-${imgui.version} 123 107 cp -R --no-preserve=mode,ownership ${vulkan-headers.src} Vulkan-Headers-${vulkan-headers.version} 124 108 ) 125 109 ''; ··· 133 117 # Hard code dependencies. Can't use makeWrapper since the Vulkan 134 118 # layer can be used without the mangohud executable by setting MANGOHUD=1. 135 119 (replaceVars ./hardcode-dependencies.patch { 136 - 137 120 path = lib.makeBinPath [ 138 121 coreutils 139 122 curl 140 123 gnugrep 141 124 gnused 142 - mesa-demos 143 125 xdg-utils 144 126 ]; 145 127 ··· 155 137 [ 156 138 (placeholder "out") 157 139 ] 158 - ++ lib.optionals lowerBitnessSupport [ 159 - mangohud32 160 - ] 140 + ++ lib.optional lowerBitnessSupport mangohud32 161 141 ) 162 142 } \ 163 143 --subst-var-by version "${finalAttrs.version}" \ ··· 165 145 166 146 ( 167 147 cd subprojects 148 + unzip ${imgui.patch} 168 149 unzip ${implot.patch} 169 - unzip ${imgui.patch} 170 150 unzip ${vulkan-headers.patch} 171 151 ) 172 152 ''; ··· 175 155 [ 176 156 "-Dwith_wayland=enabled" 177 157 "-Duse_system_spdlog=enabled" 178 - "-Dtests=${if finalAttrs.finalPackage.doCheck then "enabled" else "disabled"}" 158 + "-Dtests=disabled" # amdgpu test segfaults in nix sandbox 179 159 ] 180 160 ++ lib.optionals gamescopeSupport [ 181 161 "-Dmangoapp=true" 182 - "-Dmangoapp_layer=true" 183 162 "-Dmangohudctl=true" 184 163 ]; 185 164 186 165 nativeBuildInputs = [ 187 166 addDriverRunpath 188 - git 189 167 glslang 190 168 mako 191 169 meson ··· 195 173 196 174 # Only the headers are used from these packages 197 175 # The corresponding libraries are loaded at runtime from the app's runpath 176 + libX11 198 177 libXNVCtrl 199 178 wayland 200 - libX11 201 179 ]; 202 180 203 181 buildInputs = ··· 224 202 postInstall = lib.optionalString lowerBitnessSupport '' 225 203 ln -s ${mangohud32}/share/vulkan/implicit_layer.d/MangoHud.x86.json \ 226 204 "$out/share/vulkan/implicit_layer.d" 227 - 228 - ${lib.optionalString gamescopeSupport '' 229 - ln -s ${mangohud32}/share/vulkan/implicit_layer.d/libMangoApp.x86.json \ 230 - "$out/share/vulkan/implicit_layer.d" 231 - ''} 232 205 ''; 233 206 234 207 postFixup = ··· 253 226 '' 254 227 + lib.optionalString gamescopeSupport '' 255 228 addDriverRunpath "$out/bin/mangoapp" 256 - '' 257 - + lib.optionalString finalAttrs.finalPackage.doCheck '' 258 - # libcmocka.so is only used for tests 259 - rm "$out/lib/libcmocka.so" 260 229 ''; 261 230 262 231 passthru.updateScript = nix-update-script { };
+2 -2
pkgs/tools/graphics/mangohud/hardcode-dependencies.patch
··· 12 12 return false; 13 13 } 14 14 diff --git a/src/logging.cpp b/src/logging.cpp 15 - index 7d4cb98..256128c 100644 15 + index ca986d4..c4d99ea 100644 16 16 --- a/src/logging.cpp 17 17 +++ b/src/logging.cpp 18 - @@ -27,8 +27,12 @@ string exec(string command) { 18 + @@ -28,8 +28,12 @@ string exec(string command) { 19 19 #endif 20 20 std::array<char, 128> buffer; 21 21 std::string result;
+8 -16
pkgs/tools/graphics/mangohud/preload-nix-workaround.patch
··· 1 1 diff --git a/bin/mangohud.in b/bin/mangohud.in 2 - index 53c72ef..18240ea 100755 2 + index 4cffeed..c19b635 100755 3 3 --- a/bin/mangohud.in 4 4 +++ b/bin/mangohud.in 5 - @@ -13,13 +13,15 @@ fi 5 + @@ -13,7 +13,9 @@ fi 6 6 DISABLE_LD_PRELOAD="cs2.sh 7 - some_other_exe" 7 + " 8 8 9 - -MANGOHUD_LIB_NAME="@ld_libdir_mangohud@libMangoHud_opengl.so" 9 + -MANGOHUD_LIB_NAME="@ld_libdir_mangohud@libMangoHud_shim.so" 10 10 +LD_LIBRARY_PATH="@libraryPath@${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" 11 11 +XDG_DATA_DIRS="@dataDir@${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}" 12 - +MANGOHUD_LIB_NAME="libMangoHud_opengl.so" 13 - 14 - if [ "$1" = "--dlsym" ]; then 15 - - MANGOHUD_LIB_NAME="@ld_libdir_mangohud@libMangoHud_dlsym.so:${MANGOHUD_LIB_NAME}" 16 - + MANGOHUD_LIB_NAME="libMangoHud_dlsym.so:${MANGOHUD_LIB_NAME}" 17 - shift # shift will only be executed if $1 is "--dlsym" 18 - elif [ "$MANGOHUD_DLSYM" = "1" ]; then 19 - - MANGOHUD_LIB_NAME="@ld_libdir_mangohud@libMangoHud_dlsym.so:${MANGOHUD_LIB_NAME}" 20 - + MANGOHUD_LIB_NAME="libMangoHud_dlsym.so:${MANGOHUD_LIB_NAME}" 21 - fi 12 + +MANGOHUD_LIB_NAME="libMangoHud_shim.so" 22 13 23 14 if [ "$1" = "--version" ]; then 24 - @@ -41,7 +43,7 @@ for exe in $DISABLE_LD_PRELOAD; do 15 + echo @version@ 16 + @@ -39,7 +41,7 @@ for exe in $DISABLE_LD_PRELOAD; do 25 17 done 26 18 27 19 if [ "$disable_preload" = true ]; then ··· 30 22 else 31 23 # Make sure we don't append mangohud lib multiple times 32 24 # otherwise, this could cause issues with the steam runtime 33 - @@ -54,5 +56,5 @@ else 25 + @@ -52,5 +54,5 @@ else 34 26 LD_PRELOAD="${LD_PRELOAD:+$LD_PRELOAD:}${MANGOHUD_LIB_NAME}" 35 27 esac 36 28