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