2024-09-11 22:15:18 -03:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
|
|
|
|
{
|
|
|
|
home.packages = with pkgs; [
|
|
|
|
openttd
|
|
|
|
];
|
|
|
|
|
|
|
|
systemd.user.services.openttd = {
|
|
|
|
Install.WantedBy = [ "default.target" ];
|
|
|
|
|
|
|
|
Unit.Description = "OpenTTD Tmux server";
|
|
|
|
|
|
|
|
Service = {
|
2024-12-08 19:54:38 -03:00
|
|
|
ExecStart = "${pkgs.tmux}/bin/tmux -L openttd new -s OpenTTD -d '${pkgs.openttd}/bin/openttd -g /home/wizardlink/.local/share/openttd/save/hyfy.sav -D'";
|
2024-11-30 13:35:53 -03:00
|
|
|
ExecStop = "${pkgs.tmux}/bin/tmux kill-session -t OpenTTD";
|
2024-09-11 22:15:18 -03:00
|
|
|
Restart = "on-failure";
|
|
|
|
Type = "forking";
|
|
|
|
};
|
|
|
|
};
|
2024-09-16 15:45:39 -03:00
|
|
|
|
|
|
|
systemd.user.services.openttd-rcon = {
|
|
|
|
Install.WantedBy = [ "default.target" ];
|
|
|
|
|
|
|
|
Unit = {
|
|
|
|
Description = "OpenTTD RCON Password set";
|
|
|
|
After = [ "openttd.service" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
Service = {
|
2024-12-08 19:54:38 -03:00
|
|
|
ExecStart = "${pkgs.tmux}/bin/tmux -L openttd send-keys -t OpenTTD 'rcon_pw aaaa' Enter";
|
2024-09-16 15:45:39 -03:00
|
|
|
Type = "oneshot";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.user.services.openttd-save = {
|
|
|
|
Install.WantedBy = [ "default.target" ];
|
|
|
|
|
|
|
|
Unit = {
|
|
|
|
Description = "OpenTTD RCON Password set";
|
|
|
|
After = [ "openttd.service" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
Service = {
|
2024-12-08 19:54:38 -03:00
|
|
|
ExecStart = "${pkgs.tmux}/bin/tmux -L openttd send-keys -t OpenTTD 'save hyfy' Enter";
|
2024-09-16 15:45:39 -03:00
|
|
|
Type = "simple";
|
|
|
|
Restart = "always";
|
|
|
|
RestartSec = "1800s";
|
|
|
|
};
|
|
|
|
};
|
2024-09-11 22:15:18 -03:00
|
|
|
}
|