mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 14:54:29 +01:00
25bef2d8f9
The library does not depend on stdenv, that `stdenv` exposes `lib` is an artifact of the ancient origins of nixpkgs.
37 lines
949 B
Nix
37 lines
949 B
Nix
let
|
|
seed = "2151901553968352745";
|
|
rcon-pass = "foobar";
|
|
rcon-port = 43000;
|
|
in import ./make-test-python.nix ({ pkgs, ... }: {
|
|
name = "minecraft-server";
|
|
meta = with pkgs.lib.maintainers; { maintainers = [ nequissimus ]; };
|
|
|
|
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;
|
|
online-mode = false;
|
|
"rcon.password" = rcon-pass;
|
|
"rcon.port" = rcon-port;
|
|
};
|
|
};
|
|
|
|
virtualisation.memorySize = 2048;
|
|
};
|
|
|
|
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'"
|
|
)
|
|
'';
|
|
})
|