lol

gamemode: init at 1.6.1

+121
+105
pkgs/tools/games/gamemode/default.nix
··· 1 + { lib 2 + , stdenv 3 + , fetchFromGitHub 4 + , fetchpatch 5 + , libgamemode32 6 + , meson 7 + , ninja 8 + , pkg-config 9 + , dbus 10 + , inih 11 + , systemd 12 + , appstream 13 + }: 14 + 15 + stdenv.mkDerivation rec { 16 + pname = "gamemode"; 17 + version = "1.6.1"; 18 + 19 + src = fetchFromGitHub { 20 + owner = "FeralInteractive"; 21 + repo = pname; 22 + rev = version; 23 + fetchSubmodules = true; 24 + sha256 = "sha256-P00OnZiPZyxBu9zuG+3JNorXHBhJZy+cKPjX+duZrJ0="; 25 + }; 26 + 27 + outputs = [ "out" "dev" "lib" "man" "static" ]; 28 + 29 + patches = [ 30 + # Run executables from PATH instead of /usr/bin 31 + # See https://github.com/FeralInteractive/gamemode/pull/323 32 + (fetchpatch { 33 + url = "https://github.com/FeralInteractive/gamemode/commit/be44b7091baa33be6dda60392e4c06c2f398ee72.patch"; 34 + sha256 = "TlDUETs4+N3pvrVd0FQGlGmC+6ByhJ2E7gKXa7suBtE="; 35 + }) 36 + 37 + # Fix loading shipped config when using a prefix other than /usr 38 + # See https://github.com/FeralInteractive/gamemode/pull/324 39 + (fetchpatch { 40 + url = "https://github.com/FeralInteractive/gamemode/commit/b29aa903ce5acc9141cfd3960c98ccb047eca872.patch"; 41 + sha256 = "LwBzBJQ7dfm2mFVSOSPjJP+skgV5N6h77i66L1Sq+ZM="; 42 + }) 43 + 44 + # Add @libraryPath@ template variable to fix loading the PRELOAD library 45 + ./preload-nix-workaround.patch 46 + ]; 47 + 48 + postPatch = '' 49 + substituteInPlace data/gamemoderun \ 50 + --subst-var-by libraryPath ${lib.makeLibraryPath ([ 51 + (placeholder "lib") 52 + ] ++ lib.optionals (stdenv.hostPlatform.system == "x86_64-linux") [ 53 + # Support wrapping 32bit applications on a 64bit linux system 54 + libgamemode32 55 + ])} 56 + ''; 57 + 58 + nativeBuildInputs = [ 59 + meson 60 + ninja 61 + pkg-config 62 + ]; 63 + 64 + buildInputs = [ 65 + dbus 66 + inih 67 + systemd 68 + ]; 69 + 70 + mesonFlags = [ 71 + # libexec is just a way to package binaries without including them 72 + # in PATH. It doesn't make sense to install them to $lib 73 + # (the default behaviour in the meson hook). 74 + "--libexecdir=${placeholder "out"}/libexec" 75 + 76 + "-Dwith-systemd-user-unit-dir=lib/systemd/user" 77 + ]; 78 + 79 + doCheck = true; 80 + checkInputs = [ 81 + appstream 82 + ]; 83 + 84 + # Move static libraries to $static so $lib only contains dynamic libraries. 85 + postInstall = '' 86 + moveToOutput lib/*.a "$static" 87 + ''; 88 + 89 + # Add $lib/lib to gamemoded & gamemode-simulate-game's rpath since 90 + # they use dlopen to load libgamemode. Can't use makeWrapper since 91 + # it would break the security wrapper in the NixOS module. 92 + postFixup = '' 93 + for bin in "$out/bin/gamemoded" "$out/bin/gamemode-simulate-game"; do 94 + patchelf --set-rpath "$lib/lib:$(patchelf --print-rpath "$bin")" "$bin" 95 + done 96 + ''; 97 + 98 + meta = with lib; { 99 + description = "Optimise Linux system performance on demand"; 100 + homepage = "https://github.com/FeralInteractive/GameMode"; 101 + license = licenses.bsd3; 102 + maintainers = with maintainers; [ kira-bruneau ]; 103 + platforms = platforms.linux; 104 + }; 105 + }
+12
pkgs/tools/games/gamemode/preload-nix-workaround.patch
··· 1 + diff --git a/data/gamemoderun b/data/gamemoderun 2 + index 573b3e4..6f2799e 100755 3 + --- a/data/gamemoderun 4 + +++ b/data/gamemoderun 5 + @@ -5,5 +5,6 @@ GAMEMODEAUTO_NAME="libgamemodeauto.so.0" 6 + 7 + # ld will find the right path to load the library, including for 32-bit apps. 8 + LD_PRELOAD="${GAMEMODEAUTO_NAME}${LD_PRELOAD:+:$LD_PRELOAD}" 9 + +LD_LIBRARY_PATH="@libraryPath@${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" 10 + 11 + -exec env LD_PRELOAD="${LD_PRELOAD}" $GAMEMODERUNEXEC "$@" 12 + +exec env LD_PRELOAD="${LD_PRELOAD}" LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" $GAMEMODERUNEXEC "$@"
+4
pkgs/top-level/all-packages.nix
··· 854 854 855 855 amidst = callPackage ../tools/games/amidst { }; 856 856 857 + gamemode = callPackage ../tools/games/gamemode { 858 + libgamemode32 = pkgsi686Linux.gamemode.lib; 859 + }; 860 + 857 861 gfshare = callPackage ../tools/security/gfshare { }; 858 862 859 863 gobgp = callPackage ../tools/networking/gobgp { };