feat: added another minecraft world

This commit is contained in:
Nick 2025-11-26 22:34:04 -06:00
parent 5b00235743
commit 710bc42aef
6 changed files with 44 additions and 34 deletions

View file

@ -7,20 +7,19 @@ let
; ;
label = "Minecraft"; label = "Minecraft";
name = "minecraft"; name = "minecraft";
short = "mine0"; world = "world0";
secrets = "${secretPath}/${name}"; secrets = "${secretPath}/${name}";
in in
{ {
label = label; label = label;
name = name; name = name;
short = short;
ports = { ports = {
port0 = 43000; port0 = 43000;
}; };
interface = { interface = {
id = "vm-${short}"; id = "vm-${world}";
mac = "02:00:00:00:51:41"; mac = "02:00:00:00:51:41";
idUser = "vmuser-${short}"; idUser = "vmuser-${world}";
macUser = "02:00:00:00:00:41"; macUser = "02:00:00:00:00:41";
ip = "192.168.50.141"; ip = "192.168.50.141";
gate = "192.168.50.1"; gate = "192.168.50.1";
@ -30,7 +29,7 @@ in
path0 = "${varPath}/${name}"; path0 = "${varPath}/${name}";
}; };
mntPaths = { mntPaths = {
path0 = "${mntPath}/${name}"; path0 = "${mntPath}/${name}-${world}";
}; };
secretPaths = { secretPaths = {
path0 = secrets; path0 = secrets;

View file

@ -7,20 +7,19 @@ let
; ;
label = "Minecraft"; label = "Minecraft";
name = "minecraft"; name = "minecraft";
short = "mine1"; world = "world1";
secrets = "${secretPath}/${name}"; secrets = "${secretPath}/${name}";
in in
{ {
label = label; label = label;
name = name; name = name;
short = short;
ports = { ports = {
port0 = 43001; port0 = 43001;
}; };
interface = { interface = {
id = "vm-${short}"; id = "vm-${world}";
mac = "02:00:00:00:51:42"; mac = "02:00:00:00:51:42";
idUser = "vmuser-${short}"; idUser = "vmuser-${world}";
macUser = "02:00:00:00:00:42"; macUser = "02:00:00:00:00:42";
ip = "192.168.50.142"; ip = "192.168.50.142";
gate = "192.168.50.1"; gate = "192.168.50.1";
@ -30,7 +29,7 @@ in
path0 = "${varPath}/${name}"; path0 = "${varPath}/${name}";
}; };
mntPaths = { mntPaths = {
path0 = "${mntPath}/${name}"; path0 = "${mntPath}/${name}-${world}";
}; };
secretPaths = { secretPaths = {
path0 = secrets; path0 = secrets;

View file

@ -8,11 +8,4 @@ let
in in
{ {
imports = importList; imports = importList;
systemd = {
tmpfiles.rules = [
"d /mnt/storage/minecraft 0751 microvm wheel - -"
];
};
} }

View file

@ -25,7 +25,7 @@ in
openFirewall = true; openFirewall = true;
declarative = true; declarative = true;
serverProperties = { serverProperties = {
"rcon.password" = "/etc/${serviceCfg.name}-secrets/${world}"; "rcon.password" = "/run/secrets/${world}";
allow-flight = false; allow-flight = false;
allow-nether = true; allow-nether = true;
difficulty = 2; difficulty = 2;
@ -179,4 +179,11 @@ in
}; };
networking.firewall.allowedTCPPorts = [ serviceCfg.ports.port0 ]; networking.firewall.allowedTCPPorts = [ serviceCfg.ports.port0 ];
systemd = {
tmpfiles.rules = [
"d ${serviceCfg.mntPaths.path0} 0751 microvm wheel - -"
];
};
} }

View file

@ -5,7 +5,7 @@
let let
inherit (flake.config.people) user0; inherit (flake.config.people) user0;
inherit (flake.config.services) instances; inherit (flake.config.services) instances;
serviceCfg = instances.minecraft1; serviceCfg = instances.minecraft0;
hostCfg = instances.web; hostCfg = instances.web;
world = "world1"; world = "world1";
in in
@ -25,7 +25,7 @@ in
openFirewall = true; openFirewall = true;
declarative = true; declarative = true;
serverProperties = { serverProperties = {
"rcon.password" = "/etc/${serviceCfg.name}-secrets/${world}"; "rcon.password" = "/run/secrets/${world}";
allow-flight = false; allow-flight = false;
allow-nether = true; allow-nether = true;
difficulty = 2; difficulty = 2;
@ -37,9 +37,9 @@ in
generate-structures = true; generate-structures = true;
hardcore = false; hardcore = false;
hide-online-players = false; hide-online-players = false;
level-name = "CuddleCubes"; level-name = "Brix on Nix";
level-seed = "-2332803749585407299"; level-seed = "-2332803749585407299";
max-players = 2; max-players = 10;
max-world-size = 64000000; max-world-size = 64000000;
motd = "A cool Minecraft server powered by NixOS"; motd = "A cool Minecraft server powered by NixOS";
online-mode = true; online-mode = true;
@ -177,4 +177,11 @@ in
}; };
networking.firewall.allowedTCPPorts = [ serviceCfg.ports.port0 ]; networking.firewall.allowedTCPPorts = [ serviceCfg.ports.port0 ];
systemd = {
tmpfiles.rules = [
"d ${serviceCfg.mntPaths.path0} 0751 microvm wheel - -"
];
};
} }

View file

@ -23,18 +23,23 @@ in
OnCalendar = "0/4:00"; OnCalendar = "0/4:00";
Persistent = true; Persistent = true;
}; };
paths = [ paths =
"/home/${user0}/.ssh" let
"/mnt/storage/minecraft" instanceHelper = instance: instances.${instance}.mntPaths.path0;
instances.firefly-iii.mntPaths.path0 in
instances.forgejo.mntPaths.path0 [
instances.mastodon.mntPaths.path0 "/home/${user0}/.ssh"
instances.opencloud.mntPaths.path0 (instanceHelper "firefly-iii")
instances.vaultwarden.mntPaths.path0 (instanceHelper "forgejo")
"${instances.jellyfin.mntPaths.path0}/cache" (instanceHelper "mastodon")
"${instances.jellyfin.mntPaths.path0}/data" (instanceHelper "opencloud")
"${instances.jellyfin.mntPaths.path0}/media/music" (instanceHelper "minecraft0")
]; (instanceHelper "minecraft1")
(instanceHelper "vaultwarden")
((instanceHelper "jellyfin") + "/cache")
((instanceHelper "jellyfin") + "/data")
((instanceHelper "jellyfin") + "/media/music")
];
}; };
}; };
}; };