refactor(nixos): rely on SteamCMD app metadata
This commit is contained in:
@@ -71,7 +71,6 @@
|
|||||||
steamDir = "/pikachu/data/steamcmd";
|
steamDir = "/pikachu/data/steamcmd";
|
||||||
serviceName = "valheim";
|
serviceName = "valheim";
|
||||||
appId = 896660;
|
appId = 896660;
|
||||||
runtimeAppId = 892970;
|
|
||||||
installDir = "/pikachu/data/servers/valheim/main";
|
installDir = "/pikachu/data/servers/valheim/main";
|
||||||
stateDir = "/pikachu/media/games/servers/valheim/main";
|
stateDir = "/pikachu/media/games/servers/valheim/main";
|
||||||
executable = "./valheim_server.x86_64";
|
executable = "./valheim_server.x86_64";
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
let
|
let
|
||||||
cfg = config.modules.services.steamcmd;
|
cfg = config.modules.services.steamcmd;
|
||||||
|
|
||||||
runtimeAppId = if cfg.runtimeAppId == null then cfg.appId else cfg.runtimeAppId;
|
|
||||||
libraryPath = lib.concatStringsSep ":" cfg.libraryDirs;
|
libraryPath = lib.concatStringsSep ":" cfg.libraryDirs;
|
||||||
|
|
||||||
prepareScript = pkgs.writeShellScript "steamcmd-${cfg.serviceName}-prepare" ''
|
prepareScript = pkgs.writeShellScript "steamcmd-${cfg.serviceName}-prepare" ''
|
||||||
@@ -37,7 +36,6 @@ let
|
|||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
cd ${lib.escapeShellArg cfg.installDir}
|
cd ${lib.escapeShellArg cfg.installDir}
|
||||||
export SteamAppId=${lib.escapeShellArg (toString runtimeAppId)}
|
|
||||||
${lib.optionalString (cfg.libraryDirs != [ ]) ''export LD_LIBRARY_PATH=${lib.escapeShellArg libraryPath}:''${LD_LIBRARY_PATH-}''}
|
${lib.optionalString (cfg.libraryDirs != [ ]) ''export LD_LIBRARY_PATH=${lib.escapeShellArg libraryPath}:''${LD_LIBRARY_PATH-}''}
|
||||||
exec ${lib.getExe pkgs.steam-run} ${lib.escapeShellArg cfg.executable} ${lib.escapeShellArgs cfg.arguments}
|
exec ${lib.getExe pkgs.steam-run} ${lib.escapeShellArg cfg.executable} ${lib.escapeShellArgs cfg.arguments}
|
||||||
'';
|
'';
|
||||||
@@ -85,13 +83,6 @@ in
|
|||||||
description = "Steam app ID for the dedicated server package.";
|
description = "Steam app ID for the dedicated server package.";
|
||||||
};
|
};
|
||||||
|
|
||||||
runtimeAppId = lib.mkOption {
|
|
||||||
type = lib.types.nullOr lib.types.ints.positive;
|
|
||||||
default = null;
|
|
||||||
example = 892970;
|
|
||||||
description = "Steam app ID exposed to the running server through SteamAppId. Defaults to appId.";
|
|
||||||
};
|
|
||||||
|
|
||||||
installDir = lib.mkOption {
|
installDir = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
example = "/data/servers/valheim/main";
|
example = "/data/servers/valheim/main";
|
||||||
|
|||||||
Reference in New Issue
Block a user