migrate minecraft to container

This commit is contained in:
♥ Minnie ♥ 2024-01-23 09:43:33 +08:00
parent 47bae37e86
commit 4020891021
No known key found for this signature in database
2 changed files with 19 additions and 24 deletions

View file

@ -0,0 +1,19 @@
{ ... }:
{
virtualisation.oci-containers.containers = {
minecraft = {
autoStart = true;
image = "itzg/minecraft-server";
ports = [
"25565:25565"
];
volumes = [
"/srv/containers/minecraft:/data:rw"
];
environment = {
EULA = "true";
};
};
};
}

View file

@ -1,24 +0,0 @@
{ pkgs, ... }:
{
# Sandbox game developed by Mojang Studios
services.minecraft-server = {
enable = true;
package = pkgs.unstable.minecraft-server;
openFirewall = true;
dataDir = "/var/lib/minecraft";
declarative = true;
serverProperties = {
gamemode = "survival";
level-name = "kanto.dev";
difficulty = "easy";
server-port = 25565;
motd = "Welcome to our little private place!";
};
eula = true;
};
environment.persistence."/persist" = {
directories = [ "/var/lib/minecraft" ];
};
}