nixos-configs/devices/servivi/modules/minecraft.nix
matt1432 ba8c00497d
All checks were successful
Discord / discord commits (push) Successful in 39s
feat(servers): update mc-cv to 1.21
2024-06-23 16:57:20 -04:00

187 lines
4.8 KiB
Nix

{
config,
nms,
pkgs,
self,
...
}: let
inherit (config.vars) mainUser;
in {
imports = [nms.nixosModules.default];
environment.systemPackages = [
self.packages.${pkgs.system}.curseforge-server-downloader
];
systemd.services.mc-steampunk.path = with pkgs; [curl];
services = {
borgbackup.configs.mc = {
paths = ["/var/lib/minecraft"];
startAt = "01/3:00";
};
modded-minecraft-servers = {
eula = true;
user = mainUser;
instances = let
jre17 = pkgs.temurin-bin-17;
jre18 = pkgs.temurin-bin-18;
jre21 = pkgs.temurin-bin-21;
defaults = {
spawn-protection = 0;
max-tick-time = 5 * 60 * 1000;
allow-flight = true;
};
in {
# Vanilla Survival
sv = {
enable = true;
jvmMaxAllocation = "10G";
jvmInitialAllocation = "2G";
jvmPackage = jre21;
jvmOpts = "";
serverConfig =
{
server-port = 25569;
motd = "1.21 gaming";
extra-options = {
difficulty = "hard";
enable-command-block = true;
max-players = 10;
view-distance = 16;
level-seed = "8764718009920";
};
}
// defaults;
};
# Vanilla Creative
cv = {
enable = true;
jvmMaxAllocation = "8G";
jvmInitialAllocation = "2G";
jvmPackage = jre21;
jvmOpts = "";
serverConfig =
{
server-port = 25566;
motd = "creative mode gaming";
extra-options = {
difficulty = "hard";
enable-command-block = true;
enforce-white-list = true;
gamemode = "creative";
max-players = 6;
view-distance = 16;
};
}
// defaults;
};
# Modded https://www.curseforge.com/minecraft/modpacks/steam-punk
# curseforge-server-downloader --pack 643605 --version latest
steampunk = {
enable = false;
jvmMaxAllocation = "12G";
jvmInitialAllocation = "2G";
jvmPackage = jre18;
jvmOpts = "";
serverConfig =
{
server-port = 25569;
motd = "";
extra-options = {
allow-nether = true;
enable-command-block = true;
enable-status = true;
entity-broadcast-range-percentage = 100;
force-gamemode = false;
function-permission-level = 2;
gamemode = "survival";
generate-structures = true;
max-build-height = 256;
max-players = 8;
difficulty = "normal";
view-distance = 12;
simulation-distance = 10;
sync-chunk-writes = true;
use-native-transport = true;
};
}
// defaults;
};
# Modded https://www.curseforge.com/minecraft/modpacks/ultimate-building-modpack
# With https://www.curseforge.com/minecraft/mc-mods/bits-and-chisels
builder = {
enable = false;
jvmMaxAllocation = "6G";
jvmInitialAllocation = "2G";
jvmPackage = jre18;
jvmOpts = "";
serverConfig =
{
server-port = 25567;
motd = "creative mode gaming with mods";
extra-options = {
generate-structures = false;
level-type = "minecraft:flat";
difficulty = "hard";
enable-command-block = true;
enforce-white-list = false;
gamemode = "creative";
max-players = 6;
view-distance = 16;
};
}
// defaults;
};
# Vault Hunters
vh = {
enable = false;
jvmMaxAllocation = "12G";
jvmInitialAllocation = "2G";
jvmPackage = jre17;
jvmOpts = "";
serverConfig =
{
server-port = 25569;
motd = "we do a little hunting of the vaults";
extra-options = {
difficulty = "hard";
enable-command-block = true;
entity-broadcast-range-percentage = 150;
level-type = "default";
max-players = 8;
spawn-protection = 0;
sync-chunk-writes = true;
use-native-transport = true;
view-distance = 10;
};
}
// defaults;
};
};
};
};
}