summaryrefslogtreecommitdiff
path: root/nixos/modules/homelab/games/minecraft.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/homelab/games/minecraft.nix')
-rw-r--r--nixos/modules/homelab/games/minecraft.nix63
1 files changed, 63 insertions, 0 deletions
diff --git a/nixos/modules/homelab/games/minecraft.nix b/nixos/modules/homelab/games/minecraft.nix
new file mode 100644
index 0000000..44c09fb
--- /dev/null
+++ b/nixos/modules/homelab/games/minecraft.nix
@@ -0,0 +1,63 @@
+{ config, lib, pkgs, inputs, ... }: let
+ cfg = config.homelab.games.minecraft;
+in {
+ imports = [ inputs.nix-minecraft.nixosModules.minecraft-servers ];
+
+ options.homelab.games.minecraft.enable = lib.mkEnableOption "minecraft servers";
+
+ config = lib.mkIf cfg.enable {
+ nixpkgs.overlays = [ inputs.nix-minecraft.overlay ];
+ environment.systemPackages = [ pkgs.packwiz ];
+
+ networking.firewall.allowedUDPPorts = [ /*svc*/ 24454 ];
+
+ environment.shellAliases = {
+ "serverconsole" = "${pkgs.tmux} -S /run/minecraft/outremonde.sock";
+ };
+
+ services.minecraft-servers = {
+
+ enable = true;
+ eula = true;
+ openFirewall = true;
+
+ servers = {
+
+ vanilla-1_21_1 = {
+ enable = false;
+ package = pkgs.vanillaServers.vanilla-1_21_1;
+ serverProperties = {
+ server-port = 25566;
+ };
+ };
+
+ fantasy = let
+ modpack = pkgs.fetchPackwizModpack {
+ url = "https://git.culsans.site/fantasy-minecraft-modpack.git/plain/pack.toml";
+ packHash = "sha256-BP1pnXNOkw7jdK6fl2fAVybfO2bD2AyWeLRjrTTsYeI=";
+ };
+ in {
+ 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";
+ };
+ jvmOpts = "-Xms6144M -Xmx6144M";
+ serverProperties = {
+ level-seed = "-5424614792051443123";
+ allow-flight = true;
+ spawn-protection = 0;
+ max-players = 10;
+ server-port = 25565;
+ difficulty = "normal";
+ motd = ''\u00a7f-------\u00a7d Fantasy\u00a7f ----------\u00a7r\n\u00a7f--\u00a7c Survival\u00a7f ---\u00a7b Multiplayer\u00a7f --'';
+ };
+ };
+ };
+ };
+ };
+}