about summary refs log tree commit diff
path: root/pkgs/tools
diff options
context:
space:
mode:
authorKira Bruneau <kira.bruneau@pm.me>2024-02-14 20:41:01 -0500
committerKira Bruneau <kira.bruneau@pm.me>2024-02-14 23:42:31 -0500
commitbab16f22592de9f466dab58074de949d88cc1f3e (patch)
treec25a753838b0dcb584433bb6cf4220c97bbd976a /pkgs/tools
parent89653a03e0915e4a872788d10680e7eec92f8600 (diff)
downloadnixlib-bab16f22592de9f466dab58074de949d88cc1f3e.tar
nixlib-bab16f22592de9f466dab58074de949d88cc1f3e.tar.gz
nixlib-bab16f22592de9f466dab58074de949d88cc1f3e.tar.bz2
nixlib-bab16f22592de9f466dab58074de949d88cc1f3e.tar.lz
nixlib-bab16f22592de9f466dab58074de949d88cc1f3e.tar.xz
nixlib-bab16f22592de9f466dab58074de949d88cc1f3e.tar.zst
nixlib-bab16f22592de9f466dab58074de949d88cc1f3e.zip
mangohud: 0.7.0 -> 0.7.1
https://github.com/flightlessmango/MangoHud/releases/tag/v0.7.1
Diffstat (limited to 'pkgs/tools')
-rw-r--r--pkgs/tools/graphics/mangohud/default.nix83
-rw-r--r--pkgs/tools/graphics/mangohud/hardcode-dependencies.patch2
-rw-r--r--pkgs/tools/graphics/mangohud/preload-nix-workaround.patch41
3 files changed, 83 insertions, 43 deletions
diff --git a/pkgs/tools/graphics/mangohud/default.nix b/pkgs/tools/graphics/mangohud/default.nix
index 5dc243ec2d7e..fc0fc9930d78 100644
--- a/pkgs/tools/graphics/mangohud/default.nix
+++ b/pkgs/tools/graphics/mangohud/default.nix
@@ -4,6 +4,7 @@
 , fetchFromGitHub
 , fetchurl
 , substituteAll
+, fetchpatch
 , coreutils
 , curl
 , glxinfo
@@ -38,7 +39,6 @@
 let
   # Derived from subprojects/cmocka.wrap
   cmocka = {
-    version = "1.81";
     src = fetchFromGitLab {
       owner = "cmocka";
       repo = "cmocka";
@@ -47,18 +47,33 @@ let
     };
   };
 
+  # Derived from subprojects/implot.wrap
+  implot = rec {
+    version = "0.16";
+    src = fetchFromGitHub {
+      owner = "epezent";
+      repo = "implot";
+      rev = "refs/tags/v${version}";
+      hash = "sha256-/wkVsgz3wiUVZBCgRl2iDD6GWb+AoHN+u0aeqHHgem0=";
+    };
+    patch = fetchurl {
+      url = "https://wrapdb.mesonbuild.com/v2/implot_${version}-1/get_patch";
+      hash = "sha256-HGsUYgZqVFL6UMHaHdR/7YQfKCMpcsgtd48pYpNlaMc=";
+    };
+  };
+
   # Derived from subprojects/imgui.wrap
   imgui = rec {
-    version = "1.81";
+    version = "1.89.9";
     src = fetchFromGitHub {
       owner = "ocornut";
       repo = "imgui";
       rev = "refs/tags/v${version}";
-      hash = "sha256-rRkayXk3xz758v6vlMSaUu5fui6NR8Md3njhDB0gJ18=";
+      hash = "sha256-0k9jKrJUrG9piHNFQaBBY3zgNIKM23ZA879NY+MNYTU=";
     };
     patch = fetchurl {
       url = "https://wrapdb.mesonbuild.com/v2/imgui_${version}-1/get_patch";
-      hash = "sha256-bQC0QmkLalxdj4mDEdqvvOFtNwz2T1MpTDuMXGYeQ18=";
+      hash = "sha256-myEpDFl9dr+NTus/n/oCSxHZ6mxh6R1kjMyQtChD1YQ=";
     };
   };
 
