Merge pull request #185072 from kira-bruneau/mangohud-update

authored by Sandro and committed by GitHub 0438eb1b 74f63828

+17 -56
+10 -20
pkgs/tools/graphics/mangohud/default.nix
··· 1 { lib 2 , stdenv 3 , fetchFromGitHub 4 - , fetchpatch 5 , fetchurl 6 , substituteAll 7 , coreutils 8 , curl 9 - , gawk 10 , glxinfo 11 , gnugrep 12 , gnused 13 - , lsof 14 , xdg-utils 15 , dbus 16 , hwdata 17 , libX11 18 , mangohud32 19 , vulkan-headers 20 , glslang 21 , makeWrapper 22 , meson 23 , ninja 24 , pkg-config 25 - , python3Packages 26 , unzip 27 , vulkan-loader 28 , libXNVCtrl ··· 43 src = fetchFromGitHub { 44 owner = "ocornut"; 45 repo = "imgui"; 46 - rev = "v${version}"; 47 - hash = "sha256-rRkayXk3xz758v6vlMSaUu5fui6NR8Md3njhDB0gJ18="; 48 }; 49 patch = fetchurl { 50 url = "https://wrapdb.mesonbuild.com/v2/imgui_${version}-1/get_patch"; 51 - hash = "sha256-bQC0QmkLalxdj4mDEdqvvOFtNwz2T1MpTDuMXGYeQ18="; 52 }; 53 }; 54 in stdenv.mkDerivation rec { 55 pname = "mangohud"; 56 - version = "0.6.7-1"; 57 58 src = fetchFromGitHub { 59 owner = "flightlessmango"; 60 repo = "MangoHud"; 61 - rev = "v${version}"; 62 fetchSubmodules = true; 63 - sha256 = "sha256-60cZYo+d679KRggLBGbpLYM5Iu1XySEEGp+MxZs6wF0="; 64 }; 65 66 outputs = [ "out" "doc" "man" ]; ··· 81 path = lib.makeBinPath [ 82 coreutils 83 curl 84 - gawk 85 glxinfo 86 gnugrep 87 gnused 88 - lsof 89 xdg-utils 90 ]; 91 92 libdbus = dbus.lib; 93 inherit hwdata libX11; 94 }) 95 - 96 - (fetchpatch { 97 - name = "allow-system-nlohmann-json.patch"; 98 - url = "https://github.com/flightlessmango/MangoHud/commit/e1ffa0f85820abea44639438fca2152290c87ee8.patch"; 99 - sha256 = "sha256-CaJb0RpXmNGCBidMXM39VJVLIXb6NbN5HXWkH/5Sfvo="; 100 - }) 101 ] ++ lib.optional (stdenv.hostPlatform.system == "x86_64-linux") [ 102 # Support 32bit OpenGL applications by appending the mangohud32 103 # lib path to LD_LIBRARY_PATH. ··· 124 ]; 125 126 nativeBuildInputs = [ 127 glslang 128 makeWrapper 129 meson 130 ninja 131 pkg-config 132 - python3Packages.Mako 133 - python3Packages.python 134 unzip 135 vulkan-loader 136 ];
··· 1 { lib 2 , stdenv 3 , fetchFromGitHub 4 , fetchurl 5 , substituteAll 6 , coreutils 7 , curl 8 , glxinfo 9 , gnugrep 10 , gnused 11 , xdg-utils 12 , dbus 13 , hwdata 14 , libX11 15 , mangohud32 16 , vulkan-headers 17 + , appstream 18 , glslang 19 , makeWrapper 20 + , Mako 21 , meson 22 , ninja 23 , pkg-config 24 , unzip 25 , vulkan-loader 26 , libXNVCtrl ··· 41 src = fetchFromGitHub { 42 owner = "ocornut"; 43 repo = "imgui"; 44 + rev = "refs/tags/v${version}"; 45 + sha256 = "sha256-rRkayXk3xz758v6vlMSaUu5fui6NR8Md3njhDB0gJ18="; 46 }; 47 patch = fetchurl { 48 url = "https://wrapdb.mesonbuild.com/v2/imgui_${version}-1/get_patch"; 49 + sha256 = "sha256-bQC0QmkLalxdj4mDEdqvvOFtNwz2T1MpTDuMXGYeQ18="; 50 }; 51 }; 52 in stdenv.mkDerivation rec { 53 pname = "mangohud"; 54 + version = "0.6.8"; 55 56 src = fetchFromGitHub { 57 owner = "flightlessmango"; 58 repo = "MangoHud"; 59 + rev = "refs/tags/v${version}"; 60 fetchSubmodules = true; 61 + sha256 = "sha256-jfmgN90kViHa7vMOjo2x4bNY2QbLk93uYEvaA4DxYvg="; 62 }; 63 64 outputs = [ "out" "doc" "man" ]; ··· 79 path = lib.makeBinPath [ 80 coreutils 81 curl 82 glxinfo 83 gnugrep 84 gnused 85 xdg-utils 86 ]; 87 88 libdbus = dbus.lib; 89 inherit hwdata libX11; 90 }) 91 ] ++ lib.optional (stdenv.hostPlatform.system == "x86_64-linux") [ 92 # Support 32bit OpenGL applications by appending the mangohud32 93 # lib path to LD_LIBRARY_PATH. ··· 114 ]; 115 116 nativeBuildInputs = [ 117 + appstream 118 glslang 119 makeWrapper 120 + Mako 121 meson 122 ninja 123 pkg-config 124 unzip 125 vulkan-loader 126 ];
+2 -20
pkgs/tools/graphics/mangohud/hardcode-dependencies.patch
··· 1 - From 56a191f6db6d530c2bc89d9d3395b4c9768d108f Mon Sep 17 00:00:00 2001 2 - From: Atemu <atemu.main@gmail.com> 3 - Date: Tue, 17 May 2022 16:58:08 +0200 4 - Subject: [PATCH 1/2] hardcode dependencies 5 - 6 - --- 7 - src/dbus.cpp | 2 +- 8 - src/loaders/loader_x11.cpp | 2 +- 9 - src/logging.cpp | 7 +++++++ 10 - src/pci_ids.cpp | 6 ++---- 11 - 4 files changed, 11 insertions(+), 6 deletions(-) 12 - 13 diff --git a/src/dbus.cpp b/src/dbus.cpp 14 index 3b3cccb..1405725 100644 15 --- a/src/dbus.cpp ··· 34 -std::shared_ptr<libx11_loader> g_x11(new libx11_loader("libX11.so.6")); 35 +std::shared_ptr<libx11_loader> g_x11(new libx11_loader("@libX11@/lib/libX11.so.6")); 36 diff --git a/src/logging.cpp b/src/logging.cpp 37 - index b27f21e..48f5e03 100644 38 --- a/src/logging.cpp 39 +++ b/src/logging.cpp 40 - @@ -22,7 +22,14 @@ string exec(string command) { 41 #endif 42 std::array<char, 128> buffer; 43 std::string result; 44 + 45 + char* originalPath = getenv("PATH"); 46 + setenv("PATH", "@path@", 1); 47 - + 48 std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(command.c_str(), "r"), pclose); 49 - + 50 + setenv("PATH", originalPath, 1); 51 - + 52 if (!pipe) { 53 return "popen failed!"; 54 } ··· 70 } 71 72 std::string line; 73 - -- 74 - 2.36.0 75 -
··· 1 diff --git a/src/dbus.cpp b/src/dbus.cpp 2 index 3b3cccb..1405725 100644 3 --- a/src/dbus.cpp ··· 22 -std::shared_ptr<libx11_loader> g_x11(new libx11_loader("libX11.so.6")); 23 +std::shared_ptr<libx11_loader> g_x11(new libx11_loader("@libX11@/lib/libX11.so.6")); 24 diff --git a/src/logging.cpp b/src/logging.cpp 25 + index 1668226..f0c8df5 100644 26 --- a/src/logging.cpp 27 +++ b/src/logging.cpp 28 + @@ -24,7 +24,11 @@ string exec(string command) { 29 #endif 30 std::array<char, 128> buffer; 31 std::string result; 32 + 33 + char* originalPath = getenv("PATH"); 34 + setenv("PATH", "@path@", 1); 35 std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(command.c_str(), "r"), pclose); 36 + setenv("PATH", originalPath, 1); 37 if (!pipe) { 38 return "popen failed!"; 39 } ··· 55 } 56 57 std::string line;
+4 -16
pkgs/tools/graphics/mangohud/opengl32-nix-workaround.patch
··· 1 - From 1ac93cbf0eed951af6967a81f731a0f418ea0b3d Mon Sep 17 00:00:00 2001 2 - From: Atemu <atemu.main@gmail.com> 3 - Date: Tue, 17 May 2022 16:58:45 +0200 4 - Subject: [PATCH 2/2] opengl32 nix workaround 5 - 6 - --- 7 - bin/mangohud.in | 2 +- 8 - 1 file changed, 1 insertion(+), 1 deletion(-) 9 - 10 diff --git a/bin/mangohud.in b/bin/mangohud.in 11 - index 8ec21de..f65304a 100755 12 --- a/bin/mangohud.in 13 +++ b/bin/mangohud.in 14 @@ -23,6 +23,6 @@ fi 15 # figure out whether the 32 or 64 bit version should be used, and will search 16 # for it in the correct directory 17 - LD_PRELOAD="${LD_PRELOAD}:${MANGOHUD_LIB_NAME}" 18 - -LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:@ld_libdir_mangohud@" 19 - +LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:@ld_libdir_mangohud@:@mangohud32@/lib/mangohud" 20 21 exec env MANGOHUD=1 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" LD_PRELOAD="${LD_PRELOAD}" "$@" 22 - -- 23 - 2.36.0 24 -
··· 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}" "$@"
+1
pkgs/top-level/all-packages.nix
··· 8576 mangohud = callPackage ../tools/graphics/mangohud { 8577 libXNVCtrl = linuxPackages.nvidia_x11.settings.libXNVCtrl; 8578 mangohud32 = pkgsi686Linux.mangohud; 8579 }; 8580 8581 manix = callPackage ../tools/nix/manix {
··· 8576 mangohud = callPackage ../tools/graphics/mangohud { 8577 libXNVCtrl = linuxPackages.nvidia_x11.settings.libXNVCtrl; 8578 mangohud32 = pkgsi686Linux.mangohud; 8579 + inherit (python3Packages) Mako; 8580 }; 8581 8582 manix = callPackage ../tools/nix/manix {