push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,117 @@
{
lib,
stdenv,
fetchFromGitHub,
libgamemode32,
makeWrapper,
meson,
ninja,
pkg-config,
dbus,
inih,
systemd,
appstream,
findutils,
gawk,
procps,
nix-update-script,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "gamemode";
version = "1.8.2";
src = fetchFromGitHub {
owner = "FeralInteractive";
repo = "gamemode";
tag = finalAttrs.version;
hash = "sha256-V0rewbSVOGFqJqXyCz4jXpuDM0EfjdkpGPl+WdDwI5I=";
};
outputs = [
"out"
"dev"
"lib"
"man"
];
patches = [
# Add @libraryPath@ template variable to fix loading the PRELOAD library
./preload-nix-workaround.patch
];
postPatch = ''
substituteInPlace data/gamemoderun \
--subst-var-by libraryPath ${
lib.makeLibraryPath (
[
(placeholder "lib")
]
++ lib.optionals (stdenv.hostPlatform.system == "x86_64-linux") [
# Support wrapping 32bit applications on a 64bit linux system
libgamemode32
]
)
}
'';
nativeBuildInputs = [
makeWrapper
meson
ninja
pkg-config
];
buildInputs = [
dbus
inih
systemd
];
mesonFlags = [
"-Dwith-pam-limits-dir=etc/security/limits.d"
"-Dwith-systemd-user-unit-dir=lib/systemd/user"
"-Dwith-systemd-group-dir=lib/sysusers.d"
# The meson builder installs internal executables to $lib/lib by
# default, but they should be installed to "$out". It's also more
# appropriate to install these executables under a libexec
# directory instead of lib.
"--libexecdir=libexec"
];
doCheck = true;
nativeCheckInputs = [
appstream
];
postFixup = ''
# Add $lib/lib to gamemoded & gamemode-simulate-game's rpath since
# they use dlopen to load libgamemode. Can't use makeWrapper since
# it would break the security wrapper in the NixOS module.
for bin in "$out/bin/gamemoded" "$out/bin/gamemode-simulate-game"; do
patchelf --set-rpath "$lib/lib:$(patchelf --print-rpath "$bin")" "$bin"
done
wrapProgram "$out/bin/gamemodelist" \
--prefix PATH : ${
lib.makeBinPath [
findutils
gawk
procps
]
}
'';
passthru.updateScript = nix-update-script { };
meta = with lib; {
description = "Optimise Linux system performance on demand";
homepage = "https://feralinteractive.github.io/gamemode";
changelog = "https://github.com/FeralInteractive/gamemode/blob/${finalAttrs.version}/CHANGELOG.md";
license = licenses.bsd3;
maintainers = with maintainers; [ kira-bruneau ];
platforms = platforms.linux;
mainProgram = "gamemoderun"; # Requires NixOS module to run
};
})

View File

@@ -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 "$@"