@@ -68,7 +83,7 @@ let
     src = fetchFromGitHub {
       owner = "KhronosGroup";
       repo = "Vulkan-Headers";
-      rev = "v${version}";
+      rev = "refs/tags/v${version}";
       hash = "sha256-5uyk2nMwV1MjXoa3hK/WUeGLwpINJJEvY16kc5DEaks=";
     };
     patch = fetchurl {
@@ -79,14 +94,14 @@ let
 in
 stdenv.mkDerivation (finalAttrs: {
   pname = "mangohud";
-  version = "0.7.0";
+  version = "0.7.1";
 
   src = fetchFromGitHub {
     owner = "flightlessmango";
     repo = "MangoHud";
     rev = "refs/tags/v${finalAttrs.version}";
     fetchSubmodules = true;
-    hash = "sha256-KkMN7A3AcS/v+b9GCs0pI6MBBk3WwOMciaoiBzL5xOQ=";
+    hash = "sha256-Gnq+1j+PFbeipAfXGnTq7wZdVQeG9R9vLAKZnZj7Bvs=";
   };
 
   outputs = [ "out" "doc" "man" ];
@@ -97,6 +112,7 @@ stdenv.mkDerivation (finalAttrs: {
     ${lib.optionalString finalAttrs.finalPackage.doCheck ''
       cp -R --no-preserve=mode,ownership ${cmocka.src} cmocka
     ''}
+    cp -R --no-preserve=mode,ownership ${implot.src} implot-${implot.version}
     cp -R --no-preserve=mode,ownership ${imgui.src} imgui-${imgui.version}
     cp -R --no-preserve=mode,ownership ${vulkan-headers.src} Vulkan-Headers-${vulkan-headers.version}
   )'';
@@ -124,6 +140,13 @@ stdenv.mkDerivation (finalAttrs: {
       libdbus = dbus.lib;
       inherit hwdata;
     })
+
+    # Add dep_vulkan to mangoapp and test_amdgpu to fix build failure
+    # TODO: Remove in next release
+    (fetchpatch {
+      url = "https://github.com/flightlessmango/MangoHud/commit/cba217ffaf93aea6acb4e59e3e46bf912f740ccf.patch";
+      hash = "sha256-1My4/EuSMpe3AFhhFOJr8rz/wnywp+BW+F4dSgxToe0=";
+    })
   ];
 
   postPatch = ''
@@ -138,6 +161,7 @@ stdenv.mkDerivation (finalAttrs: {
 
     (
       cd subprojects
+      unzip ${implot.patch}
       unzip ${imgui.patch}
       unzip ${vulkan-headers.patch}
     )
@@ -198,33 +222,36 @@ stdenv.mkDerivation (finalAttrs: {
     ''}
   '';
 
-  postFixup = let
-    archMap = {
-      "x86_64-linux" = "x86_64";
-      "i686-linux" = "x86";
-    };
-    layerPlatform = archMap."${stdenv.hostPlatform.system}" or null;
-    # We need to give the different layers separate names or else the loader
-    # might try the 32-bit one first, fail and not attempt to load the 64-bit
-    # layer under the same name.
-  in lib.optionalString (layerPlatform != null) ''
-    substituteInPlace $out/share/vulkan/implicit_layer.d/MangoHud.${layerPlatform}.json \
-      --replace "VK_LAYER_MANGOHUD_overlay" "VK_LAYER_MANGOHUD_overlay_${toString stdenv.hostPlatform.parsed.cpu.bits}"
-  '' + ''
-    # Add OpenGL driver path to RUNPATH to support NVIDIA cards
-    addOpenGLRunpath "$out/lib/mangohud/libMangoHud.so"
-  '' + lib.optionalString gamescopeSupport ''
-    addOpenGLRunpath "$out/bin/mangoapp"
-  '' + lib.optionalString finalAttrs.finalPackage.doCheck ''
-    # libcmocka.so is only used for tests
-    rm "$out/lib/libcmocka.so"
-  '';
+  postFixup =
+    let
+      archMap = {
+        "x86_64-linux" = "x86_64";
+        "i686-linux" = "x86";
+      };
+      layerPlatform = archMap."${stdenv.hostPlatform.system}" or null;
+      # We need to give the different layers separate names or else the loader
+      # might try the 32-bit one first, fail and not attempt to load the 64-bit
+      # layer under the same name.
+    in
+    lib.optionalString (layerPlatform != null) ''
+      substituteInPlace $out/share/vulkan/implicit_layer.d/MangoHud.${layerPlatform}.json \
+        --replace "VK_LAYER_MANGOHUD_overlay" "VK_LAYER_MANGOHUD_overlay_${toString stdenv.hostPlatform.parsed.cpu.bits}"
+    '' + ''
+      # Add OpenGL driver path to RUNPATH to support NVIDIA cards
+      addOpenGLRunpath "$out/lib/mangohud/libMangoHud.so"
+    '' + lib.optionalString gamescopeSupport ''
+      addOpenGLRunpath "$out/bin/mangoapp"
+    '' + lib.optionalString finalAttrs.finalPackage.doCheck ''
+      # libcmocka.so is only used for tests
+      rm "$out/lib/libcmocka.so"
+    '';
 
   passthru.updateScript = nix-update-script { };
 
   meta = with lib; {
     description = "A Vulkan and OpenGL overlay for monitoring FPS, temperatures, CPU/GPU load and more";
     homepage = "https://github.com/flightlessmango/MangoHud";
+    changelog = "https://github.com/flightlessmango/MangoHud/releases/tag/v${finalAttrs.version}";
     platforms = platforms.linux;
     license = licenses.mit;
     maintainers = with maintainers; [ kira-bruneau zeratax ];
diff --git a/pkgs/tools/graphics/mangohud/hardcode-dependencies.patch b/pkgs/tools/graphics/mangohud/hardcode-dependencies.patch
index d2b11673d77f..1c0f3a497fe6 100644
--- a/pkgs/tools/graphics/mangohud/hardcode-dependencies.patch
+++ b/pkgs/tools/graphics/mangohud/hardcode-dependencies.patch
@@ -12,7 +12,7 @@ index 7379af1..4eef3fe 100644
          return false;
      }
 diff --git a/src/logging.cpp b/src/logging.cpp
-index 046c847..42782be 100644
+index ca33ee3..90d3638 100644
 --- a/src/logging.cpp
 +++ b/src/logging.cpp
 @@ -26,7 +26,11 @@ string exec(string command) {
diff --git a/pkgs/tools/graphics/mangohud/preload-nix-workaround.patch b/pkgs/tools/graphics/mangohud/preload-nix-workaround.patch
index f38e1703973d..5aa538b4c4c7 100644
--- a/pkgs/tools/graphics/mangohud/preload-nix-workaround.patch
+++ b/pkgs/tools/graphics/mangohud/preload-nix-workaround.patch
@@ -1,26 +1,39 @@
 diff --git a/bin/mangohud.in b/bin/mangohud.in
-index 6c3c6e8..8847cdc 100755
+index 53c72ef..18240ea 100755
 --- a/bin/mangohud.in
 +++ b/bin/mangohud.in
-@@ -8,10 +8,10 @@ if [ "$#" -eq 0 ]; then
- 	exit 1
- fi
+@@ -13,13 +13,15 @@ fi
+ DISABLE_LD_PRELOAD="cs2.sh
+ some_other_exe"
  
 -MANGOHUD_LIB_NAME="@ld_libdir_mangohud@libMangoHud_opengl.so"
++LD_LIBRARY_PATH="@libraryPath@${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
++XDG_DATA_DIRS="@dataDir@${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}"
 +MANGOHUD_LIB_NAME="libMangoHud_opengl.so"
  
  if [ "$1" = "--dlsym" ]; then
--	MANGOHUD_LIB_NAME="@ld_libdir_mangohud@libMangoHud_dlsym.so:${MANGOHUD_LIB_NAME}"
-+	MANGOHUD_LIB_NAME="libMangoHud_dlsym.so:${MANGOHUD_LIB_NAME}"
- 	shift
+-    MANGOHUD_LIB_NAME="@ld_libdir_mangohud@libMangoHud_dlsym.so:${MANGOHUD_LIB_NAME}"
++    MANGOHUD_LIB_NAME="libMangoHud_dlsym.so:${MANGOHUD_LIB_NAME}"
+     shift  # shift will only be executed if $1 is "--dlsym"
+ elif [ "$MANGOHUD_DLSYM" = "1" ]; then
+-    MANGOHUD_LIB_NAME="@ld_libdir_mangohud@libMangoHud_dlsym.so:${MANGOHUD_LIB_NAME}"
++    MANGOHUD_LIB_NAME="libMangoHud_dlsym.so:${MANGOHUD_LIB_NAME}"
  fi
  
-@@ -31,5 +31,7 @@ case ":${LD_PRELOAD-}:" in
-         LD_PRELOAD="${LD_PRELOAD:+$LD_PRELOAD:}${MANGOHUD_LIB_NAME}"
- esac
+ if [ "$1" = "--version" ]; then
+@@ -41,7 +43,7 @@ for exe in $DISABLE_LD_PRELOAD; do
+ done
  
-+LD_LIBRARY_PATH="@libraryPath@${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
-+XDG_DATA_DIRS="@dataDir@${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}"
+ if [ "$disable_preload" = true ]; then
+-    exec env MANGOHUD=1 "$@"
++    exec env MANGOHUD=1 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" XDG_DATA_DIRS="${XDG_DATA_DIRS}" "$@"
+ else
+     # Make sure we don't append mangohud lib multiple times
+     # otherwise, this could cause issues with the steam runtime
+@@ -54,5 +56,5 @@ else
+             LD_PRELOAD="${LD_PRELOAD:+$LD_PRELOAD:}${MANGOHUD_LIB_NAME}"
+     esac
  
--exec env MANGOHUD=1 LD_PRELOAD="${LD_PRELOAD}" "$@"
-+exec env MANGOHUD=1 LD_PRELOAD="${LD_PRELOAD}" LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" XDG_DATA_DIRS="${XDG_DATA_DIRS}" "$@"
+-    exec env MANGOHUD=1 LD_PRELOAD="${LD_PRELOAD}" "$@"
++    exec env MANGOHUD=1 LD_PRELOAD="${LD_PRELOAD}" LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" XDG_DATA_DIRS="${XDG_DATA_DIRS}" "$@"
+ fi