diff options
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/services/nixos/agate.nix | 22 | ||||
| -rw-r--r-- | modules/services/nixos/default.nix | 2 | ||||
| -rw-r--r-- | modules/services/nixos/minecraft.nix | 28 | ||||
| -rw-r--r-- | modules/services/options.nix | 21 |
4 files changed, 73 insertions, 0 deletions
diff --git a/modules/services/nixos/agate.nix b/modules/services/nixos/agate.nix new file mode 100644 index 0000000..f1593e6 --- /dev/null +++ b/modules/services/nixos/agate.nix @@ -0,0 +1,22 @@ +{ + lib, + config, + ... +}: let + cfg = config.collinux.services.agate; +in + lib.mkIf cfg.enable { + services.agate = { + enable = true; + addresses = [ + "0.0.0.0:1965" + ]; + hostnames = [cfg.publicUrl]; + + onlyTls_1_3 = true; + + contentDir = "/media/public/gmi"; + }; + + networking.firewall.allowedTCPPorts = [1965]; + } diff --git a/modules/services/nixos/default.nix b/modules/services/nixos/default.nix index 8f7c929..d0e170c 100644 --- a/modules/services/nixos/default.nix +++ b/modules/services/nixos/default.nix @@ -11,6 +11,8 @@ ./polaris.nix # ./mopidy.nix # ./jellyfin.nix + ./agate.nix + ./minecraft.nix ./copyparty.nix ./qbittorrent.nix ]; diff --git a/modules/services/nixos/minecraft.nix b/modules/services/nixos/minecraft.nix new file mode 100644 index 0000000..ed3ee1a --- /dev/null +++ b/modules/services/nixos/minecraft.nix @@ -0,0 +1,28 @@ +{ + lib, + config, + ... +}: let + cfg = config.collinux.services.minecraft; +in + lib.mkIf cfg.enable { + networking.firewall.allowedUDPPorts = lib.optional (cfg.listenAddr == "0.0.0.0") cfg.port; + + virtualisation.oci-containers.containers."Minecraft" = { + environment = { + EULA = "TRUE"; + EMIT_SERVER_TELEMETRY = "true"; + + SERVER_NAME = "YServer"; + TZ = config.time.timeZone; + VERSION = "1.21.131.1"; + CONTENT_LOG_FILE_ENABLED = "false"; + + ALLOW_CHEATS = "false"; + DIFFICULTY = "1"; + }; + image = "itzg/minecraft-bedrock-server"; + ports = ["${cfg.listenAddr}:${toString cfg.port}:19132/udp"]; + volumes = ["/var/lib/minecraft/:/data"]; + }; + } diff --git a/modules/services/options.nix b/modules/services/options.nix index 16c5bea..5744471 100644 --- a/modules/services/options.nix +++ b/modules/services/options.nix @@ -98,6 +98,14 @@ in { reverse_proxy = false; }; + agate = { + enable = mkEnableOption "Agate Gemini Protocol Server"; + publicUrl = mkOption { + description = "domain to run this gemini server on"; + type = lib.types.str; + }; + }; + polaris = webserviceOptions { service_name = "polaris"; default_port = 8079; @@ -135,6 +143,19 @@ in { }; }; + minecraft = { + enable = mkEnableOption "Minecraft bedrock server"; + listenAddr = mkOption { + description = "Address to listen on"; + type = ipAddr; + default = "127.0.0.1"; + }; + port = mkOption { + type = lib.types.port; + default = 19132; + }; + }; + caddy = { enable = mkEnableOption "caddy https server"; envFile = mkOption { |
