From 2b4e66a75caae3ea86a8dd8b64cdda026b3e428c Mon Sep 17 00:00:00 2001 From: alexion Date: Thu, 15 Oct 2026 14:18:27 -0400 Subject: [PATCH] fix(palworld): configure the RCON port --- .../nixos/modules/services/games/palworld.nix | 27 ++++++++++--------- .../nixos/modules/services/games/valheim.nix | 2 +- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/configs/nixos/modules/services/games/palworld.nix b/configs/nixos/modules/services/games/palworld.nix index 3c04327..9a3abee 100644 --- a/configs/nixos/modules/services/games/palworld.nix +++ b/configs/nixos/modules/services/games/palworld.nix @@ -92,33 +92,33 @@ startScript = pkgs.writeShellScript "palworld-start" '' set -eu - ${pkgs.coreutils}/bin/install -d \ + ${lib.getExe' pkgs.coreutils "install"} -d \ -m 0770 \ ${lib.escapeShellArg service.stateDir} \ ${lib.escapeShellArg (builtins.dirOf savedDir)} if [ -L ${lib.escapeShellArg savedDir} ]; then - current_target="$(${pkgs.coreutils}/bin/readlink ${lib.escapeShellArg savedDir})" + current_target="$(${lib.getExe' pkgs.coreutils "readlink"} ${lib.escapeShellArg savedDir})" if [ "$current_target" != ${lib.escapeShellArg service.stateDir} ]; then - ${pkgs.coreutils}/bin/rm ${lib.escapeShellArg savedDir} + ${lib.getExe' pkgs.coreutils "rm"} ${lib.escapeShellArg savedDir} fi fi if [ -d ${lib.escapeShellArg savedDir} ] && [ ! -L ${lib.escapeShellArg savedDir} ]; then - if ${pkgs.findutils}/bin/find ${lib.escapeShellArg service.stateDir} -mindepth 1 -maxdepth 1 | ${pkgs.gnugrep}/bin/grep -q .; then - ${pkgs.coreutils}/bin/rm -rf ${lib.escapeShellArg savedDir} + if ${lib.getExe' pkgs.findutils "find"} ${lib.escapeShellArg service.stateDir} -mindepth 1 -maxdepth 1 | ${lib.getExe' pkgs.gnugrep "grep"} -q .; then + ${lib.getExe' pkgs.coreutils "rm"} -rf ${lib.escapeShellArg savedDir} else - ${pkgs.coreutils}/bin/cp -a ${lib.escapeShellArg savedDir}/. ${lib.escapeShellArg service.stateDir}/ - ${pkgs.coreutils}/bin/rm -rf ${lib.escapeShellArg savedDir} + ${lib.getExe' pkgs.coreutils "cp"} -a ${lib.escapeShellArg savedDir}/. ${lib.escapeShellArg service.stateDir}/ + ${lib.getExe' pkgs.coreutils "rm"} -rf ${lib.escapeShellArg savedDir} fi fi if [ ! -e ${lib.escapeShellArg savedDir} ]; then - ${pkgs.coreutils}/bin/ln -s ${lib.escapeShellArg service.stateDir} ${lib.escapeShellArg savedDir} + ${lib.getExe' pkgs.coreutils "ln"} -s ${lib.escapeShellArg service.stateDir} ${lib.escapeShellArg savedDir} fi - password="$(${pkgs.coreutils}/bin/tr -d '\n' < ${lib.escapeShellArg service.passwordFile})" - admin_password="$(${pkgs.coreutils}/bin/tr -d '\n' < ${lib.escapeShellArg service.adminPasswordFile})" + password="$(${lib.getExe' pkgs.coreutils "tr"} -d '\n' < ${lib.escapeShellArg service.passwordFile})" + admin_password="$(${lib.getExe' pkgs.coreutils "tr"} -d '\n' < ${lib.escapeShellArg service.adminPasswordFile})" exec ./PalServer.sh \ "$@" \ @@ -145,9 +145,12 @@ ] ++ lib.optional service.publicLobby "-publiclobby" ++ lib.optionals (service.publicIP != null) [ "-publicip=${service.publicIP}" ] - ++ lib.optional service.rcon.enable "-rcon"; + ++ lib.optionals service.rcon.enable [ + "-rcon" + "-RCONPort=${toString service.rcon.port}" + ]; udpPorts = [ service.port ]; - tcpPorts = [ service.port ]; + tcpPorts = lib.optional service.rcon.enable service.rcon.port; }; } ); diff --git a/configs/nixos/modules/services/games/valheim.nix b/configs/nixos/modules/services/games/valheim.nix index a38b52d..25ec803 100644 --- a/configs/nixos/modules/services/games/valheim.nix +++ b/configs/nixos/modules/services/games/valheim.nix @@ -51,7 +51,7 @@ startScript = pkgs.writeShellScript "valheim-start" '' set -eu - password="$(${pkgs.coreutils}/bin/tr -d '\n' < ${lib.escapeShellArg service.passwordFile})" + password="$(${lib.getExe' pkgs.coreutils "tr"} -d '\n' < ${lib.escapeShellArg service.passwordFile})" exec ./valheim_server.x86_64 "$@" -password "$password" ''; in