{ stdenv, lib, meson, ninja, dbus, systemd, pkgconfig, cmake, inih, fetchFromGitHub, fetchpatch }: stdenv.mkDerivation rec { pname = "gamemode"; version = "1.6.1"; src = fetchFromGitHub { owner = "FeralInteractive"; repo = pname; rev = version; 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 ]; buildInputs = [ dbus systemd inih ]; 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"; homepage = "https://github.com/FeralInteractive/gamemode"; license = licenses.bsd3; maintainers = [ ]; platforms = platforms.linux; }; }