19 stdenv.mkDerivation (finalAttrs: {
23 src = fetchFromGitHub {
24 owner = "FeralInteractive";
26 rev = "refs/tags/${finalAttrs.version}";
27 hash = "sha256-JkDFhFLUHlgD6RKxlxMjrSF2zQ4AWmRUQMLbWYwIZmg=";
30 outputs = [ "out" "dev" "lib" "man" ];
33 # Add @libraryPath@ template variable to fix loading the PRELOAD library
34 ./preload-nix-workaround.patch
38 substituteInPlace data/gamemoderun \
39 --subst-var-by libraryPath ${lib.makeLibraryPath ([
41 ] ++ lib.optionals (stdenv.hostPlatform.system == "x86_64-linux") [
42 # Support wrapping 32bit applications on a 64bit linux system
61 "-Dwith-pam-limits-dir=etc/security/limits.d"
62 "-Dwith-systemd-user-unit-dir=lib/systemd/user"
63 "-Dwith-systemd-group-dir=lib/sysusers.d"
65 # The meson builder installs internal executables to $lib/lib by
66 # default, but they should be installed to "$out". It's also more
67 # appropriate to install these executables under a libexec
68 # directory instead of lib.
69 "--libexecdir=libexec"
78 # Add $lib/lib to gamemoded & gamemode-simulate-game's rpath since
79 # they use dlopen to load libgamemode. Can't use makeWrapper since
80 # it would break the security wrapper in the NixOS module.
81 for bin in "$out/bin/gamemoded" "$out/bin/gamemode-simulate-game"; do
82 patchelf --set-rpath "$lib/lib:$(patchelf --print-rpath "$bin")" "$bin"
85 wrapProgram "$out/bin/gamemodelist" \
86 --prefix PATH : ${lib.makeBinPath [
93 passthru.updateScript = nix-update-script { };
96 description = "Optimise Linux system performance on demand";
97 homepage = "https://feralinteractive.github.io/gamemode";
98 changelog = "https://github.com/FeralInteractive/gamemode/blob/${finalAttrs.version}/CHANGELOG.md";
99 license = licenses.bsd3;
100 maintainers = with maintainers; [ kira-bruneau ];
101 platforms = platforms.linux;
102 mainProgram = "gamemoderun"; # Requires NixOS module to run