From 540abb07a63db6d31925936b2caee03bec43261e Mon Sep 17 00:00:00 2001 From: Kopatz <7265381+Kropatz@users.noreply.github.com> Date: Sun, 21 Jan 2024 21:09:53 +0100 Subject: [PATCH] add palworld --- flake.nix | 1 + modules/games/palworld.nix | 45 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 modules/games/palworld.nix diff --git a/flake.nix b/flake.nix index 4a79a62..74c623e 100644 --- a/flake.nix +++ b/flake.nix @@ -72,6 +72,7 @@ ./modules/netdata.nix ./modules/step-ca.nix ./modules/tmpfs.nix + ./modules/games/palworld.nix ./modules/logging.nix ### Hardware ### ./modules/hardware/ssd.nix diff --git a/modules/games/palworld.nix b/modules/games/palworld.nix new file mode 100644 index 0000000..597319d --- /dev/null +++ b/modules/games/palworld.nix @@ -0,0 +1,45 @@ +# valheim.nix +{config, pkgs, lib, ...}: let +in { + + networking.firewall.allowedUDPPorts = [ 8221 ]; #5349 ]; + users.users.palworld = { + isSystemUser = true; + # Valheim puts save data in the home directory. + home = "/var/lib/palworld"; + createHome = true; + homeMode = "750"; + group = "palworld"; + }; + + users.groups.palworld = {}; + + systemd.services.palworld = { + wantedBy = [ "multi-user.target" ]; + + wants = [ "network-online.target" ]; + after = [ "network-online.target" ]; + + preStart = '' + ${pkgs.steamcmd}/bin/steamcmd \ + +login anonymous \ + +force_install_dir /var/lib/palworld \ + +app_update 2394010 validate \ + +quit + ''; + script = "${pkgs.steam-run}/bin/steam-run /var/lib/palworld/Pal/Binaries/Linux/PalServer-Linux-Test"; + + serviceConfig = { + Nice = "-5"; + PrivateTmp = true; + Restart = "always"; + User = "palworld"; + WorkingDirectory = "~"; + }; + environment = { + # linux64 directory is required by Valheim. + LD_LIBRARY_PATH = "/var/lib/palworld/linux64:${pkgs.glibc}/lib"; + SteamAppId = "2394010"; + }; + }; +}