From 25b4dcac695be0439bbc13755f8c69bbb82907c9 Mon Sep 17 00:00:00 2001 From: "Alexander \"PapaTutuWawa" Date: Mon, 23 Aug 2021 20:28:24 +0200 Subject: [PATCH] gamemode: Apply fixes from the unstable upstream --- packages/gamemode/default.nix | 21 +++++++++++++++++-- .../gamemode/preload-nix-workaround.patch | 12 +++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 packages/gamemode/preload-nix-workaround.patch diff --git a/packages/gamemode/default.nix b/packages/gamemode/default.nix index efb26b3..8e4c460 100644 --- a/packages/gamemode/default.nix +++ b/packages/gamemode/default.nix @@ -1,6 +1,6 @@ { stdenv, lib, meson, ninja, dbus, systemd, pkgconfig, cmake, inih, - fetchFromGitHub }: + fetchFromGitHub, fetchpatch }: stdenv.mkDerivation rec { pname = "gamemode"; @@ -13,6 +13,14 @@ stdenv.mkDerivation rec { sha256 = "17dck7dzkmzq52f2yrs930fdg2inr7nipvnwpd0jqrwgk2fhwk9z"; }; + patches = [ + (fetchpatch { + url = "https://github.com/FeralInteractive/gamemode/commit/be44b7091baa33be6dda60392e4c06c2f398ee72.patch"; + sha256 = "TlDUETs4+N3pvrVd0FQGlGmC+6ByhJ2E7gKXa7suBtE="; + }) + ./preload-nix-workaround.patch + ]; + nativeBuildInputs = [ meson ninja pkgconfig cmake ]; @@ -21,7 +29,16 @@ stdenv.mkDerivation rec { dbus systemd inih ]; - mesonFlags = [ "-Dwith-systemd-user-unit-dir=${placeholder "out"}/lib/systemd/user" ]; + mesonFlags = [ + "-Dwith-systemd-user-unit-dir=${placeholder "out"}/lib/systemd/user" + ]; + + postPatch = '' + substituteInPlace data/gamemoderun \ + --subst-var-by libraryPath ${lib.makeLibraryPath ([ + (placeholder "lib") + ])} + ''; meta = with lib; { description = "Optimise Linux system performance on demand"; diff --git a/packages/gamemode/preload-nix-workaround.patch b/packages/gamemode/preload-nix-workaround.patch new file mode 100644 index 0000000..06989ff --- /dev/null +++ b/packages/gamemode/preload-nix-workaround.patch @@ -0,0 +1,12 @@ +diff --git a/data/gamemoderun b/data/gamemoderun +index 573b3e4..6f2799e 100755 +--- a/data/gamemoderun ++++ b/data/gamemoderun +@@ -5,5 +5,6 @@ GAMEMODEAUTO_NAME="libgamemodeauto.so.0" + + # ld will find the right path to load the library, including for 32-bit apps. + LD_PRELOAD="${GAMEMODEAUTO_NAME}${LD_PRELOAD:+:$LD_PRELOAD}" ++LD_LIBRARY_PATH="@libraryPath@${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" + +-exec env LD_PRELOAD="${LD_PRELOAD}" $GAMEMODERUNEXEC "$@" ++exec env LD_PRELOAD="${LD_PRELOAD}" LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" $GAMEMODERUNEXEC "$@"