cleanup minecraft test

This commit is contained in:
2026-01-22 22:40:40 -05:00
parent fdb1b559bc
commit a766e67fec
3 changed files with 24 additions and 42 deletions

View File

@@ -6,6 +6,17 @@
...
}:
let
testServiceConfigs = {
minecraft = {
server_name = "main";
parent_dir = "/var/lib/minecraft";
};
https = {
domain = "test.local";
};
zpool_ssds = "";
};
# Create pkgs with nix-minecraft overlay and unfree packages allowed
testPkgs = import inputs.nixpkgs {
system = pkgs.stdenv.targetPlatform.system;
@@ -15,42 +26,21 @@ let
(import ../modules/overlays.nix)
];
};
# Create a wrapper module that imports the actual minecraft service
minecraftService =
{ config, ... }:
{
imports = [
(import ../services/minecraft.nix {
inherit lib config inputs;
pkgs = testPkgs;
service_configs = {
minecraft = {
server_name = "main";
parent_dir = "/var/lib/minecraft";
};
https = {
domain = "test.local";
};
zpool_ssds = "";
};
username = "testuser";
})
];
# Override nixpkgs config to prevent conflicts in test environment
nixpkgs.config = lib.mkForce {
allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "minecraft-server" ];
};
};
in
testPkgs.testers.runNixOSTest {
name = "minecraft server startup test";
node.specialArgs = {
inherit inputs lib;
service_configs = testServiceConfigs;
username = "testuser";
};
nodes.machine =
{ ... }:
{ lib, ... }:
{
imports = [
minecraftService
../services/minecraft.nix
];
# Enable caddy service (required by minecraft service)