From c9b9cf00b111480f403cc6a38f4c68ebc69cdc01 Mon Sep 17 00:00:00 2001 From: Victor Mignot Date: Sat, 26 Oct 2024 15:15:06 +0200 Subject: [PATCH] camelot: Add minecraft server --- configurations/camelot/default.nix | 1 + modules/server/default.nix | 1 + modules/server/minecraft.nix | 22 ++++++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 modules/server/minecraft.nix diff --git a/configurations/camelot/default.nix b/configurations/camelot/default.nix index d299993..27ef456 100644 --- a/configurations/camelot/default.nix +++ b/configurations/camelot/default.nix @@ -55,6 +55,7 @@ my.server.mollysocket.enable = true; my.server.blog.enable = true; + my.server.papermc.enable = true; my.users = { dala = { diff --git a/modules/server/default.nix b/modules/server/default.nix index e27f02c..664bfe4 100644 --- a/modules/server/default.nix +++ b/modules/server/default.nix @@ -5,5 +5,6 @@ ./nginx.nix ./mollysocket.nix ./blog.nix + ./minecraft.nix ]; } diff --git a/modules/server/minecraft.nix b/modules/server/minecraft.nix new file mode 100644 index 0000000..6df2f86 --- /dev/null +++ b/modules/server/minecraft.nix @@ -0,0 +1,22 @@ +{ + pkgs, + lib, + config, + ... +}: +with lib; +{ + options.my.server.papermc.enable = mkOption { + type = types.bool; + default = false; + }; + + config = mkIf config.my.server.papermc.enable { + services.minecraft-server = { + enable = true; + package = pkgs.papermc; + dataDir = "/srv/minecraft"; + openFirewall = true; + }; + }; +}