diff options
Diffstat (limited to 'nixos/modules/homelab/games/minecraft.nix')
| -rw-r--r-- | nixos/modules/homelab/games/minecraft.nix | 95 |
1 files changed, 74 insertions, 21 deletions
diff --git a/nixos/modules/homelab/games/minecraft.nix b/nixos/modules/homelab/games/minecraft.nix index 02f3771..7aa620a 100644 --- a/nixos/modules/homelab/games/minecraft.nix +++ b/nixos/modules/homelab/games/minecraft.nix @@ -7,15 +7,27 @@ in { config = lib.mkIf cfg.enable { nixpkgs.overlays = [ inputs.nix-minecraft.overlay ]; - environment.systemPackages = [ pkgs.packwiz ]; - - networking.firewall.allowedUDPPorts = [ /*svc*/ 24454 ]; + environment.systemPackages = [ + pkgs.packwiz + (pkgs.writeShellScriptBin "mcconsole" '' + if [ -z "$1" ]; then + name="fantasy" + else + name="$1" + fi - environment.shellAliases = { - "serverconsole" = "${pkgs.tmux} -S /run/minecraft/outremonde.sock"; - }; + sudo ${lib.getExe pkgs.tmux} -S "/run/minecraft/$name.sock" attach + '') + ]; + + networking.firewall.allowedUDPPorts = [ /*svc*/ 24454 24453 ]; - services.minecraft-servers = { + services.minecraft-servers = let + fantasy-modpack = pkgs.fetchPackwizModpack { + url = "https://git.lucia.garden/fantasy-minecraft-modpack.git/plain/pack.toml"; + packHash = "sha256-UxL5gKBMHyRGGZzGeoo9jJ+sXXC6huqqp20mmaO0GPs="; + }; + in { enable = true; eula = true; @@ -31,32 +43,73 @@ in { }; }; - fantasy = let - modpack = pkgs.fetchPackwizModpack { - url = "https://git.lucia.garden/fantasy-minecraft-modpack.git/plain/pack.toml"; - packHash = "sha256-BP1pnXNOkw7jdK6fl2fAVybfO2bD2AyWeLRjrTTsYeI="; - }; - in { + fantasy = { enable = true; package = pkgs.fabricServers.fabric-1_20_1; symlinks = { - "mods" = "${modpack}/mods"; - "config/additional-additions-config.json" = "${modpack}/config/additional-additions-config.json"; - "config/configurabledespawntimer.json5" = "${modpack}/config/configurabledespawntimer.json5"; - "config/fwaystones/config.json5" = "${modpack}/config/fwaystones/config.json5"; - "config/simplebackup.json5" = "${modpack}/config/simplebackup.json5"; + "mods" = "${fantasy-modpack}/mods"; + "config/additional-additions-config.json" = "${fantasy-modpack}/config/additional-additions-config.json"; + "config/fwaystones/config.json5" = "${fantasy-modpack}/config/fwaystones/config.json5"; + "config/simplebackup.json5" = "${fantasy-modpack}/config/simplebackup.json5"; }; - jvmOpts = "-Xms6144M -Xmx6144M"; + jvmOpts = "-Xms8192M -Xmx8192M"; serverProperties = { level-seed = "-5424614792051443123"; allow-flight = true; spawn-protection = 0; - max-players = 10; + max-players = 6; server-port = 25565; + simulation-distance = 8; + view-distance = 12; + difficulty = "normal"; + # motd = ''\u00a7f-------\u00a7d Fantasy\u00a7f ----------\u00a7r\n\u00a7f--\u00a7c Survival\u00a7f ---\u00a7b Multiplayer\u00a7f --''; + motd = ''\u00a7r \u00a7f------------ << \u00a7dlucia\u00a7f.\u00a72garden\u00a7f >> ------------\u00a7r\n\u00a7l \u00a7f--------- << \u00a7cSurvival \u00a7eMultiplayer \u00a7f>> ---------''; + }; + }; + + fantasy-testing = { + enable = true; + package = pkgs.fabricServers.fabric-1_20_1; + symlinks = { + "mods" = "${fantasy-modpack}/mods"; + "config/additional-additions-config.json" = "${fantasy-modpack}/config/additional-additions-config.json"; + "config/configurabledespawntimer.json5" = "${fantasy-modpack}/config/configurabledespawntimer.json5"; + "config/fwaystones/config.json5" = "${fantasy-modpack}/config/fwaystones/config.json5"; + "config/simplebackup.json5" = "${fantasy-modpack}/config/simplebackup.json5"; + # Change the voice chat port, if it is the same as another server it will crash + "config/voicechat/voicechat-server.properties" = pkgs.writeText "voicechat-config" '' + port=24453 + bind_address= + max_voice_distance=48.0 + whisper_distance=24.0 + codec=VOIP + mtu_size=1024 + keep_alive=1000 + enable_groups=true + voice_host= + allow_recording=true + spectator_interaction=false + spectator_player_possession=false + force_voice_chat=false + login_timeout=10000 + broadcast_range=-1.0 + allow_pings=true + use_natives=true + ''; + }; + jvmOpts = "-Xms4096M -Xmx4096M"; + serverProperties = { + level-seed = "-5424614792051443123"; + allow-flight = true; + spawn-protection = 0; + max-players = 4; + server-port = 20000; difficulty = "normal"; - motd = ''\u00a7f-------\u00a7d Fantasy\u00a7f ----------\u00a7r\n\u00a7f--\u00a7c Survival\u00a7f ---\u00a7b Multiplayer\u00a7f --''; + gamemode = "creative"; + motd = ''\u00a7f-------\u00a7d Fantasy\u00a7f ----------\u00a7r\n\u00a7f--\u00a7c Creative\u00a7f ---\u00a7b Multiplayer\u00a7f --''; }; }; + }; }; }; |
