This commit is contained in:
@@ -16,6 +16,16 @@
|
|||||||
name: value:
|
name: value:
|
||||||
"${name}=${if builtins.isBool value then lib.boolToString value else toString value}"
|
"${name}=${if builtins.isBool value then lib.boolToString value else toString value}"
|
||||||
) serverProperties;
|
) 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";
|
adminPasswordFile = "${cfg.dataDir}/admin-password";
|
||||||
startScript = pkgs.writeShellScript "project-zomboid-start" ''
|
startScript = pkgs.writeShellScript "project-zomboid-start" ''
|
||||||
admin_password=$(${pkgs.coreutils}/bin/cat ${lib.escapeShellArg adminPasswordFile})
|
admin_password=$(${pkgs.coreutils}/bin/cat ${lib.escapeShellArg adminPasswordFile})
|
||||||
@@ -100,6 +110,18 @@ in {
|
|||||||
description = "Runtime file with additional INI values, suitable for secrets.";
|
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 {
|
openFirewall = lib.mkOption {
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
@@ -151,6 +173,15 @@ in {
|
|||||||
${lib.optionalString (cfg.serverPropertiesFile != null)
|
${lib.optionalString (cfg.serverPropertiesFile != null)
|
||||||
"${pkgs.coreutils}/bin/cat ${lib.escapeShellArg cfg.serverPropertiesFile};"}
|
"${pkgs.coreutils}/bin/cat ${lib.escapeShellArg cfg.serverPropertiesFile};"}
|
||||||
} > ${lib.escapeShellArg "${cfg.dataDir}/Server/${cfg.serverName}.ini"}
|
} > ${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 = {
|
serviceConfig = {
|
||||||
@@ -159,7 +190,7 @@ in {
|
|||||||
WorkingDirectory = cfg.dataDir;
|
WorkingDirectory = cfg.dataDir;
|
||||||
Environment = [
|
Environment = [
|
||||||
"HOME=${cfg.dataDir}"
|
"HOME=${cfg.dataDir}"
|
||||||
"SteamAppId=380870"
|
"SteamAppId=108600"
|
||||||
];
|
];
|
||||||
ExecStart = startScript;
|
ExecStart = startScript;
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
|
|||||||
@@ -95,8 +95,65 @@ in {
|
|||||||
enable = true;
|
enable = true;
|
||||||
memory = "3g";
|
memory = "3g";
|
||||||
serverName = "servertest";
|
serverName = "servertest";
|
||||||
workshopItems = [ ];
|
serverProperties = {
|
||||||
mods = [ ];
|
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 = {
|
services.p4d = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user