Server: add minecraft server with anything-sync-daemon
This commit is contained in:
parent
6249738563
commit
df662f7307
2 changed files with 112 additions and 0 deletions
|
|
@ -15,5 +15,6 @@
|
||||||
./wireguard.nix
|
./wireguard.nix
|
||||||
./tailscale.nix
|
./tailscale.nix
|
||||||
./traefik.nix
|
./traefik.nix
|
||||||
|
./minecraft.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
111
roles/server/minecraft.nix
Normal file
111
roles/server/minecraft.nix
Normal file
|
|
@ -0,0 +1,111 @@
|
||||||
|
{ config, pkgs, flakeSelf, ... }:
|
||||||
|
let
|
||||||
|
atfc = builtins.fetchurl {
|
||||||
|
url = "https://www.curseforge.com/api/v1/mods/813246/files/4732590/download";
|
||||||
|
sha256 = "0yl6ixmhfgqvcj3kfshpf8fy42vkkmjbn7d7yg86jx0ykiiq5f9x";
|
||||||
|
};
|
||||||
|
puffish_skills = builtins.fetchurl {
|
||||||
|
url = "https://www.curseforge.com/api/v1/mods/835091/files/4747353/download";
|
||||||
|
sha256 = "0yl6ixmhfgqvcj3kfshpf8fy32vkkmjbn7d7yg86jx0ykiiq5f9x";
|
||||||
|
};
|
||||||
|
spark = builtins.fetchurl {
|
||||||
|
url = "https://www.curseforge.com/api/v1/mods/361579/files/4505375/download";
|
||||||
|
sha256 = "1708lrx1nif0mvf7ambw8504j12wbn0vm69wsh21p8ylqpql1s4x";
|
||||||
|
};
|
||||||
|
|
||||||
|
port = 25565;
|
||||||
|
users = config.users;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
users = {
|
||||||
|
groups.minecraft = {
|
||||||
|
members = [ "toast" ];
|
||||||
|
gid = 987;
|
||||||
|
};
|
||||||
|
users.atfc = {
|
||||||
|
isSystemUser = true;
|
||||||
|
uid = 988;
|
||||||
|
group = "minecraft";
|
||||||
|
home = "/var/lib/minecraft/atfc";
|
||||||
|
homeMode = "750";
|
||||||
|
createHome = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
virtualisation.oci-containers = {
|
||||||
|
containers."minecraft-atfc" = {
|
||||||
|
autoStart = true;
|
||||||
|
image = "itzg/minecraft-server";
|
||||||
|
#user = "${toString users.users.atfc.uid}:${toString users.groups.minecraft.gid}";
|
||||||
|
environment = {
|
||||||
|
TZ = "Europe/Madrid";
|
||||||
|
EULA = "true";
|
||||||
|
TYPE = "forge";
|
||||||
|
MEMORY = "2G";
|
||||||
|
UID = toString users.users.atfc.uid;
|
||||||
|
GID = toString users.groups.minecraft.gid;
|
||||||
|
VERSION = "1.18.2";
|
||||||
|
FORGE_VERSION = "40.2.10";
|
||||||
|
GENERIC_PACK = "/modpack.zip";
|
||||||
|
#USE_AIKAR_FLAGS = "true";
|
||||||
|
|
||||||
|
#STOP_DURATION = "70";
|
||||||
|
STOP_SERVER_ANNOUNCE_DELAY = "20";
|
||||||
|
|
||||||
|
# server.properties
|
||||||
|
MOTD = "Toast's modded minecraft server";
|
||||||
|
DIFFICULTY = "hard";
|
||||||
|
SNOOPER_ENABLED = "false";
|
||||||
|
SPAWN_PROTECTION = "0";
|
||||||
|
LEVEL_TYPE = "tfc:tng";
|
||||||
|
BROADCAST_CONSOLE_TO_OPS = "true";
|
||||||
|
BROADCAST_RCON_TO_OPS = "true";
|
||||||
|
|
||||||
|
OPS = "b3ca4afb-a3da-4a78-85c3-2292fd0787e2,0cb3d02a-1d1f-4d7f-b70c-bd53dc155cff";
|
||||||
|
EXISTING_OPS_FILE = "synchronize";
|
||||||
|
|
||||||
|
WHITELIST = "b3ca4afb-a3da-4a78-85c3-2292fd0787e2,0cb3d02a-1d1f-4d7f-b70c-bd53dc155cff,03f080e8-ce8e-4b90-a312-734747ce7db0,ea88f690-cf46-4416-bfd5-6f6b165885f7";
|
||||||
|
EXISTING_WHITELIST_FILE = "synchronize";
|
||||||
|
|
||||||
|
# Auto pause needs this
|
||||||
|
MAX_TICK_TIME = "-1";
|
||||||
|
AUTOPAUSE_KNOCK_INTERFACE = "tap0";
|
||||||
|
ENABLE_AUTOPAUSE = "true";
|
||||||
|
};
|
||||||
|
extraOptions = [
|
||||||
|
"--network=slirp4netns:port_handler=slirp4netns"
|
||||||
|
"--cap-add=CAP_NET_RAW"
|
||||||
|
];
|
||||||
|
|
||||||
|
volumes = [
|
||||||
|
"${atfc}:/modpack.zip"
|
||||||
|
"${puffish_skills}:/mods/puffish_skills.jar"
|
||||||
|
"${spark}:/mods/spark.jar"
|
||||||
|
"${users.users.atfc.home}:/data"
|
||||||
|
#"/tmp/minecraft:/data"
|
||||||
|
];
|
||||||
|
ports = [ "25565:${toString port}" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
networking.firewall.allowedTCPPorts = [ port ];
|
||||||
|
|
||||||
|
# anything-sync-daemon config
|
||||||
|
systemd.packages = with pkgs; [ flakeSelf.packages.x86_64-linux.anything-sync-daemon ];
|
||||||
|
environment.systemPackages = with pkgs; [ flakeSelf.packages.x86_64-linux.anything-sync-daemon ];
|
||||||
|
fileSystems.minecraftTmpfs = {
|
||||||
|
device = "none";
|
||||||
|
fsType = "tmpfs";
|
||||||
|
mountPoint = "/mnt/minecraftTmpfs";
|
||||||
|
options = [ "size=4G "];
|
||||||
|
};
|
||||||
|
environment.etc."asd.conf".text =
|
||||||
|
''WHATTOSYNC=('/var/lib/minecraft')
|
||||||
|
VOLATILE="${config.fileSystems.minecraftTmpfs.mountPoint}"
|
||||||
|
USE_OVERLAYFS="yes" '';
|
||||||
|
systemd.services.asd = {
|
||||||
|
wantedBy = [ "podman-minecraft-atfc.service" ];
|
||||||
|
before = [ "podman-minecraft-atfc.service" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue