-
Notifications
You must be signed in to change notification settings - Fork 44
/
default.nix
158 lines (140 loc) · 4.69 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
{
stdenv,
resholve,
writeText,
fetchFromGitHub,
python3,
steamdeck-hw-theme,
steamPackages,
bash,
coreutils,
dbus,
findutils,
galileo-mura,
gamescope,
gnugrep,
gnused,
gnutar,
ibus,
mangohud,
plasma5Packages,
powerbuttond,
procps,
steam_notif_daemon,
steamos-polkit-helpers,
systemd,
util-linux,
xbindkeys,
}:
let
gamescope-session-solution = {
scripts = [ "bin/gamescope-session" ];
interpreter = "${bash}/bin/bash";
inputs = [
coreutils
dbus
findutils
galileo-mura
gnugrep
gnused
gnutar
ibus
mangohud
plasma5Packages.kconfig
powerbuttond
procps
steam_notif_daemon
"${steamos-polkit-helpers}/bin/steamos-polkit-helpers"
steamPackages.steam-fhsenv
util-linux
xbindkeys
];
execer = [
"cannot:${ibus}/bin/ibus-daemon"
"cannot:${plasma5Packages.kconfig}/bin/kwriteconfig5"
"cannot:${steamos-polkit-helpers}/bin/steamos-polkit-helpers/steamos-poweroff-now"
"cannot:${steamos-polkit-helpers}/bin/steamos-polkit-helpers/steamos-reboot-now"
"cannot:${steamos-polkit-helpers}/bin/steamos-polkit-helpers/steamos-retrigger-automounts"
"cannot:${steamPackages.steam-fhsenv}/bin/steam"
"cannot:${util-linux}/bin/flock"
"cannot:${xbindkeys}/bin/xbindkeys"
];
fake = {
# we're using wrappers for these
external = [ "sudo" "gamescope" ];
source = [
"/etc/xdg/gamescope-session/environment"
];
};
fix = {
"/usr/bin/ibus-daemon" = true;
"/usr/bin/steamos-polkit-helpers/steamos-poweroff-now" = true;
"/usr/bin/steamos-polkit-helpers/steamos-reboot-now" = true;
"/usr/bin/steamos-polkit-helpers/steamos-retrigger-automounts" = true;
"/usr/lib/hwsupport/powerbuttond" = true;
};
keep = {
# if you've somehow managed to get devkit Steam on your NixOS,
# everything that happens beyond this point is entirely your fault
"$HOME/devkit-game/devkit-steam" = true;
"source:/etc/xdg/gamescope-session/environment" = true;
};
prologue = "${writeText "gamescope-session-prologue" ''
# Don't resholve gamescope so we can use the cap_sys_nice wrapper when available
export PATH=/run/wrappers/bin:${gamescope}/bin:$PATH
# Make gamescope discover the Steam cursor theme
export XCURSOR_PATH=${plasma5Packages.breeze-qt5}/share/icons:${steamdeck-hw-theme}/share/icons
''}";
};
start-gamescope-session-solution = {
scripts = [ "bin/start-gamescope-session" ];
interpreter = "${bash}/bin/bash";
inputs = [ coreutils dbus gnugrep systemd ];
execer = [
"cannot:${systemd}/bin/systemctl"
];
# Import user PATH into the environment to be able to start third party tools
prologue = "${writeText "start-gamescope-session-prologue" ''
${systemd}/bin/systemctl --user import-environment PATH
''}";
};
in stdenv.mkDerivation(finalAttrs: {
pname = "gamescope-session";
version = "3.14.18-2";
src = fetchFromGitHub {
owner = "Jovian-Experiments";
repo = "PKGBUILDs-mirror";
rev = "jupiter-main/gamescope-${finalAttrs.version}";
hash = "sha256-kyNPcThRxfsG53hQErfBtphdQi4K0Oo9m5aE3DeQtas=";
};
patches = [
./0001-gamescope-session-Add-xdg-environment-overrides.patch
];
postPatch = ''
patchShebangs steam-http-loader
substituteInPlace gamescope-session \
--replace /usr/share ${steamdeck-hw-theme}/share \
--replace /usr/lib/steam ${steamPackages.steam}/lib/steam
substituteInPlace gamescope-session.service \
--replace /usr/bin $out/bin
'';
nativeBuildInputs = [python3];
# Largely copied from upstream
installPhase = ''
runHook preInstall
install -D -m 755 gamescope-session $out/bin/gamescope-session
install -D -m 755 start-gamescope-session $out/bin/start-gamescope-session
install -D -m 644 gamescope-wayland.desktop $out/share/wayland-sessions/gamescope-wayland.desktop
# url handling
install -D -m 644 steam_http_loader.desktop $out/share/applications/steam_http_loader.desktop
install -D -m 644 gamescope-mimeapps.list $out/share/applications/gamescope-mimeapps.list
install -D -m 755 steam-http-loader $out/bin/steam-http-loader
install -D -m 644 gamescope-session.service $out/share/systemd/user/gamescope-session.service
# portals
install -D -m 644 gamescope-portals.conf $out/share/xdg-desktop-portal/gamescope-portals.conf
${resholve.phraseSolution "gamescope-session" gamescope-session-solution}
${resholve.phraseSolution "start-gamescope-session" start-gamescope-session-solution}
runHook postInstall
'';
passthru.providedSessions = ["gamescope-wayland"];
})