nixos-config/hosts/defiant/services/minecraft.nix

72 lines
2.6 KiB
Nix

{ config, pkgs, lib, inputs, ... }:
{
imports = [ inputs.nix-minecraft.nixosModules.minecraft-servers ];
nixpkgs.overlays = [ inputs.nix-minecraft.overlay ];
services.minecraft-servers = {
enable = true;
eula = true;
openFirewall = true;
dataDir = "/var/lib/minecraft-wack";
servers.wack = {
enable = true;
jvmOpts = "-Xms4G -Xmx4G";
package = pkgs.fabricServers.fabric-1_20_4;
serverProperties = {
motd = "WackAttack M1n3cr4f7";
white-list = true;
difficulty = "normal";
view-distance = 16;
simulation-distance = 16;
enable-command-block = true;
enable-rcon = true;
"rcon.password" = "wack";
};
symlinks = {
mods = pkgs.linkFarmFromDrvs "mods" (builtins.attrValues {
FabricAPI = pkgs.fetchurl {
url = "https://cdn.modrinth.com/data/P7dR8mSH/versions/JMCwDuki/fabric-api-0.92.0%2B1.20.4.jar";
sha256 = "sha256-7U0BK5CBENWY4s3t+dXTASprIeY4Tdeyzc06lNGkc/Q=";
};
Lithium = pkgs.fetchurl {
url = "https://cdn.modrinth.com/data/gvQqBUqZ/versions/nMhjKWVE/lithium-fabric-mc1.20.4-0.12.1.jar";
sha256 = "sha256-as1JWV7mnhJkz8eYmPVpRS5BvWaYVGf8s40oBBka880=";
};
MCDiscordChat = pkgs.fetchurl {
url = "https://cdn.modrinth.com/data/D0sHdnXY/versions/tldGNWOW/MC-Discord-Chat-2.2.5.jar";
sha256 = "sha256-WK02gRNbTjbjQSIlWHP4aBSeGTZxtXwwbqt9fa7AJTA=";
};
SimpleVoiceChat = pkgs.fetchurl {
url = "https://cdn.modrinth.com/data/9eGKb6K1/versions/UIZXn9t1/voicechat-fabric-1.20.4-2.4.32.jar";
sha256 = "sha256-BZMK7Y8uaw1MvtQC1MXblsaaHy100a59KxSs4P0fjXE=";
};
});
};
whitelist = {
"_Oblivion" = "289be565-d73e-4cb1-a047-dcc319acdc80";
Crisju = "8b77dc43-27ba-4710-bbfd-4e01e6ec7461";
Dandellion = "f393413b-59fc-49d7-a5c4-83a5d177132c";
Taschmex = "a3a258b0-901f-43d9-b130-dad3b29cd7ee";
guy_montag = "cb8aa890-a5a3-41f2-9bb7-1edb20c5a31f";
koppern = "3450494c-b945-4fa2-938c-5519adec005f";
krloer = "ab3029e2-76b6-4219-854e-16091fe5e421";
tictac1255 = "bab1f702-0e8b-4b98-8cce-bbfaed534d13";
};
};
};
# TODO: Automated backup job (https://git.pvv.ntnu.no/Drift/pvv-nixos-config/src/commit/57d1dfd121fdb23fcef54e0632f6f6278c6bb753/hosts/greddost/services/minecraft/default.nix#L144)
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"minecraft-server"
];
networking.firewall.allowedUDPPorts = [ 24454 ];
}