backup minecraft to local directory

This commit is contained in:
Dmitriy Kholkin 2024-07-16 15:36:43 +03:00
parent 589eda5d8a
commit 4ddb2923f3
Signed by: AtaraxiaDev
GPG Key ID: FD266B810DF48DF2

View File

@ -1,7 +1,7 @@
{ config, pkgs, lib, inputs, ... }: { config, pkgs, lib, inputs, ... }:
let let
jre21 = pkgs.temurin-bin; jdk21 = pkgs.temurin-bin;
jre17 = pkgs.temurin-bin-17; jdk17 = pkgs.temurin-bin-17;
jvmOpts = lib.concatStringsSep " " [ jvmOpts = lib.concatStringsSep " " [
"-XX:+UnlockExperimentalVMOptions" "-XX:+UnlockExperimentalVMOptions"
"-XX:+UseZGC" "-XX:+UseZGC"
@ -38,10 +38,10 @@ in
inherit rsyncSSHKeys jvmOpts; inherit rsyncSSHKeys jvmOpts;
jvmMaxAllocation = "6144m"; jvmMaxAllocation = "6144m";
jvmInitialAllocation = "6144m"; jvmInitialAllocation = "6144m";
jvmPackage = jre17; jvmPackage = jdk17;
serverConfig = defaults // { serverConfig = defaults // {
server-port = 25585; server-port = 25567;
rcon-port = 25586; rcon-port = 25577;
motd = "StaTech"; motd = "StaTech";
max-world-size = 50000; max-world-size = 50000;
level-seed = "-4411466874705470064"; level-seed = "-4411466874705470064";
@ -52,9 +52,9 @@ in
inherit rsyncSSHKeys jvmOpts; inherit rsyncSSHKeys jvmOpts;
jvmMaxAllocation = "4096m"; jvmMaxAllocation = "4096m";
jvmInitialAllocation = "4096m"; jvmInitialAllocation = "4096m";
jvmPackage = jre21; jvmPackage = jdk21;
serverConfig = defaults // { serverConfig = defaults // {
server-port = 25575; server-port = 25566;
rcon-port = 25576; rcon-port = 25576;
motd = "All of Create"; motd = "All of Create";
max-world-size = 50000; max-world-size = 50000;
@ -66,13 +66,14 @@ in
inherit rsyncSSHKeys jvmOpts; inherit rsyncSSHKeys jvmOpts;
jvmMaxAllocation = "4096m"; jvmMaxAllocation = "4096m";
jvmInitialAllocation = "4096m"; jvmInitialAllocation = "4096m";
jvmPackage = jre21; jvmPackage = jdk21;
serverConfig = defaults // { serverConfig = defaults // {
server-port = 25565; server-port = 25565;
rcon-port = 25566; rcon-port = 25575;
motd = "AtaraxiaSjel's Create"; motd = "AtaraxiaSjel's Create";
max-world-size = 50000; max-world-size = 50000;
# level-seed = "-6893059259197159072"; # 520 120 375
level-seed = "-9219784036026610404";
}; };
}; };
}; };
@ -87,7 +88,7 @@ in
backup = true; backup = true;
prune = false; prune = false;
initialize = false; initialize = false;
environmentFile = config.sops.secrets.rustic-minecraft-s3-env.path; # environmentFile = config.sops.secrets.rustic-minecraft-s3-env.path;
pruneOpts = [ "--repack-cacheable-only=false" ]; pruneOpts = [ "--repack-cacheable-only=false" ];
timerConfig = { timerConfig = {
OnCalendar = "*:0/15"; OnCalendar = "*:0/15";
@ -130,14 +131,16 @@ in
label = "workstation-minecraft"; label = "workstation-minecraft";
in { in {
repository = { repository = {
repository = "opendal:s3"; # repository = "opendal:s3";
repository = "/persist/backup/minecraft-servers";
password-file = config.sops.secrets.rustic-workstation-pass.path; password-file = config.sops.secrets.rustic-workstation-pass.path;
options = { no-cache = true;
root = label; # options = {
bucket = "rustic-backups"; # root = label;
region = "us-east-1"; # bucket = "rustic-backups";
endpoint = "https://s3.ataraxiadev.com"; # region = "us-east-1";
}; # endpoint = "https://s3.ataraxiadev.com";
# };
}; };
backup = { backup = {
host = config.device; host = config.device;
@ -145,7 +148,8 @@ in
ignore-devid = true; ignore-devid = true;
group-by = "label"; group-by = "label";
skip-identical-parent = true; skip-identical-parent = true;
glob = [ "!/var/lib/**/backups" ]; glob = [ "!/var/lib/**/backups" "!/var/lib/**/.cache" "!/var/lib/**/logs" ];
exclude-if-present = [ ".nobackup" "CACHEDIR.TAG" ];
sources = [{ sources = [{
source = lib.strings.concatStringsSep " " (map (x: "/var/lib/mc-${x}") (lib.attrNames instances)); source = lib.strings.concatStringsSep " " (map (x: "/var/lib/mc-${x}") (lib.attrNames instances));
}]; }];