mangohud: 0.6.8 -> 0.6.9

+65 -58
+34 -41
pkgs/tools/graphics/mangohud/default.nix
··· 13 , hwdata 14 , mangohud32 15 , addOpenGLRunpath 16 - , appstream 17 , glslang 18 - , makeWrapper 19 , mako 20 , meson 21 , ninja ··· 24 , libXNVCtrl 25 , wayland 26 , libX11 27 , spdlog 28 , glew 29 , glfw 30 - , nlohmann_json 31 , xorg 32 , gamescopeSupport ? true # build mangoapp and mangohudctl 33 , nix-update-script ··· 41 owner = "ocornut"; 42 repo = "imgui"; 43 rev = "refs/tags/v${version}"; 44 - sha256 = "sha256-rRkayXk3xz758v6vlMSaUu5fui6NR8Md3njhDB0gJ18="; 45 }; 46 patch = fetchurl { 47 url = "https://wrapdb.mesonbuild.com/v2/imgui_${version}-1/get_patch"; 48 - sha256 = "sha256-bQC0QmkLalxdj4mDEdqvvOFtNwz2T1MpTDuMXGYeQ18="; 49 }; 50 }; 51 ··· 66 in 67 stdenv.mkDerivation (finalAttrs: { 68 pname = "mangohud"; 69 - version = "0.6.8"; 70 71 src = fetchFromGitHub { 72 owner = "flightlessmango"; 73 repo = "MangoHud"; 74 rev = "refs/tags/v${finalAttrs.version}"; 75 fetchSubmodules = true; 76 - sha256 = "sha256-jfmgN90kViHa7vMOjo2x4bNY2QbLk93uYEvaA4DxYvg="; 77 }; 78 79 outputs = [ "out" "doc" "man" ]; ··· 85 cp -R --no-preserve=mode,ownership ${vulkan-headers.src} Vulkan-Headers-${vulkan-headers.version} 86 )''; 87 88 - env.NIX_CFLAGS_COMPILE = "-I${vulkan-headers.src}/include"; 89 90 - patches = [ 91 # Hard code dependencies. Can't use makeWrapper since the Vulkan 92 # layer can be used without the mangohud executable by setting MANGOHUD=1. 93 (substituteAll { ··· 105 libdbus = dbus.lib; 106 inherit hwdata; 107 }) 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 ]; 121 122 - postPatch = ''( 123 - cd subprojects 124 - unzip ${imgui.patch} 125 - unzip ${vulkan-headers.patch} 126 - )''; 127 128 mesonFlags = [ 129 "-Dwith_wayland=enabled" 130 "-Duse_system_spdlog=enabled" 131 ] ++ lib.optionals gamescopeSupport [ 132 "-Dmangoapp_layer=true" 133 - "-Dmangoapp=true" 134 "-Dmangohudctl=true" 135 ]; 136 137 nativeBuildInputs = [ 138 addOpenGLRunpath 139 - appstream 140 glslang 141 - makeWrapper 142 mako 143 meson 144 ninja ··· 154 155 buildInputs = [ 156 dbus 157 spdlog 158 ] ++ lib.optionals gamescopeSupport [ 159 glew 160 glfw 161 - nlohmann_json 162 xorg.libXrandr 163 ]; 164 165 # Support 32bit Vulkan applications by linking in 32bit Vulkan layers 166 - # This is needed for the same reason the 32bit OpenGL workaround is needed. 167 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" 170 171 ${lib.optionalString gamescopeSupport '' 172 - ln -s ${mangohud32}/share/vulkan/implicit_layer.d/libMangoApp.json \ 173 - "$out/share/vulkan/implicit_layer.d/libMangoApp.x86.json" 174 ''} 175 ''; 176 177 postFixup = '' 178 - # Add OpenGL driver path to RUNPATH to support NVIDIA cards 179 addOpenGLRunpath "$out/lib/mangohud/libMangoHud.so" 180 ${lib.optionalString gamescopeSupport '' 181 addOpenGLRunpath "$out/bin/mangoapp" 182 ''} 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 ''; 189 190 passthru.updateScript = nix-update-script { };
··· 13 , hwdata 14 , mangohud32 15 , addOpenGLRunpath 16 , glslang 17 , mako 18 , meson 19 , ninja ··· 22 , libXNVCtrl 23 , wayland 24 , libX11 25 + , nlohmann_json 26 , spdlog 27 , glew 28 , glfw 29 , xorg 30 , gamescopeSupport ? true # build mangoapp and mangohudctl 31 , nix-update-script ··· 39 owner = "ocornut"; 40 repo = "imgui"; 41 rev = "refs/tags/v${version}"; 42 + hash = "sha256-rRkayXk3xz758v6vlMSaUu5fui6NR8Md3njhDB0gJ18="; 43 }; 44 patch = fetchurl { 45 url = "https://wrapdb.mesonbuild.com/v2/imgui_${version}-1/get_patch"; 46 + hash = "sha256-bQC0QmkLalxdj4mDEdqvvOFtNwz2T1MpTDuMXGYeQ18="; 47 }; 48 }; 49 ··· 64 in 65 stdenv.mkDerivation (finalAttrs: { 66 pname = "mangohud"; 67 + version = "0.6.9"; 68 69 src = fetchFromGitHub { 70 owner = "flightlessmango"; 71 repo = "MangoHud"; 72 rev = "refs/tags/v${finalAttrs.version}"; 73 fetchSubmodules = true; 74 + hash = "sha256-wvidO9LAZwVUZhYYWnelSiP0Q1WTPoCg6pMXsoJBPPg="; 75 }; 76 77 outputs = [ "out" "doc" "man" ]; ··· 83 cp -R --no-preserve=mode,ownership ${vulkan-headers.src} Vulkan-Headers-${vulkan-headers.version} 84 )''; 85 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 91 92 # Hard code dependencies. Can't use makeWrapper since the Vulkan 93 # layer can be used without the mangohud executable by setting MANGOHUD=1. 94 (substituteAll { ··· 106 libdbus = dbus.lib; 107 inherit hwdata; 108 }) 109 ]; 110 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 + ''; 126 127 mesonFlags = [ 128 "-Dwith_wayland=enabled" 129 "-Duse_system_spdlog=enabled" 130 + "-Dtests=disabled" # Tests require AMD GPU 131 ] ++ lib.optionals gamescopeSupport [ 132 + "-Dmangoapp=true" 133 "-Dmangoapp_layer=true" 134 "-Dmangohudctl=true" 135 ]; 136 137 nativeBuildInputs = [ 138 addOpenGLRunpath 139 glslang 140 mako 141 meson 142 ninja ··· 152 153 buildInputs = [ 154 dbus 155 + nlohmann_json 156 spdlog 157 ] ++ lib.optionals gamescopeSupport [ 158 glew 159 glfw 160 xorg.libXrandr 161 ]; 162 163 # Support 32bit Vulkan applications by linking in 32bit Vulkan layers 164 + # This is needed for the same reason the 32bit preload workaround is needed. 165 postInstall = lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux") '' 166 + ln -s ${mangohud32}/share/vulkan/implicit_layer.d/MangoHud.x86.json \ 167 + "$out/share/vulkan/implicit_layer.d" 168 169 ${lib.optionalString gamescopeSupport '' 170 + ln -s ${mangohud32}/share/vulkan/implicit_layer.d/libMangoApp.x86.json \ 171 + "$out/share/vulkan/implicit_layer.d" 172 ''} 173 ''; 174 175 + # Add OpenGL driver path to RUNPATH to support NVIDIA cards 176 postFixup = '' 177 addOpenGLRunpath "$out/lib/mangohud/libMangoHud.so" 178 ${lib.optionalString gamescopeSupport '' 179 addOpenGLRunpath "$out/bin/mangoapp" 180 ''} 181 ''; 182 183 passthru.updateScript = nix-update-script { };
+5 -5
pkgs/tools/graphics/mangohud/hardcode-dependencies.patch
··· 1 diff --git a/src/dbus.cpp b/src/dbus.cpp 2 - index 3b3cccb..1405725 100644 3 --- a/src/dbus.cpp 4 +++ b/src/dbus.cpp 5 @@ -152,7 +152,7 @@ bool dbus_manager::get_media_player_metadata(metadata& meta, std::string name) { ··· 12 return false; 13 } 14 diff --git a/src/logging.cpp b/src/logging.cpp 15 - index 1668226..f0c8df5 100644 16 --- a/src/logging.cpp 17 +++ b/src/logging.cpp 18 - @@ -24,7 +24,11 @@ string exec(string command) { 19 #endif 20 std::array<char, 128> buffer; 21 std::string result; ··· 28 return "popen failed!"; 29 } 30 diff --git a/src/pci_ids.cpp b/src/pci_ids.cpp 31 - index feec222..6baa707 100644 32 --- a/src/pci_ids.cpp 33 +++ b/src/pci_ids.cpp 34 - @@ -24,11 +24,9 @@ std::istream& get_uncommented_line(std::istream& is, std::string &line) 35 void parse_pciids() 36 { 37 std::ifstream file;
··· 1 diff --git a/src/dbus.cpp b/src/dbus.cpp 2 + index 7379af1..4eef3fe 100644 3 --- a/src/dbus.cpp 4 +++ b/src/dbus.cpp 5 @@ -152,7 +152,7 @@ bool dbus_manager::get_media_player_metadata(metadata& meta, std::string name) { ··· 12 return false; 13 } 14 diff --git a/src/logging.cpp b/src/logging.cpp 15 + index 046c847..42782be 100644 16 --- a/src/logging.cpp 17 +++ b/src/logging.cpp 18 + @@ -26,7 +26,11 @@ string exec(string command) { 19 #endif 20 std::array<char, 128> buffer; 21 std::string result; ··· 28 return "popen failed!"; 29 } 30 diff --git a/src/pci_ids.cpp b/src/pci_ids.cpp 31 + index 002a843..5a6262b 100644 32 --- a/src/pci_ids.cpp 33 +++ b/src/pci_ids.cpp 34 + @@ -24,11 +24,9 @@ static std::istream& get_uncommented_line(std::istream& is, std::string &line) 35 void parse_pciids() 36 { 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}" "$@"