Fix minecraft server so saving works
Some checks failed
/ check (push) Failing after 3m0s

This commit is contained in:
Daniel Flanagan 2024-10-10 11:46:03 -05:00
parent 2b4b1c5850
commit 303ca8c871
3 changed files with 29 additions and 12 deletions

View file

@ -407,6 +407,7 @@
virtual-machines-gui virtual-machines-gui
laptop laptop
gaming gaming
cross-compiler
./nixos/foxtrot.nix ./nixos/foxtrot.nix

View file

@ -351,6 +351,10 @@
}; };
}; };
cross-compiler = {config, ...}: {
boot.binfmt.emulatedSystems = ["aarch64-linux"];
};
default-nix-configuration-and-overlays = { default-nix-configuration-and-overlays = {
lib, lib,
config, config,
@ -362,7 +366,7 @@
modifications modifications
unstable-packages unstable-packages
]; ];
# config.allowUnfree = true; config.allowUnfree = true;
}; };
nix = { nix = {
@ -373,6 +377,8 @@
trusted-users = ["root" "daniel"]; trusted-users = ["root" "daniel"];
experimental-features = lib.mkDefault ["nix-command" "flakes"]; experimental-features = lib.mkDefault ["nix-command" "flakes"];
extra-platforms = ["aarch64-linux"];
substituters = [ substituters = [
# TODO: dedupe with flake's config? is that even necessary? # TODO: dedupe with flake's config? is that even necessary?
"https://cache.nixos.org/" "https://cache.nixos.org/"

View file

@ -1112,26 +1112,27 @@ sudo nix run nixpkgs#ipmitool -- raw 0x30 0x30 0x02 0xff 0x00
port = 26969; port = 26969;
dir = "/storage/flanilla"; dir = "/storage/flanilla";
user = "flanilla"; user = "flanilla";
uid = config.users.users.flanilla.uid; # uid = config.users.users.flanilla.uid;
gid = config.users.groups.flanilla.gid; # gid = config.users.groups.flanilla.gid;
in { in {
# flanilla family minecraft server # flanilla family minecraft server
users.groups.${user} = {}; users.groups.${user} = {};
users.users.${user} = { users.users.${user} = {
isSystemUser = true; isSystemUser = true;
createHome = false; createHome = false;
home = dir;
group = user; group = user;
}; };
virtualisation.oci-containers.containers.minecraft-flanilla = { virtualisation.oci-containers.containers.minecraft-flanilla = {
autoStart = true; autoStart = false;
image = "docker.io/itzg/minecraft-server"; image = "docker.io/itzg/minecraft-server";
user = "${toString uid}:${toString gid}"; # user = "${toString uid}:${toString gid}";
extraOptions = ["--tty" "--interactive"]; extraOptions = ["--tty" "--interactive"];
environment = { environment = {
EULA = "true"; EULA = "true";
MOTD = "Flanilla Survival! Happy hunting!"; MOTD = "Flanilla Survival! Happy hunting!";
UID = toString uid; # UID = toString uid;
GID = toString gid; # GID = toString gid;
STOP_SERVER_ANNOUNCE_DELAY = "20"; STOP_SERVER_ANNOUNCE_DELAY = "20";
TZ = "America/Chicago"; TZ = "America/Chicago";
VERSION = "1.21"; VERSION = "1.21";
@ -1152,6 +1153,10 @@ sudo nix run nixpkgs#ipmitool -- raw 0x30 0x30 0x02 0xff 0x00
"${dir}/worlds:/worlds" "${dir}/worlds:/worlds"
]; ];
}; };
systemd.services.podman-minecraft-flanilla.serviceConfig = {
User = user;
Group = user;
};
systemd.tmpfiles.settings = { systemd.tmpfiles.settings = {
"10-${user}-survival" = { "10-${user}-survival" = {
"${dir}/data" = { "${dir}/data" = {
@ -1179,26 +1184,27 @@ sudo nix run nixpkgs#ipmitool -- raw 0x30 0x30 0x02 0xff 0x00
port = 26968; port = 26968;
dir = "/storage/flanilla-creative"; dir = "/storage/flanilla-creative";
user = "flanilla"; user = "flanilla";
uid = config.users.users.flanilla.uid; # uid = config.users.users.flanilla.uid;
gid = config.users.groups.flanilla.gid; # gid = config.users.groups.flanilla.gid;
in { in {
# flanilla family minecraft server # flanilla family minecraft server
users.groups.${user} = {}; users.groups.${user} = {};
users.users.${user} = { users.users.${user} = {
isSystemUser = true; isSystemUser = true;
createHome = false; createHome = false;
home = lib.mkForce dir;
group = user; group = user;
}; };
virtualisation.oci-containers.containers.minecraft-flanilla-creative = { virtualisation.oci-containers.containers.minecraft-flanilla-creative = {
autoStart = true; autoStart = true;
image = "docker.io/itzg/minecraft-server"; image = "docker.io/itzg/minecraft-server";
user = "${toString uid}:${toString gid}"; # user = "${toString uid}:${toString gid}";
extraOptions = ["--tty" "--interactive"]; extraOptions = ["--tty" "--interactive"];
environment = { environment = {
EULA = "true"; EULA = "true";
MOTD = "Flanilla Creative! Have fun building!"; MOTD = "Flanilla Creative! Have fun building!";
UID = toString uid; # UID = toString uid;
GID = toString gid; # GID = toString gid;
STOP_SERVER_ANNOUNCE_DELAY = "20"; STOP_SERVER_ANNOUNCE_DELAY = "20";
TZ = "America/Chicago"; TZ = "America/Chicago";
VERSION = "1.21"; VERSION = "1.21";
@ -1219,6 +1225,10 @@ sudo nix run nixpkgs#ipmitool -- raw 0x30 0x30 0x02 0xff 0x00
"${dir}/worlds:/worlds" "${dir}/worlds:/worlds"
]; ];
}; };
# systemd.services.podman-minecraft-flanilla-creative.serviceConfig = {
# User = user;
# Group = user;
# };
systemd.tmpfiles.settings = { systemd.tmpfiles.settings = {
"10-${user}-creative" = { "10-${user}-creative" = {
"${dir}/data" = { "${dir}/data" = {