From 77663c229f79ebbb8912b2536e6068c6146abe50 Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Wed, 11 Sep 2024 22:15:18 -0300 Subject: [PATCH] openttd: init service --- home-manager.nix | 2 ++ nixos.nix | 2 ++ services/openttd.nix | 23 +++++++++++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 services/openttd.nix diff --git a/home-manager.nix b/home-manager.nix index b741a7d..7550883 100644 --- a/home-manager.nix +++ b/home-manager.nix @@ -18,6 +18,7 @@ ./programs/spotify ./programs/tmux ./programs/waybar.nix + ./services/openttd.nix myneovim.homeManagerModules.default ]; @@ -110,6 +111,7 @@ winetricks # Games + openttd prismlauncher shattered-pixel-dungeon xonotic diff --git a/nixos.nix b/nixos.nix index 975db1d..9a435dd 100644 --- a/nixos.nix +++ b/nixos.nix @@ -127,6 +127,7 @@ in 443 # SSL 6567 # Mindustry 80 # HTTP + 3979 # OpenTTD ]; allowedUDPPorts = [ @@ -135,6 +136,7 @@ in 28910 # Heretic II 6567 # Mindustry 8211 # Palworld + 3979 # OpenTTD ]; allowedTCPPortRanges = [ diff --git a/services/openttd.nix b/services/openttd.nix new file mode 100644 index 0000000..11ed391 --- /dev/null +++ b/services/openttd.nix @@ -0,0 +1,23 @@ +{ + pkgs, + ... +}: + +{ + home.packages = with pkgs; [ + openttd + ]; + + systemd.user.services.openttd = { + Install.WantedBy = [ "default.target" ]; + + Unit.Description = "OpenTTD Tmux server"; + + Service = { + ExecStart = "${pkgs.tmux}/bin/tmux new -s OpenTTD -d '${pkgs.openttd}/bin/openttd -D'"; + ExecStop = "${pkgs.tmux}/bin/tmux kill-server"; + Restart = "on-failure"; + Type = "forking"; + }; + }; +}