diff --git a/modules/config/instances/config/minecraft0.nix b/modules/config/instances/config/minecraft0.nix index 19df36d..d98a977 100755 --- a/modules/config/instances/config/minecraft0.nix +++ b/modules/config/instances/config/minecraft0.nix @@ -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; diff --git a/modules/config/instances/config/minecraft1.nix b/modules/config/instances/config/minecraft1.nix index 9994136..e489804 100755 --- a/modules/config/instances/config/minecraft1.nix +++ b/modules/config/instances/config/minecraft1.nix @@ -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; diff --git a/modules/nixos/guests/minecraft/default.nix b/modules/nixos/guests/minecraft/default.nix index 6cab322..da65bd2 100755 --- a/modules/nixos/guests/minecraft/default.nix +++ b/modules/nixos/guests/minecraft/default.nix @@ -8,11 +8,4 @@ let in { imports = importList; - - systemd = { - tmpfiles.rules = [ - "d /mnt/storage/minecraft 0751 microvm wheel - -" - ]; - }; - } diff --git a/modules/nixos/guests/minecraft/world0/default.nix b/modules/nixos/guests/minecraft/world0/default.nix index 1e702aa..41e23e2 100755 --- a/modules/nixos/guests/minecraft/world0/default.nix +++ b/modules/nixos/guests/minecraft/world0/default.nix @@ -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 - -" + ]; + }; + } diff --git a/modules/nixos/guests/minecraft/world1/default.nix b/modules/nixos/guests/minecraft/world1/default.nix index e7cbfd1..d4c75c7 100755 --- a/modules/nixos/guests/minecraft/world1/default.nix +++ b/modules/nixos/guests/minecraft/world1/default.nix @@ -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 - -" + ]; + }; + } diff --git a/modules/nixos/services/restic/default.nix b/modules/nixos/services/restic/default.nix index a484f42..2c1ab9b 100755 --- a/modules/nixos/services/restic/default.nix +++ b/modules/nixos/services/restic/default.nix @@ -23,18 +23,23 @@ in OnCalendar = "0/4:00"; Persistent = true; }; - paths = [ - "/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" - ]; + paths = + let + instanceHelper = instance: instances.${instance}.mntPaths.path0; + in + [ + "/home/${user0}/.ssh" + (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") + ]; }; }; };