2020-11-28 17:42:46 +00:00
|
|
|
let
|
|
|
|
seed = "2151901553968352745";
|
|
|
|
rcon-pass = "foobar";
|
|
|
|
rcon-port = 43000;
|
|
|
|
in import ./make-test-python.nix ({ pkgs, ... }: {
|
|
|
|
name = "minecraft-server";
|
2021-01-10 19:08:30 +00:00
|
|
|
meta = with pkgs.lib.maintainers; { maintainers = [ nequissimus ]; };
|
2020-11-28 17:42:46 +00:00
|
|
|
|
|
|
|
nodes.server = { ... }: {
|
|
|
|
environment.systemPackages = [ pkgs.mcrcon ];
|
|
|
|
|
|
|
|
nixpkgs.config.allowUnfree = true;
|
|
|
|
|
|
|
|
services.minecraft-server = {
|
|
|
|
declarative = true;
|
|
|
|
enable = true;
|
|
|
|
eula = true;
|
|
|
|
serverProperties = {
|
|
|
|
enable-rcon = true;
|
|
|
|
level-seed = seed;
|
2022-08-25 18:21:33 +01:00
|
|
|
level-type = "flat";
|
|
|
|
generate-structures = false;
|
2020-11-28 17:42:46 +00:00
|
|
|
online-mode = false;
|
|
|
|
"rcon.password" = rcon-pass;
|
|
|
|
"rcon.port" = rcon-port;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-05-15 00:17:51 +01:00
|
|
|
virtualisation.memorySize = 2047;
|
2020-11-28 17:42:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
|
|
|
server.wait_for_unit("minecraft-server")
|
|
|
|
server.wait_for_open_port(${toString rcon-port})
|
|
|
|
assert "${seed}" in server.succeed(
|
|
|
|
"mcrcon -H localhost -P ${toString rcon-port} -p '${rcon-pass}' -c 'seed'"
|
|
|
|
)
|
2022-07-21 20:05:43 +01:00
|
|
|
server.succeed("systemctl stop minecraft-server")
|
2020-11-28 17:42:46 +00:00
|
|
|
'';
|
|
|
|
})
|