2024-08-08 09:02:42 +08:00
|
|
|
{
|
|
|
|
inputs,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
...
|
|
|
|
}: let
|
2024-06-03 20:53:43 +08:00
|
|
|
modpack = pkgs.fetchPackwizModpack rec {
|
2024-06-13 21:36:51 +08:00
|
|
|
version = "7091175a49";
|
|
|
|
url = "https://git.sajenim.dev/jasmine/minecraft-modpack/raw/commit/${version}/pack.toml";
|
|
|
|
packHash = "sha256-9HZipG6/8GKnbXp0Qfug8Y2Db96hageUtprAuuuuGPM=";
|
2024-06-03 20:53:43 +08:00
|
|
|
};
|
|
|
|
mcVersion = modpack.manifest.versions.minecraft;
|
|
|
|
fabricVersion = modpack.manifest.versions.fabric;
|
2024-08-08 09:02:42 +08:00
|
|
|
serverVersion = lib.replaceStrings ["."] ["_"] "fabric-${mcVersion}";
|
|
|
|
in {
|
2024-06-03 20:53:43 +08:00
|
|
|
imports = [
|
|
|
|
inputs.nix-minecraft.nixosModules.minecraft-servers
|
|
|
|
];
|
|
|
|
|
|
|
|
nixpkgs.overlays = [
|
|
|
|
inputs.nix-minecraft.overlay
|
|
|
|
];
|
|
|
|
|
|
|
|
services.minecraft-servers = {
|
|
|
|
# Enable all of our servers
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
# Our minecraft servers
|
|
|
|
servers = {
|
|
|
|
kanto = {
|
|
|
|
enable = true;
|
|
|
|
# The minecraft server package to use.
|
2024-08-08 09:02:42 +08:00
|
|
|
package = pkgs.fabricServers.${serverVersion}.override {loaderVersion = fabricVersion;}; # Specific fabric loader version.
|
2024-06-03 20:53:43 +08:00
|
|
|
|
|
|
|
# Allowed players
|
|
|
|
whitelist = {
|
|
|
|
jasmariiie = "82fc15bb-6839-4430-b5e9-39c5294ff32f";
|
|
|
|
Spectre_HWS = "491c085e-f0dc-44f1-9fdc-07c7cfcec8f2";
|
|
|
|
};
|
|
|
|
|
|
|
|
# JVM options for the minecraft server.
|
|
|
|
jvmOpts = "-Xmx8G";
|
|
|
|
|
|
|
|
# Minecraft server properties for the server.properties file.
|
|
|
|
serverProperties = {
|
|
|
|
gamemode = "survival";
|
|
|
|
difficulty = "normal";
|
|
|
|
motd = "\\u00A7aKanto Network \\u00A7e[1.19.2]\\u00A7r\\n\\u00A78I'll Use My Trusty Frying Pan As A Drying Pan!";
|
|
|
|
server-port = 25565;
|
|
|
|
white-list = true;
|
|
|
|
};
|
2024-08-08 09:02:42 +08:00
|
|
|
|
2024-06-03 20:53:43 +08:00
|
|
|
# Things to symlink into this server's data directory.
|
|
|
|
symlinks = {
|
2024-08-08 09:02:42 +08:00
|
|
|
"mods" = "${modpack}/mods";
|
2024-06-03 20:53:43 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
# Things to copy into this server's data directory.
|
|
|
|
files = {
|
|
|
|
"ops.json" = ./ops.json;
|
|
|
|
|
|
|
|
# Youre in grave danger
|
|
|
|
"config/yigd.toml" = "${modpack}/config/yigd.toml";
|
|
|
|
};
|
|
|
|
|
|
|
|
# Value of systemd's `Restart=` service configuration option.
|
|
|
|
restart = "no";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
# Each server will be under a subdirectory named after the server name.
|
2024-10-16 04:59:59 +08:00
|
|
|
dataDir = "/srv/minecraft";
|
2024-06-03 20:53:43 +08:00
|
|
|
|
|
|
|
# Open firewall for all servers.
|
|
|
|
openFirewall = true;
|
|
|
|
|
|
|
|
# https://account.mojang.com/documents/minecraft_eula
|
|
|
|
eula = true;
|
|
|
|
};
|
2024-06-05 21:14:22 +08:00
|
|
|
|
|
|
|
services.traefik.dynamicConfigOptions.http.routers = {
|
|
|
|
minecraft = {
|
|
|
|
rule = "Host(`minecraft.kanto.dev`)";
|
|
|
|
entryPoints = [
|
|
|
|
"websecure"
|
|
|
|
];
|
|
|
|
middlewares = [
|
|
|
|
"internal"
|
|
|
|
];
|
|
|
|
service = "minecraft";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.traefik.dynamicConfigOptions.http.services = {
|
|
|
|
minecraft.loadBalancer.servers = [
|
2024-08-08 09:02:42 +08:00
|
|
|
{url = "http://127.0.0.1:${toString config.services.minecraft-servers.servers.kanto.serverProperties.server-port}";}
|
2024-06-05 21:14:22 +08:00
|
|
|
];
|
|
|
|
};
|
2024-10-16 04:59:59 +08:00
|
|
|
|
|
|
|
environment.persistence."/persist" = {
|
|
|
|
directories = [
|
|
|
|
{
|
|
|
|
directory = "/srv/minecraft";
|
|
|
|
user = "minecraft";
|
|
|
|
group = "minecraft";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2024-06-03 20:53:43 +08:00
|
|
|
}
|