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

View file

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

View file

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

View file

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

View file

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

View file

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