tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
nixos/terraria: Wait for daemon to stop
Janne Heß
7 years ago
943786ec
f0d6e22b
+13
-3
1 changed file
expand all
collapse all
unified
split
nixos
modules
services
games
terraria.nix
+13
-3
nixos/modules/services/games/terraria.nix
···
18
18
(boolFlag "secure" cfg.secure)
19
19
(boolFlag "noupnp" cfg.noUPnP)
20
20
];
21
21
+
stopScript = pkgs.writeScript "terraria-stop" ''
22
22
+
#!${pkgs.runtimeShell}
23
23
+
24
24
+
if ! [ -d "/proc/$1" ]; then
25
25
+
exit 0
26
26
+
fi
27
27
+
28
28
+
${getBin pkgs.tmux}/bin/tmux -S /var/lib/terraria/terraria.sock send-keys Enter exit Enter
29
29
+
${getBin pkgs.coreutils}/bin/tail --pid="$1" -f /dev/null
30
30
+
'';
21
31
in
22
32
{
23
33
options = {
···
124
134
125
135
serviceConfig = {
126
136
User = "terraria";
127
127
-
Type = "oneshot";
128
128
-
RemainAfterExit = true;
137
137
+
Type = "forking";
138
138
+
GuessMainPID = true;
129
139
ExecStart = "${getBin pkgs.tmux}/bin/tmux -S /var/lib/terraria/terraria.sock new -d ${pkgs.terraria-server}/bin/TerrariaServer ${concatStringsSep " " flags}";
130
130
-
ExecStop = "${getBin pkgs.tmux}/bin/tmux -S /var/lib/terraria/terraria.sock send-keys Enter \"exit\" Enter";
140
140
+
ExecStop = "${stopScript} $MAINPID";
131
141
};
132
142
133
143
postStart = ''