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