fix: project zomboid module
runner nix smoke / nix label and flake smoke (push) Failing after 1m24s

This commit is contained in:
2026-09-12 21:56:31 +00:00
parent fce9ae07be
commit 66a502b1dd
2 changed files with 91 additions and 3 deletions
@@ -16,6 +16,16 @@
name: value:
"${name}=${if builtins.isBool value then lib.boolToString value else toString value}"
) serverProperties;
luaValue = value:
if builtins.isBool value then
lib.boolToString value
else if builtins.isInt value then
toString value
else
"\"${lib.replaceStrings [ "\\" "\"" "\n" "\r" ] [ "\\\\" "\\\"" "\\n" "\\r" ] value}\"";
sandboxConfigLines = lib.mapAttrsToList (
name: value: "${name} = ${luaValue value},"
) cfg.sandboxProperties;
adminPasswordFile = "${cfg.dataDir}/admin-password";
startScript = pkgs.writeShellScript "project-zomboid-start" ''
admin_password=$(${pkgs.coreutils}/bin/cat ${lib.escapeShellArg adminPasswordFile})
@@ -100,6 +110,18 @@ in {
description = "Runtime file with additional INI values, suitable for secrets.";
};
sandboxProperties = lib.mkOption {
type = lib.types.attrsOf (
lib.types.oneOf [
lib.types.bool
lib.types.int
lib.types.str
]
);
default = { };
description = "Values for the Project Zomboid SandboxVars.lua file.";
};
openFirewall = lib.mkOption {
type = lib.types.bool;
default = true;
@@ -151,6 +173,15 @@ in {
${lib.optionalString (cfg.serverPropertiesFile != null)
"${pkgs.coreutils}/bin/cat ${lib.escapeShellArg cfg.serverPropertiesFile};"}
} > ${lib.escapeShellArg "${cfg.dataDir}/Server/${cfg.serverName}.ini"}
${lib.optionalString (cfg.sandboxProperties != { }) ''
{
${pkgs.coreutils}/bin/printf '%s\n' 'SandboxVars = {';
${lib.concatMapStringsSep "\n " (line:
"${pkgs.coreutils}/bin/printf '%s\\n' ${lib.escapeShellArg line};"
) sandboxConfigLines}
${pkgs.coreutils}/bin/printf '%s\n' '};';
} > ${lib.escapeShellArg "${cfg.dataDir}/Server/${cfg.serverName}_SandboxVars.lua"}
''}
'';
serviceConfig = {
@@ -159,7 +190,7 @@ in {
WorkingDirectory = cfg.dataDir;
Environment = [
"HOME=${cfg.dataDir}"
"SteamAppId=380870"
"SteamAppId=108600"
];
ExecStart = startScript;
Restart = "on-failure";
+59 -2
View File
@@ -95,8 +95,65 @@ in {
enable = true;
memory = "3g";
serverName = "servertest";
workshopItems = [ ];
mods = [ ];
serverProperties = {
Map = "map_distanciado;Muldraugh, KY";
DoLuaChecksum = false;
Public = true;
};
sandboxProperties = {
StartMonth = 12;
StartDay = 1;
};
workshopItems = [
"2210760610" # Cryogenic Winter +Easy/Hard Modes
"3676456221" # Lua Digital Watch Framework
"3600401184" # Realistic Temperature Mod
"3387824513" # Material Weight Reducer
"3543229299" # Project RV Interior
"3387539308" # Auto Mechanics
"3402491515" # Tsar's Common Library B42
"3403490889" # Standardized Vehicle Upgrades 3 - Core
"3520758551" # More Car Features + Spawn Zones Expansion
"3110911330" # '87 Ford B700/F700 Trucks
"3413150945" # More Damaged Objects
"3554424111" # U.S. M998 Humvee
"2705406713" # Military Tool Kit
"3512708849" # Shotgun Trajectory
"3401576145" # Firearm Models: Redux
"3401134276" # Vanilla Gear Expanded
"3394044313" # Buttstroke / Gun Stock Attack
"2956146279" # Rain Cleans Blood
"3693258802" # Tactical Hold
"3394588830" # Simple Flashlight on Belt
"2684285534" # Spongie's Clothing
"2812326159" # Spongie's Open Jackets
];
mods = [
"\\PROJECTRVInterior42"
"\\Military_Tool_Kit"
"\\CryogenicWinter2NormalMode"
"\\LuaDigitalWatchUI"
"\\RC_RealisticColdMod"
"\\Material Weight Reducer"
"\\Ammunition Weight Reducer"
"\\AutoMechanics"
"\\tsarslib"
"\\StandardizedVehicleUpgrades3Core"
"\\WayMoreCars"
"\\87fordB700"
"\\MoreDamagedObjects"
"\\U.S. M998 Humvee by Papa_Chad"
"\\ShotgunTrajectory"
"\\FMR"
"\\VanillaGearExpanded"
"\\Buttstroke"
"\\RainCleansBlood"
"\\TacHold Complete"
"\\LightOnBelt"
"\\SpnCloth"
"\\SpnOpenClothBase"
"\\SpnOpenCloth"
];
};
services.p4d = {
enable = true;