73 lines
1.9 KiB
Nix
73 lines
1.9 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
with lib;
|
|
let
|
|
debug = true;
|
|
#version = "latest";
|
|
# version = "142c079"; # 2 years ago.
|
|
# version = "v1.14.0"; # 2 years ago.
|
|
version = "v1.13.2"; # 2 years ago.
|
|
in
|
|
{
|
|
virtualisation.oci-containers = {
|
|
containers.screeps = {
|
|
volumes = [
|
|
"/srv/screeps:/screeps"
|
|
(optionalString debug "/srv/screeps-tmp:/tmp")
|
|
];
|
|
environment.TZ = "Europe/Berlin";
|
|
image = "screepers/screeps-launcher:${version}";
|
|
ports = [ "21025:21025" ];
|
|
};
|
|
};
|
|
|
|
systemd.services.docker-screeps =
|
|
let
|
|
configuration = builtins.toJSON {
|
|
steamKey = "keyFromStep3";
|
|
version = "latest";
|
|
mods = [
|
|
#"screepsmod-auth"
|
|
#"screepsmod-admin-utils"
|
|
#"screepsmod-mongo"
|
|
];
|
|
bots = {
|
|
simplebot = "screepsbot-zeswarm";
|
|
};
|
|
serverConfig = {
|
|
welcomeText = "<h1 style=\"text-align: center;\">My Cool Server</h1>";
|
|
constants = {
|
|
"TEST_CONSTANT" = 123;
|
|
};
|
|
tickRate = 1000;
|
|
};
|
|
};
|
|
in
|
|
{
|
|
|
|
unitConfig = {
|
|
StartLimitInterval = 200;
|
|
StartLimitBurst = 2;
|
|
};
|
|
|
|
serviceConfig = {
|
|
Restart = mkForce (if debug then "no" else "always");
|
|
RestartSec = 30;
|
|
ExecStartPre = [
|
|
(toString (pkgs.writers.writeDash "create-screeps-config" ''
|
|
mkdir -p /srv/screeps/
|
|
chown 1000:1000 -R /srv/screeps
|
|
${optionalString debug "mkdir -p /srv/screeps-tmp"}
|
|
${optionalString debug "chown 1000:1000 -R /srv/screeps-tmp"}
|
|
echo '${configuration}' > /srv/screeps/config.yaml
|
|
''))
|
|
];
|
|
};
|
|
};
|
|
|
|
#networking.firewall.allowedTCPPorts = [ 8123 ];
|
|
#networking.firewall.allowedUDPPorts = [ 8123 ];
|
|
|
|
#networking.firewall.interfaces.wg0.allowedTCPPorts = [ 8123 ];
|
|
#networking.firewall.interfaces.wg0.allowedUDPPorts = [ 8123 ];
|
|
|
|
}
|