diff options
| author | Devin Finlinson <devin.finlinson@pm.me> | 2025-06-26 14:45:23 -0600 |
|---|---|---|
| committer | Devin Finlinson <devin.finlinson@pm.me> | 2025-06-26 14:45:23 -0600 |
| commit | f1ccbea121e20505990c283531125c91cd052697 (patch) | |
| tree | 37fa9bcaa07c96c89f5ce2cccb30b0a1fa755f4f | |
| parent | 74a1f3bc5570470635ff1337de5dae08e1ae24c8 (diff) | |
minecraft modded server time
| -rw-r--r-- | flake.lock | 151 | ||||
| -rw-r--r-- | flake.nix | 2 | ||||
| -rw-r--r-- | modules/nixos/minecraft-server.nix | 44 |
3 files changed, 190 insertions, 7 deletions
@@ -182,6 +182,22 @@ "type": "github" } }, + "flake-compat_2": { + "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-utils": { "inputs": { "systems": "systems_2" @@ -218,6 +234,21 @@ "type": "github" } }, + "flake-utils_3": { + "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" + } + }, "flakey-profile": { "locked": { "lastModified": 1712898590, @@ -584,6 +615,22 @@ "url": "https://git.lix.systems/lix-project/nixos-module/archive/2.93.0.tar.gz" } }, + "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" + } + }, "microvm": { "inputs": { "flake-utils": "flake-utils_2", @@ -606,6 +653,47 @@ "type": "github" } }, + "mms": { + "inputs": { + "flake-compat": "flake-compat_2", + "flake-utils": "flake-utils_3", + "nix": "nix", + "nixpkgs": "nixpkgs_2" + }, + "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", + "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" + } + }, "nix-colors": { "inputs": { "base16-schemes": "base16-schemes", @@ -663,16 +751,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1750259320, - "narHash": "sha256-H8J4H2XCIMEJ5g6fZ179QfQvsc2dUqhqfBjC8RAHNRY=", - "owner": "nixos", + "lastModified": 1657693803, + "narHash": "sha256-G++2CJ9u0E7NNTAi9n5G8TdDmGJXcIjkJ3NF8cetQB8=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "9ba04bda9249d5d5e5238303c9755de5a49a79c5", + "rev": "365e1b3a859281cf11b94f87231adeabbdd878a2", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixos-25.05", + "owner": "NixOS", + "ref": "nixos-22.05-small", "repo": "nixpkgs", "type": "github" } @@ -692,6 +780,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" + } + }, "nixpkgs-unstable": { "locked": { "lastModified": 1750365781, @@ -708,6 +812,38 @@ "type": "github" } }, + "nixpkgs_2": { + "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_3": { + "locked": { + "lastModified": 1750259320, + "narHash": "sha256-H8J4H2XCIMEJ5g6fZ179QfQvsc2dUqhqfBjC8RAHNRY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "9ba04bda9249d5d5e5238303c9755de5a49a79c5", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-25.05", + "repo": "nixpkgs", + "type": "github" + } + }, "nushell-scripts": { "flake": false, "locked": { @@ -761,9 +897,10 @@ "hyprland": "hyprland", "lix-module": "lix-module", "microvm": "microvm", + "mms": "mms", "nix-colors": "nix-colors", "nixos-generators": "nixos-generators", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_3", "nixpkgs-unstable": "nixpkgs-unstable", "nushell-scripts": "nushell-scripts", "sops-nix": "sops-nix", @@ -58,6 +58,8 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + mms.url = "github:mkaito/nixos-modded-minecraft-servers"; + #secrets management, lock with git commit at 20xx/x/xx #......... diff --git a/modules/nixos/minecraft-server.nix b/modules/nixos/minecraft-server.nix new file mode 100644 index 0000000..8b83f34 --- /dev/null +++ b/modules/nixos/minecraft-server.nix @@ -0,0 +1,44 @@ +{ pkgs, config, inputs, ... } : +let + # Keys that can access the state of each instance (read/write!) over an rsync module + # Leave empty to disable + rsyncSSHKeys = config.users.users.defin.openssh.authorizedKeys.keys; + jre17 = pkgs.temurin-bin-17; + + defaults = { + # 5 minutes tick timeout, for heavy packs + max-tick-time = 5 * 60 * 1000; + # It just ain't modded minecraft without flying around + allow-flight = true; + }; +in { + # minecraft server is closed source + nixpkgs.config.allowUnfree = true; + + imports = [ inputs.mms.module ]; + services.modded-minecraft-servers = { + # This is mandatory for legal reasons. + eula = true; + + # the name will be used for the state folder and system user. + # in this case, the folder is '/var/lib/mc-deceasedcraft' + # and the user is 'mc-deceasedcraft' + deceasedcraft = { + enable = true; + inherit rsyncSSHKeys; + jvmMaxAllocation = "8G"; + jvmInitialAllocation = "2G"; + jvmPackage = jre17; + + # I believe these options match services.minecraft-server.serverProperties options + serverConfig = defaults // { + # Port must be unique + server-port = 25565; + rcon-port = 25566; + gamemode = "survival"; + motd = "Welcome to DeceasedCraft"; + max-players = 10; + }; + }; + }; +} |
