From b5fcea3c757a5c6e22fc1a571605688b08037fe2 Mon Sep 17 00:00:00 2001 From: Jade Date: Mon, 8 May 2023 07:17:06 +0200 Subject: [PATCH] Added modded mc servers and stuff --- flake.lock | 139 +++++++++++++++++++++++++++++++++++++++++- flake.nix | 3 + modules/modded-mc.nix | 38 ++++++++++++ modules/mumble.nix | 10 +++ modules/proxy.nix | 4 ++ 5 files changed, 193 insertions(+), 1 deletion(-) create mode 100644 modules/modded-mc.nix create mode 100644 modules/mumble.nix diff --git a/flake.lock b/flake.lock index be643a8..9ee891c 100644 --- a/flake.lock +++ b/flake.lock @@ -20,6 +20,22 @@ "type": "github" } }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1668681692, + "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "009399224d5e398d03b22badca40a37ac85412a1", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -41,6 +57,21 @@ "type": "github" } }, + "flake-utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "haskell-flake": { "locked": { "lastModified": 1675296942, @@ -57,6 +88,63 @@ "type": "github" } }, + "lowdown-src": { + "flake": false, + "locked": { + "lastModified": 1633514407, + "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", + "owner": "kristapsdz", + "repo": "lowdown", + "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", + "type": "github" + }, + "original": { + "owner": "kristapsdz", + "repo": "lowdown", + "type": "github" + } + }, + "mms": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "nix": "nix", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1669478601, + "narHash": "sha256-IQcS8IPeXvSoIrQRPgtnLxAs0Pkh8wmglDAtqE4ivNo=", + "owner": "mkaito", + "repo": "nixos-modded-minecraft-servers", + "rev": "68f2066499c035fd81c9dacfea2f512d6b0b62e5", + "type": "github" + }, + "original": { + "owner": "mkaito", + "repo": "nixos-modded-minecraft-servers", + "type": "github" + } + }, + "nix": { + "inputs": { + "lowdown-src": "lowdown-src", + "nixpkgs": "nixpkgs_2", + "nixpkgs-regression": "nixpkgs-regression" + }, + "locked": { + "lastModified": 1669449054, + "narHash": "sha256-aCpXrNpyFH6b1NFYGj2i/HecUvz2vZ88aEyDs1Xj8yM=", + "owner": "NixOS", + "repo": "nix", + "rev": "534332c8a03b64161ec795d1deb2ba3d48f27be1", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nix", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1676300157, @@ -73,6 +161,22 @@ "type": "github" } }, + "nixpkgs-regression": { + "locked": { + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + } + }, "nixpkgsUnstable": { "locked": { "lastModified": 1683014792, @@ -90,6 +194,38 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1657693803, + "narHash": "sha256-G++2CJ9u0E7NNTAi9n5G8TdDmGJXcIjkJ3NF8cetQB8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "365e1b3a859281cf11b94f87231adeabbdd878a2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.05-small", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1669378442, + "narHash": "sha256-nm+4PN0A4SnV0SzEchxrMyKPvI3Ld/aoom4PnHeHucs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0faaf0a9bb6dedb69bfd43ac06fb27fadc476c51", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { "locked": { "lastModified": 1683028696, "narHash": "sha256-saPKTDj+HB9aPvB59wGcJ64CifRuiIt2CHvSbh7UHz8=", @@ -108,7 +244,8 @@ "root": { "inputs": { "arion": "arion", - "nixpkgs": "nixpkgs_2", + "mms": "mms", + "nixpkgs": "nixpkgs_4", "nixpkgsUnstable": "nixpkgsUnstable" } } diff --git a/flake.nix b/flake.nix index 0fca916..c9cd7d5 100644 --- a/flake.nix +++ b/flake.nix @@ -4,6 +4,7 @@ nixpkgsUnstable.url = "github:NixOS/nixpkgs/nixos-unstable"; #nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; arion.url = "github:hercules-ci/arion"; + mms.url = "github:mkaito/nixos-modded-minecraft-servers"; }; outputs = { self, nixpkgs, nixpkgsUnstable, ... }@inputs: @@ -41,6 +42,8 @@ ./modules/containers ./modules/keycloak.nix ./modules/forgejo.nix + ./modules/mumble.nix + ./modules/modded-mc.nix ]; system.stateVersion = "22.11"; diff --git a/modules/modded-mc.nix b/modules/modded-mc.nix new file mode 100644 index 0000000..ce272c3 --- /dev/null +++ b/modules/modded-mc.nix @@ -0,0 +1,38 @@ +{ pkgs, inputs, ... }: +{ + imports = [ inputs.mms.module ]; + + environment.systemPackages = with pkgs; [ temurin-jre-bin ]; + + services.modded-minecraft-servers = { + eula = true; + + # The name will be used for the state folder and system user. + # In this case, the folder is `/var/lib/mc-e2es` + # and the user `mc-e2es`. + instances = { + "catpile-v1" = { + enable = true; + + jvmPackage = pkgs.temurin-jre-bin; + + # Keys that can access the state of this instance (read/write!) over an rsync module + # Leave empty to disable + rsyncSSHKeys = [ + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDu9lhNUjovmaeUczUv18GVoSp8Xo8Izi+HSxC7Go3YOTkaijMB4fCWIIQ/MZkKd7BG0OLPwbNSFrP7XrLxyXbMfNNoOBHTtQv85HwRP7XcvsYomHrdtcU3Nf49/MSXA4z42FqzUF114+D0czJz+Nxer+MbEHqAKZRjNuHOizKv8Rqq2hkwTL/Oi3fQxNaj/rHKth0/8BqcUixxofY/e48E+3SAEUJhb/h4m8nyvecKtyfAdxvPg3ZVi+vWZTeY8aoMRliw6kho59tBzumiXsRve0FyFbGx/t/T3zR2dxBZ63LSePhiTO3XdE3spSq/gzsZRNkxxoSWHiW6xrXQAgoyBGPp0ISw3ljtDgTgaJ5JS9JYRKpkfHDlsBKuLpeoD4i6Ts2Z+0dyFnVyBs64bwY7PyqRtS9l/EM/f2VxfsndWMoCuGFCZSS2WbONirqp6e7czxCQ2iqShYKzfupbTf8eYV1i4+VTJE1Qs0oFbmcwZDJbHqaUZn2aeS7fW9pYrA0= jade@monosodium-glutamate-g" + ]; + + serverConfig = { + # Port must be unique + server-port = 25566; + motd = "Be excellent to eachother"; + + white-list = true; + spawn-protection = 0; + max-tick-time = 5 * 60 * 1000; + allow-flight = true; + }; + }; + }; + }; +} diff --git a/modules/mumble.nix b/modules/mumble.nix new file mode 100644 index 0000000..c1fdd5d --- /dev/null +++ b/modules/mumble.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: +{ + services.murmur = { + enable = true; + openFirewall = true; + registerHostname = "mumble.katzen.cafe"; + sslKey = "/var/lib/acme/mumble.katzen.cafe/key.pem"; + sslCert = "/var/lib/acme/mumble.katzen.cafe/cert.pem"; + }; +} diff --git a/modules/proxy.nix b/modules/proxy.nix index d703124..58a966b 100644 --- a/modules/proxy.nix +++ b/modules/proxy.nix @@ -31,6 +31,10 @@ group = "nginx"; keyType = "rsa4096"; }; + "mumble.katzen.cafe" = { + group = "murmur"; + keyType = "rsa4096"; + }; }; }; services.nginx = {