Skip to content

Commit

Permalink
mangohud: 0.7.0.rc1.r4 -> 0.7.0.r54
Browse files Browse the repository at this point in the history
  • Loading branch information
K900 committed Oct 24, 2023
1 parent 9e6bc6f commit edf4ee4
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 19 deletions.
6 changes: 3 additions & 3 deletions pkgs/mangohud/default.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{ callPackage, fetchFromGitHub, git, ... }@args:

(callPackage ./upstream (removeAttrs args ["callPackage" "git"])).overrideAttrs (old: {
version = "0.7.0.rc1.r4";
version = "0.7.0.r54";
src = fetchFromGitHub {
owner = "flightlessmango";
repo = "MangoHud";

rev = "1a0abc65dfb44853813e6e437bd71747bac089e5";
hash = "sha256-XOoVAcNrKphuoUbt8GDTX2p/JtCMf87DLRycHdINTBA=";
rev = "9393066ef87c168a55fb0e2db3d002c55544fdd6";
hash = "sha256-WM3Z0l0rEVQ56GG0XhHu3/ao2K066GjIh25nn2QU+8A=";
};

nativeBuildInputs = old.nativeBuildInputs ++ [ git ];
Expand Down
22 changes: 19 additions & 3 deletions pkgs/mangohud/upstream/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ let

# 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=";
};
};

Expand All @@ -76,6 +76,20 @@ let
hash = "sha256-hgNYz15z9FjNHoj4w4EW0SOrQh1c4uQSnsOOrt2CDhc=";
};
};

implot = rec {
version = "0.16";
src = fetchFromGitHub {
owner = "epezent";
repo = "implot";
rev = "v${version}";
hash = "sha256-/wkVsgz3wiUVZBCgRl2iDD6GWb+AoHN+u0aeqHHgem0=";
};
patch = fetchurl {
url = "https://wrapdb.mesonbuild.com/v2/implot_${version}-1/get_patch";
hash = "sha256-HGsUYgZqVFL6UMHaHdR/7YQfKCMpcsgtd48pYpNlaMc=";
};
};
in
stdenv.mkDerivation (finalAttrs: {
pname = "mangohud";
Expand All @@ -99,6 +113,7 @@ stdenv.mkDerivation (finalAttrs: {
''}
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}
cp -R --no-preserve=mode,ownership ${implot.src} implot-${implot.version}
)'';

patches = [
Expand Down Expand Up @@ -140,6 +155,7 @@ stdenv.mkDerivation (finalAttrs: {
cd subprojects
unzip ${imgui.patch}
unzip ${vulkan-headers.patch}
unzip ${implot.patch}
)
'';

Expand Down
42 changes: 29 additions & 13 deletions pkgs/mangohud/upstream/preload-nix-workaround.patch
Original file line number Diff line number Diff line change
@@ -1,26 +1,42 @@
diff --git a/bin/mangohud.in b/bin/mangohud.in
index 6c3c6e8..8847cdc 100755
index 53c72ef..3cc4f19 100755
--- a/bin/mangohud.in
+++ b/bin/mangohud.in
@@ -8,10 +8,10 @@ if [ "$#" -eq 0 ]; then
exit 1
fi
@@ -13,13 +13,13 @@ fi
DISABLE_LD_PRELOAD="cs2.sh
some_other_exe"

-MANGOHUD_LIB_NAME="@ld_libdir_mangohud@libMangoHud_opengl.so"
+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
@@ -40,8 +40,10 @@ for exe in $DISABLE_LD_PRELOAD; do
fi
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 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,7 @@ 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}" "$@"
+ LD_LIBRARY_PATH="@libraryPath@${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
+
+ exec env MANGOHUD=1 LD_PRELOAD="${LD_PRELOAD}" LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" XDG_DATA_DIRS="${XDG_DATA_DIRS}" "$@"
fi

0 comments on commit edf4ee4

Please sign in to comment.