diff --git a/.sops.yaml b/.sops.yaml index 78b257db..d4203f8f 100644 --- a/.sops.yaml +++ b/.sops.yaml @@ -12,6 +12,13 @@ keys: - &umbriel-bfs age1jxntjca8q2vxvf2jaal4xyvm2ae6sh62fhv897694kuzawfrk5asj00zdt creation_rules: + - path_regex: sus/neuro-project-zomboid.yaml$ + key_groups: + - age: + - *yukkop + - *neuro-server + - age1ev53mzse6rg4ffwtcwtq4e93c7x7s4d0eyu89jrsahrke8r4yamsseu8h4 + - path_regex: sus/neuro-minecraft.yaml$ key_groups: - age: diff --git a/docs/project-zomboid-backups.md b/docs/project-zomboid-backups.md index 8f705cb3..e0821a6e 100644 --- a/docs/project-zomboid-backups.md +++ b/docs/project-zomboid-backups.md @@ -7,7 +7,8 @@ or pausing the server. The default schedule is every 30 minutes. Each run: period; 2. rsyncs `Zomboid/Saves/Multiplayer/` and non-secret server settings (`SandboxVars`, spawn-points, and spawn-regions) from - `Zomboid/Server` into a private staging tree; + `Zomboid/Server`, together with local `Zomboid/mods`, into a private staging + tree; 3. waits five seconds and repeats the rsync to narrow the live-write window; 4. publishes a timestamped `tar.zst` archive; and 5. uploads it to S3 when enabled, then applies local retention. @@ -33,9 +34,9 @@ host-generated password files, or the S3 credentials file. The server INI is generated again during service startup; provision secret-backed values separately after a restore. -## hectic-lab +## neuro -hectic-lab runs the timer every 30 minutes and stores timestamped backups in +neuro runs the timer every 30 minutes and stores timestamped backups in S3 for 14 days. It keeps no regular timestamped backup archives locally: ```text @@ -83,7 +84,7 @@ available; it remains the stronger recovery and cleanup control. Restoring must be done while the server is stopped so it cannot modify files during extraction: -On hectic-lab, regular timestamped archives are retained only in S3. With +On neuro, regular timestamped archives are retained only in S3. With valid S3 credentials, download the chosen archive before restoring it: ```sh diff --git a/docs/project-zomboid-neuro.md b/docs/project-zomboid-neuro.md new file mode 100644 index 00000000..d5ac4d9b --- /dev/null +++ b/docs/project-zomboid-neuro.md @@ -0,0 +1,92 @@ +# Project Zomboid on neuro + +The native NixOS service is `project-zomboid.service`. Its configuration lives +in `nixos/system/neuro/project-zomboid.nix`; the effective non-secret INI and +sandbox settings are captured in the adjacent JSON files. Runtime state lives +in `/var/lib/project-zomboid`, owned by UID 988 and GID 985. + +Players connect to `95.31.254.84:36565`. The server uses UDP 36565 for +discovery and UDP 36566 for game traffic. Existing MikroTik rules forward +both ports unchanged to `192.168.88.10`. RCON TCP 27015 is not forwarded. + +The port change was deployed through NixOS after a graceful save and shutdown. +External A2S_INFO on UDP 36565 succeeded; independent external probes reached +both 36565 and 36566. Minecraft, BlueMap and nginx retained their processes. + +The migrated installation is Build 42.21.0, Steam build 25485538. +`updateOnStart = false` prevents an incidental SteamCMD upgrade. A deliberate +version upgrade must include a stopped-server backup and client compatibility +check before changing this setting. + +The installed LuaDigitalWatchUI 1.0 and RC_RealisticColdMod 2.2.0 snapshots +are copied into `Zomboid/mods/LuaDigitalWatch` and +`Zomboid/mods/RealisticTemperature`. Their `common` and `42` directories remain +intact. Their mod IDs remain enabled; `WorkshopItems` is empty because the +game otherwise automatically replaces the temperature mod with a newer +published version on startup. Clients need matching mod files; automatic +Workshop provisioning is no longer advertised by this server. Preserve these +local copies during updates and restores. + +The save remains `servertest`, with the original world identities, account +database, player database, vehicle database and passwords. S3 credentials are +provided by `sus/neuro-project-zomboid.yaml`. Never put runtime passwords or +decrypted SOPS contents in the Nix store. + +Backups retain the existing bucket `backup-hectic-lab`, prefix +`project-zomboid`, half-hour schedule and 14-day remote retention. +Local mods are included. See [backup and restore instructions](project-zomboid-backups.md). + +Migration recovery copies live under the private directory +`/var/backups/project-zomboid/migration-20261120` on neuro. The former neuro +installation must remain separate from the authoritative hectic-lab save. +Do not restore either copy over a running server. + +## Cutover evidence, 2026-11-20 + +The old server was saved and gracefully stopped with no connected players. +The final offline rsync used content checksums. Independent SHA-256 inventories +matched for all 718,669 regular files (15,939,182,014 bytes), including file +paths, modes and symlink targets: + +```text +11082cc5c3386ae591ffe8ce67d8dec57d1f2d53a66fe17fdbee54cc6df84167 +``` + +All three account/player/vehicle databases passed SQLite `quick_check` and +matched byte-for-byte before startup. Counts were two network players, 1,009 +vehicles and three whitelist records. Both local mod copies matched their +installed Workshop originals, and startup logs confirmed both loaded. +All 140 captured INI settings matched after the intentional Workshop and +announced-IP changes. All 191 sandbox settings, including nested mod settings, +also matched the original Lua values after startup. + +Native NixOS activation on neuro succeeded. External A2S_INFO returned the +server on UDP 16261; independent probes also reached UDP 16262. Authenticated +local RCON succeeded, and external TCP 27015 was unreachable. A full game +client join was not tested. + +The first native backup completed successfully and its S3 object was checked: + +```text +project-zomboid/project-zomboid-servertest-20261120T123322Z.tar.zst +149420409 bytes +``` + +The local mod files were verified in backup staging. Regular local archive +retention remains zero after successful upload. + +The hectic-lab service and backup timer are absent from the active system. +The original data remains in its private +`/var/backups/project-zomboid/retired-20261120` recovery directory. +Temporary migration masks were removed. The old host's existing D-Bus reload +timeout caused activation to return exit 4; the new system profile, Zomboid +removal, firewall changes and shared nginx/SSH were verified separately. + +BlueMap and nginx kept their processes. Minecraft recorded a clean restart at +12:24:30 UTC, before Zomboid activation at 12:31:10 UTC; its cause was not +investigated. No kernel OOM event was found. + +The `migration-20261120/cold` directory on neuro is an incomplete copy from an +interrupted transfer and must not be used for recovery. Use the verified +`hectic-lab` snapshot instead. Rolling back an entire old host configuration +can re-enable its former server; restore game data deliberately to one host. diff --git a/nixos/module/hectic/service/project-zomboid.nix b/nixos/module/hectic/service/project-zomboid.nix index 3d3fc484..1d512cab 100644 --- a/nixos/module/hectic/service/project-zomboid.nix +++ b/nixos/module/hectic/service/project-zomboid.nix @@ -57,6 +57,7 @@ ${pkgs.coreutils}/bin/install -d -m 0700 \ "$staging_dir/Zomboid/Saves/Multiplayer/${cfg.serverName}" \ "$staging_dir/Zomboid/Server" \ + "$staging_dir/Zomboid/mods" \ "$archive_dir" exec 9>"$lock_file" @@ -126,6 +127,9 @@ ${pkgs.rsync}/bin/rsync -a --delete \ ${lib.escapeShellArg "${saveDir}/"} \ "$staging_dir/Zomboid/Saves/Multiplayer/${cfg.serverName}/" + ${pkgs.rsync}/bin/rsync -a --delete \ + ${lib.escapeShellArg "${zomboidDir}/mods/"} \ + "$staging_dir/Zomboid/mods/" ${pkgs.rsync}/bin/rsync -a --delete --delete-excluded \ --include=${lib.escapeShellArg "/${cfg.serverName}_SandboxVars.lua"} \ --include=${lib.escapeShellArg "/${cfg.serverName}_spawnpoints.lua"} \ @@ -233,6 +237,12 @@ in { description = "Steam beta branch, for example legacy41."; }; + updateOnStart = lib.mkOption { + type = lib.types.bool; + default = true; + description = "Update and validate the game through SteamCMD on startup; disable to use an existing installation."; + }; + memory = lib.mkOption { type = lib.types.strMatching "[0-9]+[mMgG]"; default = "3g"; @@ -470,11 +480,16 @@ in { ${pkgs.coreutils}/bin/chown project-zomboid:project-zomboid ${lib.escapeShellArg rconPasswordFile} ${pkgs.coreutils}/bin/chmod 0600 ${lib.escapeShellArg rconPasswordFile} ''} - ${pkgs.steamcmd}/bin/steamcmd \ - +force_install_dir ${lib.escapeShellArg cfg.installDir} \ - +login anonymous \ - +app_update 380870 ${lib.optionalString (cfg.branch != null) "-beta ${lib.escapeShellArg cfg.branch}"} validate \ - +quit + ${if cfg.updateOnStart then '' + ${pkgs.steamcmd}/bin/steamcmd \ + +force_install_dir ${lib.escapeShellArg cfg.installDir} \ + +login anonymous \ + +app_update 380870 ${lib.optionalString (cfg.branch != null) "-beta ${lib.escapeShellArg cfg.branch}"} validate \ + +quit + '' else '' + test -x ${lib.escapeShellArg "${cfg.installDir}/start-server.sh"} + test -s ${lib.escapeShellArg "${cfg.installDir}/ProjectZomboid64.json"} + ''} ${pkgs.gnused}/bin/sed -i -E \ 's/"-Xmx[0-9]+[mMgG]"/"-Xmx${cfg.memory}"/' \ ${lib.escapeShellArg "${cfg.installDir}/ProjectZomboid64.json"} diff --git a/nixos/system/hectic-lab/hectic-lab.nix b/nixos/system/hectic-lab/hectic-lab.nix index b072eb10..8d2eb284 100644 --- a/nixos/system/hectic-lab/hectic-lab.nix +++ b/nixos/system/hectic-lab/hectic-lab.nix @@ -111,83 +111,6 @@ in { services.matrix = { enable = false; }; - services."project-zomboid" = { - enable = true; - memory = "4g"; - serverName = "servertest"; - serverPropertiesFile = /var/lib/project-zomboid/server-password.ini; - rcon.enable = true; - backup = { - enable = true; - onCalendar = "*:0/30"; - retentionDays = 0; - s3 = { - enable = true; - bucket = "backup-hectic-lab"; - endpoint = "https://hel1.your-objectstorage.com"; - region = "hel1"; - credentialsFile = "/var/lib/project-zomboid/s3-credentials"; - }; - }; - serverProperties = { - Map = "Muldraugh, KY"; - SaveWorldEveryMinutes = 15; - DoLuaChecksum = false; - Public = true; - AntiCheatSafety = 4; - AntiCheatMovement = 4; - AntiCheatSpeed = 4; - AntiCheatHit = 4; - AntiCheatPacket = 4; - AntiCheatPacketException = 4; - AntiCheatPermission = 4; - AntiCheatXP = 4; - AntiCheatFire = 4; - AntiCheatSafeHouse = 4; - AntiCheatRecipe = 4; - AntiCheatPlayer = 4; - AntiCheatChecksum = 4; - AntiCheatItem = 4; - AntiCheatNoClip = 4; - AntiCheatServerCustomization = 4; - }; - workshopItems = [ - "3676456221" # Lua Digital Watch Framework - "3600401184" # Realistic Temperature Mod - ]; - mods = [ - "\\LuaDigitalWatchUI" - "\\RC_RealisticColdMod" - ]; - sandboxProperties = { - StartMonth = 12; - StartDay = 1; - WaterShut = 3; - WaterShutModifier = 150; - ElecShut = 3; - ElecShutModifier = 150; - MinutesPerPage = 0.5; - Zombies = 4; - ZombieConfig = { - PopulationMultiplier = 1.3; - PopulationStartMultiplier = 1.0; - PopulationPeakMultiplier = 1.0; - RespawnHours = 0.0; - RespawnUnseenHours = 0.0; - RespawnMultiplier = 0.0; - RedistributeHours = 0.0; - }; - ZombieLore = { - Transmission = 4; - Mortality = 7; - Speed = 2; - SprinterPercentage = 0; - Strength = 2; - Cognition = 2; - DoorOpeningPercentage = 10; - }; - }; - }; services.p4d = { enable = true; package = pkgs.p4d; @@ -281,50 +204,9 @@ in { "jwt-secret" "s3-access-key" "s3-secret-key" - ]) // { - "project-zomboid/s3-access-key" = { - key = "ente/s3-access-key"; - owner = "project-zomboid"; - group = "project-zomboid"; - }; - "project-zomboid/s3-secret-key" = { - key = "ente/s3-secret-key"; - owner = "project-zomboid"; - group = "project-zomboid"; - }; - }; + ]); }; - systemd.services.project-zomboid.preStart = lib.mkBefore '' - password_file=${lib.escapeShellArg "/var/lib/project-zomboid/server-password"} - properties_file=${lib.escapeShellArg "/var/lib/project-zomboid/server-password.ini"} - s3_credentials_file=${lib.escapeShellArg "/var/lib/project-zomboid/s3-credentials"} - s3_credentials_tmp="$(${pkgs.coreutils}/bin/mktemp "''${s3_credentials_file}.XXXXXX")" - trap '${pkgs.coreutils}/bin/rm -f "$s3_credentials_tmp"' EXIT - - { - ${pkgs.coreutils}/bin/printf 'AWS_ACCESS_KEY_ID=' - ${pkgs.coreutils}/bin/cat ${lib.escapeShellArg config.sops.secrets."project-zomboid/s3-access-key".path} - ${pkgs.coreutils}/bin/printf '\n' - ${pkgs.coreutils}/bin/printf 'AWS_SECRET_ACCESS_KEY=' - ${pkgs.coreutils}/bin/cat ${lib.escapeShellArg config.sops.secrets."project-zomboid/s3-secret-key".path} - ${pkgs.coreutils}/bin/printf '\n' - } > "$s3_credentials_tmp" - ${pkgs.coreutils}/bin/chmod 0400 "$s3_credentials_tmp" - ${pkgs.coreutils}/bin/mv -f "$s3_credentials_tmp" "$s3_credentials_file" - - if [ ! -s "$password_file" ] || ! ${pkgs.gnugrep}/bin/grep -Eq '^[0-9a-f]{48}$' "$password_file"; then - umask 077 - ${pkgs.openssl}/bin/openssl rand -hex 24 > "$password_file" - fi - ${pkgs.coreutils}/bin/chmod 0600 "$password_file" - - properties_file_tmp="$(${pkgs.coreutils}/bin/mktemp "$(dirname "$properties_file")/.server-password.ini.XXXXXX")" - ${pkgs.coreutils}/bin/printf 'Password=%s\n' "$(<"$password_file")" > "$properties_file_tmp" - ${pkgs.coreutils}/bin/chmod 0600 "$properties_file_tmp" - ${pkgs.coreutils}/bin/mv "$properties_file_tmp" "$properties_file" - ''; - users.users.root.openssh.authorizedKeys.keys = [ # neuro machine "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDfqSROY+rp7amPPiArY3sZM7jTjYBS02csWxF/NeIr/ root@neuro" diff --git a/nixos/system/neuro/default.nix b/nixos/system/neuro/default.nix index 8053c477..86752af5 100644 --- a/nixos/system/neuro/default.nix +++ b/nixos/system/neuro/default.nix @@ -19,6 +19,8 @@ in self.lib.nixpkgs-lib.nixosSystem { self.lib.cudaUnfreePredicate pkg || builtins.elem (self.lib.nixpkgs-lib.getName pkg) [ "minecraft-server" "neoforge" + "steamcmd" + "steam-unwrapped" "nvidia-x11" "nvidia-kernel-modules" diff --git a/nixos/system/neuro/neuro.nix b/nixos/system/neuro/neuro.nix index c17e1f93..540f6fdd 100644 --- a/nixos/system/neuro/neuro.nix +++ b/nixos/system/neuro/neuro.nix @@ -71,6 +71,7 @@ in { self.nixosModules.hectic inputs.sops-nix.nixosModules.sops ./minecraft + ./project-zomboid.nix ./wowmine-web.nix ./hardware.nix ]; diff --git a/nixos/system/neuro/project-zomboid-sandbox.json b/nixos/system/neuro/project-zomboid-sandbox.json new file mode 100644 index 00000000..f805d659 --- /dev/null +++ b/nixos/system/neuro/project-zomboid-sandbox.json @@ -0,0 +1,315 @@ +{ + "AbundantLootFactor": 3, + "Alarm": 4, + "AlarmDecay": 2, + "AlarmDecayModifier": 14, + "AllClothesUnlocked": false, + "AllowExteriorGenerator": true, + "AmmoLootNew": 0.6, + "AnimalAgeModifier": 4, + "AnimalEggHatch": 4, + "AnimalGrassRegrowTime": 240, + "AnimalMatingSeason": true, + "AnimalMetaPredator": false, + "AnimalMetaStatsModifier": 4, + "AnimalMilkIncModifier": 4, + "AnimalPathChance": 4, + "AnimalPregnancyTime": 4, + "AnimalRanchChance": 5, + "AnimalSoundAttractZombies": true, + "AnimalStatsModifier": 4, + "AnimalTrackChance": 4, + "AnimalWoolIncModifier": 4, + "AnnotatedMapChance": 4, + "AttackBlockMovements": true, + "Basement": { + "SpawnFrequency": 4 + }, + "BloodLevel": 3, + "BloodSplatLifespanDays": 0, + "BoneFracture": true, + "CannedFoodLootNew": 0.6, + "CarAlarm": 3, + "CarDamageOnImpact": 3, + "CarGasConsumption": 1, + "CarGeneralCondition": 3, + "CarSpawnRate": 3, + "ChanceHasGas": 2, + "CharacterFreePoints": 0, + "ClayLakeChance": 0.05, + "ClayRiverChance": 0.05, + "ClimateCycle": 1, + "ClothingDegradation": 3, + "ClothingLootNew": 0.6, + "CommonLootFactor": 2, + "CompostTime": 2, + "ConstructionBonusPoints": 3, + "ConstructionPreventsLootRespawn": true, + "ContainerLootNew": 0.6, + "CookwareLootNew": 0.6, + "DamageToPlayerFromHitByACar": 1, + "DayLength": 4, + "DayNightCycle": 1, + "DaysForRottenFoodRemoval": -1, + "DaysUntilMaximumDiminishedLoot": 3650, + "DaysUntilMaximumLooted": 90, + "DaysUntilMaximumRatIndex": 90, + "DecayingCorpseHealthImpact": 3, + "DiscomfortFactor": 0.8, + "Distribution": 1, + "EasyClimbing": false, + "ElecShut": 3, + "ElecShutModifier": 150, + "EnablePoisoning": 1, + "EnableSnowOnGround": true, + "EnableTaintedWaterText": true, + "EnableVehicles": true, + "EndRegen": 3, + "ErosionDays": 0, + "ErosionSpeed": 4, + "ExtremeLootFactor": 0.2, + "Farming": 3, + "FarmingAmountNew": 1, + "FarmingLootNew": 0.6, + "FarmingSpeedNew": 1, + "FireSpread": true, + "FirearmHeadGearEffect": true, + "FirearmJamMultiplier": 1, + "FirearmMoodleMultiplier": 1, + "FirearmNoiseMultiplier": 1, + "FirearmUseDamageChance": 2, + "FirearmWeatherMultiplier": 1, + "FishAbundance": 2, + "FogCycle": 1, + "FoodLootNew": 0.8, + "FoodRotSpeed": 3, + "FridgeFactor": 3, + "FuelStationGasEmptyChance": 20, + "FuelStationGasInfinite": false, + "FuelStationGasMax": 0.8, + "FuelStationGasMin": 0, + "GeneratorFuelConsumption": 0.1, + "GeneratorSpawning": 4, + "GeneratorTileRange": 20, + "GeneratorVerticalPowerRange": 3, + "Helicopter": 2, + "HoursForCorpseRemoval": 216, + "HoursForLootRespawn": 0, + "HoursForWorldItemRemoval": 24, + "InitialGas": 2, + "InjurySeverity": 2, + "InsaneLootFactor": 0.05, + "ItemRemovalListBlacklistToggle": false, + "KeyLootNew": 0.4, + "KillInsideCrops": true, + "LevelForDismantleXPCutoff": 0, + "LevelForMediaXPCutoff": 3, + "LightBulbLifespan": 2, + "LiteratureCooldown": 45, + "LiteratureLootNew": 0.6, + "LockedCar": 4, + "LockedHouses": 6, + "LootItemRemovalList": "", + "LuaDigitalWatchUI": { + "MinuteResolution": 1 + }, + "MaggotSpawn": 1, + "Map": { + "AllowMiniMap": false, + "AllowWorldMap": true, + "MapAllKnown": false, + "MapNeedsLight": true + }, + "MaterialLootNew": 0.6, + "MaxFogIntensity": 1, + "MaxItemsForLootRespawn": 5, + "MaxRainFxIntensity": 1, + "MaximumDiminishedLoot": 20, + "MaximumFireFuelHours": 8, + "MaximumLooted": 25, + "MaximumLootedBuildingRooms": 50, + "MaximumRatIndex": 25, + "MechanicsLootNew": 0.6, + "MediaLootNew": 0.6, + "MedicalLootNew": 0.6, + "MementoLootNew": 0.6, + "MetaEvent": 2, + "MetaKnowledge": 3, + "MinutesPerPage": 0.5, + "MultiHitZombies": false, + "MultiplierConfig": { + "Aiming": 1, + "Axe": 1, + "Blacksmith": 1, + "Blunt": 1, + "Butchering": 1, + "Carving": 1, + "Cooking": 1, + "Doctor": 1, + "Electricity": 1, + "Farming": 1, + "Fishing": 1, + "Fitness": 1, + "FlintKnapping": 1, + "Glassmaking": 1, + "Global": 1, + "GlobalToggle": true, + "Husbandry": 1, + "Lightfoot": 1, + "LongBlade": 1, + "Maintenance": 1, + "Masonry": 1, + "Mechanics": 1, + "MetalWelding": 1, + "Nimble": 1, + "PlantScavenging": 1, + "Pottery": 1, + "Reloading": 1, + "SmallBlade": 1, + "SmallBlunt": 1, + "Sneak": 1, + "Spear": 1, + "Sprinting": 1, + "Strength": 1, + "Tailoring": 1, + "Tracking": 1, + "Trapping": 1, + "Woodwork": 1 + }, + "MuscleStrainFactor": 0.7, + "NatureAbundance": 3, + "NegativeTraitsPenalty": 1, + "NightDarkness": 3, + "NightLength": 3, + "NoBlackClothes": true, + "NormalLootFactor": 1, + "Nutrition": true, + "OtherLootNew": 0.8, + "PlaceDirtAboveground": false, + "PlantAbundance": 3, + "PlantGrowingSeasons": true, + "PlantResilience": 3, + "PlayerDamageFromCrash": true, + "Rain": 3, + "RangedWeaponLootNew": 1.2, + "RareLootFactor": 0.6, + "RealisticCold": { + "BreachWeightCurtain": 0.3, + "BreachWeightDoor": 1.2, + "BreachWeightGap": 1.4, + "BreachWeightWindow": 0.8, + "CatchColdRateMultiplier": 1.75, + "CatchColdThreshold": 2, + "ChillyAirThreshold": 16, + "ChillyCoolingMultiplierThreshold": 0.9, + "ChillyInsulationThreshold": 1.5, + "ClothingInsulationScale": 4, + "ColdMedicineDecayPerHour": 36, + "ColdRecoverPerHour": 24, + "ColdSicknessMultiplier": 1, + "ColdWorsenPerHour": 45, + "ConvectiveBridgeStrength": 1, + "EnableFoodFreezingExperimental": false, + "EvapCoolingStrength": 1, + "ExposureCap": 6, + "HeatDistanceExponent": 1, + "HeatTargetMaximum": 26, + "HypothermiaDamageIntervalMin": 0.2, + "HypothermiaDamagePerTick": 0.2, + "IndustrialHeaterSpawnRate": 20, + "InsulationSpreadBias": 0.3, + "SealedPassiveTransferStrength": 1, + "SweatRateMultiplier": 1, + "VehicleHeaterMaxDelta": 25, + "WarmingRateCapCPM": 0.5 + }, + "RearVulnerability": 3, + "RecentlySurvivorVehicles": 2, + "RecipeResourceLoot": 0.6, + "RemoveStoryLoot": false, + "RemoveZombieLoot": false, + "RollsMultiplier": 1, + "RuralLooted": 0.5, + "SeeNotLearntRecipe": true, + "SeenHoursPreventLootRespawn": 0, + "SirenEffectsZombies": true, + "SirenShutoffHours": 0, + "SkillBookLoot": 0.6, + "SleepingEvent": 1, + "StartDay": 1, + "StartMonth": 12, + "StartTime": 2, + "StartYear": 1, + "StarterKit": false, + "StatsDecrease": 3, + "SurvivalGearsLootNew": 0.6, + "SurvivorHouseChance": 3, + "Temperature": 3, + "TimeSinceApo": 1, + "ToolLootNew": 0.6, + "TrafficJam": true, + "VERSION": 6, + "VehicleEasyUse": false, + "VehicleStoryChance": 3, + "WaterShut": 3, + "WaterShutModifier": 150, + "WeaponLootNew": 0.6, + "WorldItemRemovalList": "Base.Hat, Base.Glasses, Base.Maggots, Base.Slug, Base.Slug2, Base.Snail, Base.Worm, Base.Dung_Mouse, Base.Dung_Rat", + "WoundInfectionFactor": 1, + "ZombieAttractionMultiplier": 1, + "ZombieConfig": { + "FollowSoundDistance": 100, + "PopulationMultiplier": 1.3, + "PopulationPeakDay": 28, + "PopulationPeakMultiplier": 1, + "PopulationStartMultiplier": 1, + "RallyGroupRadius": 3, + "RallyGroupSeparation": 15, + "RallyGroupSize": 20, + "RallyGroupSizeVariance": 50, + "RallyTravelDistance": 20, + "RedistributeHours": 0, + "RespawnHours": 0, + "RespawnMultiplier": 0, + "RespawnUnseenHours": 0, + "ZombiesCountBeforeDelete": 300 + }, + "ZombieHealthImpact": false, + "ZombieLore": { + "ActiveOnly": 1, + "ChanceOfAttachedWeapon": 6, + "Cognition": 2, + "CrawlUnderVehicle": 5, + "DisableFakeDead": 1, + "DoorOpeningPercentage": 10, + "FenceDamageMultiplier": 1, + "FenceThumpersRequired": 25, + "Hearing": 5, + "Memory": 2, + "Mortality": 7, + "PlayerSpawnZombieRemoval": 1, + "Reanimate": 3, + "Sight": 5, + "Speed": 2, + "SpottedLogic": true, + "SprinterPercentage": 0, + "Strength": 2, + "ThumpNoChasing": false, + "ThumpOnConstruction": true, + "Toughness": 4, + "Transmission": 4, + "TriggerHouseAlarm": true, + "ZombiesArmorFactor": 2, + "ZombiesCrawlersDragDown": false, + "ZombiesDragDown": true, + "ZombiesFallDamage": 1, + "ZombiesFenceLunge": true, + "ZombiesMaxDefense": 85 + }, + "ZombieMigrate": true, + "ZombiePopLootEffect": 0, + "ZombieRespawn": 4, + "ZombieVoronoiNoise": true, + "Zombies": 4, + "ZoneStoryChance": 3 +} diff --git a/nixos/system/neuro/project-zomboid-server.json b/nixos/system/neuro/project-zomboid-server.json new file mode 100644 index 00000000..12bc788a --- /dev/null +++ b/nixos/system/neuro/project-zomboid-server.json @@ -0,0 +1,142 @@ +{ + "AdminSafehouse": "false", + "AllowCoop": "true", + "AllowDestructionBySledgehammer": "true", + "AllowNonAsciiUsername": "false", + "AnnounceAnimalDeath": "false", + "AnnounceDeath": "false", + "AntiCheatChecksum": "4", + "AntiCheatHit": "4", + "AntiCheatNoClip": "4", + "AntiCheatPacketException": "4", + "AntiCheatPermission": "4", + "AntiCheatPlayer": "4", + "AntiCheatSafeHouse": "4", + "AntiCheatSafety": "4", + "AntiCheatSpeed": "4", + "AntiCheatXP": "4", + "BackupsCount": "5", + "BackupsOnStart": "true", + "BackupsOnVersionChange": "true", + "BackupsPeriod": "0", + "BadWordListFile": "", + "BadWordPolicy": "3", + "BadWordReplacement": "[HIDDEN]", + "BanKickGlobalSound": "true", + "BloodSplatLifespanDays": "0", + "CarEngineAttractionModifier": "0.5", + "ChatMessageCharacterLimit": "200", + "ChatMessageSlowModeTime": "3", + "ChatStreams": "s,r,a,w,y,sh,f,all", + "ClientActionLogs": "ISEnterVehicle;ISExitVehicle;ISTakeEngineParts;", + "ClientCommandFilter": "-vehicle.*;+vehicle.damageWindow;+vehicle.fixPart;+vehicle.installPart;+vehicle.uninstallPart", + "DefaultPort": "16261", + "DenyLoginOnOverloadedServer": "true", + "DisableBurntTowing": "false", + "DisableRadioAdmin": "true", + "DisableRadioGM": "true", + "DisableRadioInvisible": "true", + "DisableRadioModerator": "false", + "DisableRadioOverseer": "false", + "DisableRadioStaff": "false", + "DisableSafehouseWhenOwnerConnected": "false", + "DisableScoreboard": "false", + "DisableTrailerTowing": "false", + "DisableVehicleTowing": "false", + "DiscordChatChannel": "", + "DiscordCommandChannel": "", + "DiscordEnable": "false", + "DiscordLogChannel": "", + "DisplayUserName": "true", + "DoLuaChecksum": "false", + "DropOffWhiteListAfterDeath": "false", + "Faction": "true", + "FactionDaySurvivedToCreate": "0", + "FactionPlayersRequiredForTag": "1", + "FastForwardMultiplier": "40.0", + "GlobalChat": "true", + "GoodWordListFile": "", + "HideAdminsInPlayerList": "false", + "HideDisguisedUserName": "false", + "HidePlayersBehindYou": "true", + "ItemNumbersLimitPerContainer": "0", + "KnockedDownAllowed": "false", + "LoginQueueConnectTimeout": "60", + "LoginQueueEnabled": "false", + "Map": "Muldraugh, KY", + "MapRemotePlayerVisibility": "1", + "MaxAccountsPerUser": "0", + "MaxPacketsPerSecond": "300", + "MaxPlayers": "32", + "MaxSafezoneSize": "20000", + "Mods": "\\LuaDigitalWatchUI;\\RC_RealisticColdMod", + "MouseOverToSeeDisplayName": "true", + "MultiplayerStatisticsPeriod": "1", + "NoFire": "false", + "Open": "true", + "PVP": "true", + "PVPFirearmDamageModifier": "50.0", + "PVPLogToolChat": "true", + "PVPLogToolFile": "true", + "PVPMeleeDamageModifier": "30.0", + "PVPMeleeWhileHitReaction": "false", + "PauseEmpty": "true", + "PerkLogs": "true", + "PingLimit": "0", + "PlayerBumpPlayer": "false", + "PlayerRespawnWithOther": "false", + "PlayerRespawnWithSelf": "false", + "PlayerSafehouse": "false", + "Public": "true", + "PublicDescription": "", + "PublicName": "My PZ Server", + "RCONPort": "27015", + "RemovePlayerCorpsesOnCorpseRemoval": "false", + "ResetID": "555407849", + "SafeHouseRemovalTime": "144", + "SafehouseAllowFire": "true", + "SafehouseAllowLoot": "true", + "SafehouseAllowNonResidential": "false", + "SafehouseAllowRespawn": "false", + "SafehouseAllowTrepass": "true", + "SafehouseDaySurvivedToClaim": "0", + "SafehouseDisableDisguises": "true", + "SafehousePreventsLootRespawn": "true", + "SafetyCooldownTimer": "3", + "SafetyDisconnectDelay": "60", + "SafetySystem": "true", + "SafetyToggleTimer": "2", + "SaveWorldEveryMinutes": "15", + "Seed": "EGRdrbkctBhwZiKX", + "ServerPlayerID": "630210521", + "ServerWelcomeMessage": "Welcome to Project Zomboid Multiplayer! To interact with the Chat panel: press Tab, T, or Enter. The Tab key will change the target stream of the message. Global Streams: /all Local Streams: /say, /yell Special Steams: /whisper, /safehouse, /faction. Press the Up arrow to cycle through your message history. Click the Gear icon to customize chat. Happy surviving!", + "ShowCoordinates": "false", + "ShowFirstAndLastName": "false", + "ShowSafety": "true", + "SledgehammerOnlyInSafehouse": "false", + "SleepAllowed": "false", + "SleepNeeded": "false", + "SneakModeHideFromOtherPlayers": "true", + "SpawnItems": "", + "SpawnPoint": "0,0,0", + "SpeedLimit": "70.0", + "SteamScoreboard": "false", + "SteamVAC": "true", + "SwitchZombiesOwnershipEachUpdate": "false", + "TrashDeleteAll": "false", + "UDPPort": "16262", + "UPnP": "true", + "UltraSpeedDoesnotAffectToAnimals": "false", + "UsePhysicsHitReaction": "false", + "UsernameDisguises": "false", + "Voice3D": "true", + "VoiceEnable": "true", + "VoiceMaxDistance": "100.0", + "VoiceMinDistance": "10.0", + "War": "false", + "WarDuration": "3600", + "WarSafehouseHitPoints": "3", + "WarStartDelay": "600", + "WorkshopItems": "3676456221;3600401184", + "server_browser_announced_ip": "" +} diff --git a/nixos/system/neuro/project-zomboid.nix b/nixos/system/neuro/project-zomboid.nix new file mode 100644 index 00000000..d7bf2172 --- /dev/null +++ b/nixos/system/neuro/project-zomboid.nix @@ -0,0 +1,86 @@ +{ config, lib, pkgs, ... }: +{ + # Retain the IDs of neuro's former installation; hectic-lab's UID is occupied. + users.users.project-zomboid.uid = 988; + users.groups.project-zomboid.gid = 985; + + sops.secrets = { + "project-zomboid/s3-access-key" = { + sopsFile = ../../../sus/neuro-project-zomboid.yaml; + owner = "project-zomboid"; + group = "project-zomboid"; + }; + "project-zomboid/s3-secret-key" = { + sopsFile = ../../../sus/neuro-project-zomboid.yaml; + owner = "project-zomboid"; + group = "project-zomboid"; + }; + }; + + systemd.services.project-zomboid.preStart = lib.mkBefore '' + password_file=${lib.escapeShellArg "/var/lib/project-zomboid/server-password"} + properties_file=${lib.escapeShellArg "/var/lib/project-zomboid/server-password.ini"} + s3_credentials_file=${lib.escapeShellArg "/var/lib/project-zomboid/s3-credentials"} + s3_credentials_tmp="$(${pkgs.coreutils}/bin/mktemp "''${s3_credentials_file}.XXXXXX")" + trap '${pkgs.coreutils}/bin/rm -f "$s3_credentials_tmp"' EXIT + + { + ${pkgs.coreutils}/bin/printf 'AWS_ACCESS_KEY_ID=' + ${pkgs.coreutils}/bin/cat ${lib.escapeShellArg config.sops.secrets."project-zomboid/s3-access-key".path} + ${pkgs.coreutils}/bin/printf '\n' + ${pkgs.coreutils}/bin/printf 'AWS_SECRET_ACCESS_KEY=' + ${pkgs.coreutils}/bin/cat ${lib.escapeShellArg config.sops.secrets."project-zomboid/s3-secret-key".path} + ${pkgs.coreutils}/bin/printf '\n' + } > "$s3_credentials_tmp" + ${pkgs.coreutils}/bin/chmod 0400 "$s3_credentials_tmp" + ${pkgs.coreutils}/bin/mv -f "$s3_credentials_tmp" "$s3_credentials_file" + + if [ ! -s "$password_file" ] || ! ${pkgs.gnugrep}/bin/grep -Eq '^[0-9a-f]{48}$' "$password_file"; then + umask 077 + ${pkgs.openssl}/bin/openssl rand -hex 24 > "$password_file" + fi + ${pkgs.coreutils}/bin/chmod 0600 "$password_file" + + properties_file_tmp="$(${pkgs.coreutils}/bin/mktemp "$(dirname "$properties_file")/.server-password.ini.XXXXXX")" + ${pkgs.coreutils}/bin/printf 'Password=%s\n' "$(<"$password_file")" > "$properties_file_tmp" + ${pkgs.coreutils}/bin/chmod 0600 "$properties_file_tmp" + ${pkgs.coreutils}/bin/mv "$properties_file_tmp" "$properties_file" + ''; + + hectic.services."project-zomboid" = { + enable = true; + updateOnStart = false; + memory = "4g"; + serverName = "servertest"; + port = 36565; + udpPort = 36566; + serverPropertiesFile = /var/lib/project-zomboid/server-password.ini; + rcon.enable = true; + + # These snapshots retain live settings, world identities and mod options. + serverProperties = builtins.fromJSON (builtins.readFile ./project-zomboid-server.json) // { + server_browser_announced_ip = "95.31.254.84"; + }; + sandboxProperties = builtins.fromJSON (builtins.readFile ./project-zomboid-sandbox.json); + # Keep the migrated LuaDigitalWatchUI 1.0 and RC_RealisticColdMod 2.2.0 + # in Zomboid/mods; Workshop would replace the latter on first startup. + workshopItems = [ ]; + mods = [ + "\\LuaDigitalWatchUI" + "\\RC_RealisticColdMod" + ]; + + backup = { + enable = true; + onCalendar = "*:0/30"; + retentionDays = 0; + s3 = { + enable = true; + bucket = "backup-hectic-lab"; + endpoint = "https://hel1.your-objectstorage.com"; + region = "hel1"; + credentialsFile = "/var/lib/project-zomboid/s3-credentials"; + }; + }; + }; +} diff --git a/sus/neuro-project-zomboid.yaml b/sus/neuro-project-zomboid.yaml new file mode 100644 index 00000000..23ff50f4 --- /dev/null +++ b/sus/neuro-project-zomboid.yaml @@ -0,0 +1,36 @@ +project-zomboid: + s3-access-key: ENC[AES256_GCM,data:tdA1DzFnkDu2ePgOOt2r0TMvmkM=,iv:v77jcsXu3faI83no/BeoJjJYrRSvgq8n49Y2yZtuw4k=,tag:bh+z9NfxOMExPOLzOB+2oA==,type:str] + s3-secret-key: ENC[AES256_GCM,data:NXzFESSADV0SxCDpHtScwhOrOqN8JCm+v+qZUpk+d/I5vVNLtpJHoA==,iv:YTIb+yBOSZIeac+XVnP7WBpyfl6h1aL7UhV79qTJecY=,tag:OA6TsjNnh0Zn26Cocqpgiw==,type:str] +sops: + age: + - enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBveGxNbGRucXBMb2d3TlJ2 + U1drOUluRDQ2OGxDYzVkdzFmMTMyd1RNcFZnCjBTVElYa0lCQVJHbnVtbGN0aWhD + bVRET2NTVnBEeldFQWdPazVxT3dBbncKLS0tIDNvVUd1cjh4cHE1R2plTXhyZVls + RWJ3b2M4YUNZTkV1TGtuSzBJNTNSamMKC7M7CIssfHAklkpHWA+qtP0puXEN5WJz + W2fTOYuv6ZR5PiBHvrf+Uf1YmaD4z2JD4dvZxgCf8bCF6X4MTUGFmw== + -----END AGE ENCRYPTED FILE----- + recipient: age1r25zdeqq8nac6dgca9en28r57ffyz9u9d8z5yc25gc8xqz747vaqmdtk0h + - enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBFbEFtMmF1aWVhMUFCME0w + ZWZKNVQxNVl3RHpteUxobDdMZWtJWUVHWEJ3CkZ6ZUlZMUZSRUM4bXQzOGRjbmZL + bWlvQzhEaTBnckkzNmR6TG92TXhhZFEKLS0tIHIwaTJTVnRTbno3bXZxdUhFYzJn + OUgydXhpcWtLM3RyQ3BQczNyTFl1c3cK1Ys4LO496IkptYeR1oTXxErZJq4yG4CG + BGTUSxui80s9O5zBYnZPLMtAb589jqxHFLf9hgvrObWqVRoWdiRfRQ== + -----END AGE ENCRYPTED FILE----- + recipient: age1ak7heljpr0pjr4m0rcwxgn3sp0jjxw03lxyf33r8lcemqh2u2sgqx0aplq + - enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSB3enZUK0p6T2l0NWhrcjJO + SC9FYnJwQTREQnVmamhxVVB6N2RhL3VucUF3CjBWM1kvUDlMWkpBczh4cDlxU21y + aENJZUJQTW9sTmNzMU9SSzJGS3NmMGcKLS0tIFFEdWMrUlZmVDJoL21oZUJLdElh + Mzk3Y3hXVW5FdWI3QUgyWDVNU2Q1RVEK3uTuYD6bjCNoW8e2dy3Q9ewvITWeaHPp + xvsCI5vbAh90jAh72rEQR9IVdhNeeMsPGMpMHqdny0mq7zjPQAv9Kw== + -----END AGE ENCRYPTED FILE----- + recipient: age1ev53mzse6rg4ffwtcwtq4e93c7x7s4d0eyu89jrsahrke8r4yamsseu8h4 + lastmodified: "2026-11-20T11:25:50Z" + mac: ENC[AES256_GCM,data:4+tAoFxWbz/a9fw/ggBNYLfyjNOQr5k3DVGA1h11AT9QIoNWgYmzv+mEYCZ3/gtXAEAftPtpczS8QYHpO6FBUHev1xo7FleTk2TBFMTr6gzz2ZpRPZOsZc9jE3t9fhcXGaCyGK4IqtkFVPZPF3NNv6Geo3W4hsJXUdJD6hcyYO4=,iv:NshhklmhLQSRnNl0JICVVWNUx07I57yPq2I3YlTVZiw=,tag:5hNe7jUD7QsIOHFbKLVawA==,type:str] + unencrypted_suffix: _unencrypted + version: 3.13.3