From 275bf10ab595309d520d51f8a79bf20ef4679ecf Mon Sep 17 00:00:00 2001 From: sterni Date: Thu, 30 Nov 2023 22:18:25 +0100 Subject: chore(sterni/machines): move minecraft from edwin to ingeborg Change-Id: I6917a9633c998148d6e5d23b17d949ee007898e5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10180 Tested-by: BuildkiteCI Reviewed-by: sterni --- users/sterni/machines/edwin/default.nix | 1 - users/sterni/machines/edwin/minecraft.nix | 121 --------------------------- users/sterni/machines/ingeborg/default.nix | 1 + users/sterni/machines/ingeborg/minecraft.nix | 121 +++++++++++++++++++++++++++ 4 files changed, 122 insertions(+), 122 deletions(-) delete mode 100644 users/sterni/machines/edwin/minecraft.nix create mode 100644 users/sterni/machines/ingeborg/minecraft.nix (limited to 'users/sterni') diff --git a/users/sterni/machines/edwin/default.nix b/users/sterni/machines/edwin/default.nix index 16951d04f951..00b2851e4eeb 100644 --- a/users/sterni/machines/edwin/default.nix +++ b/users/sterni/machines/edwin/default.nix @@ -11,7 +11,6 @@ ./network.nix # These modules configure services, websites etc. (depot.path.origSrc + "/ops/modules/btrfs-auto-scrub.nix") - ./minecraft.nix ./gopher.nix ./http/sterni.lv.nix ./http/code.sterni.lv.nix diff --git a/users/sterni/machines/edwin/minecraft.nix b/users/sterni/machines/edwin/minecraft.nix deleted file mode 100644 index ae367c5988df..000000000000 --- a/users/sterni/machines/edwin/minecraft.nix +++ /dev/null @@ -1,121 +0,0 @@ -{ pkgs, depot, config, ... }: - -let - carpet = pkgs.fetchurl { - url = "https://github.com/gnembon/fabric-carpet/releases/download/1.4.101/fabric-carpet-1.19.4-1.4.101+v230319.jar"; - sha256 = "1zppsl3x9iaj616phrllc8hirj4f5wqdjf6f9w2nm0mkxr66z10l"; - }; - - carpet-extra = pkgs.fetchurl { - url = "https://github.com/gnembon/carpet-extra/releases/download/1.4.100/carpet-extra-1.19.4-1.4.100.jar"; - sha256 = "1x3jh7nds5kkda445sbcgnz5fvw42f4pq0pvarz7rf9wgkz15i8r"; - }; - - userGroup = "minecraft"; - - makeJvmOpts = megs: [ - "-Xms${toString megs}M" - "-Xmx${toString megs}M" - ]; - - whitelist = { - spreadwasser = "242a66eb-2df2-4585-9a28-ac763ad0d0f9"; - sternenseemann = "d8e48069-1905-4886-a5da-a4ee917ee254"; - }; - - rconPasswordFile = config.age.secretsDir + "/minecraft-rcon"; - - baseProperties = { - white-list = true; - allow-flight = true; - difficulty = "hard"; - function-permission-level = 4; - snooper-enabled = false; - view-distance = 12; - sync-chunk-writes = "false"; # the single biggest performance fix - max-tick-time = 6000000; # TODO(sterni): disable watchdog via carpet - enforce-secure-profile = false; - }; -in - -# TODO(sterni): regular backups of carpet world - -{ - imports = [ - ../../modules/minecraft-fabric.nix - ]; - - config = { - environment.systemPackages = [ - pkgs.mcrcon - pkgs.jre - ]; - - users = { - users."${userGroup}" = { - isNormalUser = true; - openssh.authorizedKeys.keys = depot.users.sterni.keys.all; - shell = "${pkgs.fish}/bin/fish"; - }; - - groups."${userGroup}" = { }; - }; - - age.secrets = { - minecraft-rcon.file = depot.users.sterni.secrets."minecraft-rcon.age"; - }; - - services.minecraft-fabric-server = { - creative = { - enable = false; # not actively used - version = "1.19.4"; - mods = [ - carpet - carpet-extra - ]; - world = config.users.users.${userGroup}.home + "/worlds/creative"; - - jvmOpts = makeJvmOpts 2048; - user = userGroup; - group = userGroup; - - inherit whitelist rconPasswordFile; - ops = whitelist; - - serverProperties = baseProperties // { - server-port = 25566; - "rcon.port" = 25576; - gamemode = "creative"; - enable-command-block = true; - motd = "storage design server"; - spawn-protection = 2; - }; - }; - - carpet = { - enable = true; - version = "1.19.4"; - mods = [ - carpet - carpet-extra - ]; - world = config.users.users.${userGroup}.home + "/worlds/carpet"; - - jvmOpts = makeJvmOpts 4096; - user = userGroup; - group = userGroup; - - inherit whitelist rconPasswordFile; - ops = whitelist; - - serverProperties = baseProperties // { - server-port = 25565; - "rcon.port" = 25575; - motd = "ich tu fleissig hustlen nenn mich bob der baumeister"; - - level-seed = 7240251176989694927; # for posterity - }; - }; - }; - }; -} diff --git a/users/sterni/machines/ingeborg/default.nix b/users/sterni/machines/ingeborg/default.nix index 311a4b8d3fc0..206d3fcf53a7 100644 --- a/users/sterni/machines/ingeborg/default.nix +++ b/users/sterni/machines/ingeborg/default.nix @@ -12,6 +12,7 @@ # (More or less) pluggable service configuration (depot.path.origSrc + "/ops/modules/btrfs-auto-scrub.nix") ./monitoring.nix + ./minecraft.nix ]; config = { diff --git a/users/sterni/machines/ingeborg/minecraft.nix b/users/sterni/machines/ingeborg/minecraft.nix new file mode 100644 index 000000000000..ae367c5988df --- /dev/null +++ b/users/sterni/machines/ingeborg/minecraft.nix @@ -0,0 +1,121 @@ +{ pkgs, depot, config, ... }: + +let + carpet = pkgs.fetchurl { + url = "https://github.com/gnembon/fabric-carpet/releases/download/1.4.101/fabric-carpet-1.19.4-1.4.101+v230319.jar"; + sha256 = "1zppsl3x9iaj616phrllc8hirj4f5wqdjf6f9w2nm0mkxr66z10l"; + }; + + carpet-extra = pkgs.fetchurl { + url = "https://github.com/gnembon/carpet-extra/releases/download/1.4.100/carpet-extra-1.19.4-1.4.100.jar"; + sha256 = "1x3jh7nds5kkda445sbcgnz5fvw42f4pq0pvarz7rf9wgkz15i8r"; + }; + + userGroup = "minecraft"; + + makeJvmOpts = megs: [ + "-Xms${toString megs}M" + "-Xmx${toString megs}M" + ]; + + whitelist = { + spreadwasser = "242a66eb-2df2-4585-9a28-ac763ad0d0f9"; + sternenseemann = "d8e48069-1905-4886-a5da-a4ee917ee254"; + }; + + rconPasswordFile = config.age.secretsDir + "/minecraft-rcon"; + + baseProperties = { + white-list = true; + allow-flight = true; + difficulty = "hard"; + function-permission-level = 4; + snooper-enabled = false; + view-distance = 12; + sync-chunk-writes = "false"; # the single biggest performance fix + max-tick-time = 6000000; # TODO(sterni): disable watchdog via carpet + enforce-secure-profile = false; + }; +in + +# TODO(sterni): regular backups of carpet world + +{ + imports = [ + ../../modules/minecraft-fabric.nix + ]; + + config = { + environment.systemPackages = [ + pkgs.mcrcon + pkgs.jre + ]; + + users = { + users."${userGroup}" = { + isNormalUser = true; + openssh.authorizedKeys.keys = depot.users.sterni.keys.all; + shell = "${pkgs.fish}/bin/fish"; + }; + + groups."${userGroup}" = { }; + }; + + age.secrets = { + minecraft-rcon.file = depot.users.sterni.secrets."minecraft-rcon.age"; + }; + + services.minecraft-fabric-server = { + creative = { + enable = false; # not actively used + version = "1.19.4"; + mods = [ + carpet + carpet-extra + ]; + world = config.users.users.${userGroup}.home + "/worlds/creative"; + + jvmOpts = makeJvmOpts 2048; + user = userGroup; + group = userGroup; + + inherit whitelist rconPasswordFile; + ops = whitelist; + + serverProperties = baseProperties // { + server-port = 25566; + "rcon.port" = 25576; + gamemode = "creative"; + enable-command-block = true; + motd = "storage design server"; + spawn-protection = 2; + }; + }; + + carpet = { + enable = true; + version = "1.19.4"; + mods = [ + carpet + carpet-extra + ]; + world = config.users.users.${userGroup}.home + "/worlds/carpet"; + + jvmOpts = makeJvmOpts 4096; + user = userGroup; + group = userGroup; + + inherit whitelist rconPasswordFile; + ops = whitelist; + + serverProperties = baseProperties // { + server-port = 25565; + "rcon.port" = 25575; + motd = "ich tu fleissig hustlen nenn mich bob der baumeister"; + + level-seed = 7240251176989694927; # for posterity + }; + }; + }; + }; +} -- cgit 1.4.1