feat(servers): setup borgmatic for auto backups
All checks were successful
Discord / discord commits (push) Successful in 1m13s

This commit is contained in:
matt1432 2023-12-27 00:33:19 -05:00
parent a454167053
commit e3300dcac3
4 changed files with 138 additions and 88 deletions

View file

@ -6,6 +6,7 @@
../../modules/tailscale.nix
./modules/binary-cache.nix
./modules/borgmatic.nix
./modules/minecraft.nix
];

View file

@ -0,0 +1,32 @@
{
config,
lib,
pkgs,
...
}: {
# Make this file declare default settings
options.services.borgmatic = with lib; {
defaults = mkOption {
type = types.attrs;
};
};
# Make sure known_hosts has the needed info
config = {
services.borgmatic = {
enable = true;
defaults = {
keep_daily = 7;
# FIXME: doesn't work, have to put it in /root/.ssh
ssh_command = "ssh -i /root/.ssh/borg";
encryption_passcommand = "${pkgs.coreutils}/bin/cat ${config.sops.secrets.borg-repo.path}";
source_directories_must_exist = true;
borgmatic_source_directory = "/tmp/borgmatic";
store_config_files = false;
};
};
};
}

View file

@ -6,85 +6,102 @@
}: {
imports = [nms.nixosModules.default];
services.modded-minecraft-servers = {
eula = true;
user = config.vars.user;
group = "users";
services = {
modded-minecraft-servers = {
eula = true;
user = config.vars.user;
group = "users";
instances = let
jre8 = pkgs.temurin-bin-8;
jre17 = pkgs.temurin-bin-17;
instances = let
jre8 = pkgs.temurin-bin-8;
jre17 = pkgs.temurin-bin-17;
defaults = {
spawn-protection = 0;
max-tick-time = 5 * 60 * 1000;
allow-flight = true;
};
in {
# Vanilla Survival
sv = {
enable = false;
defaults = {
spawn-protection = 0;
max-tick-time = 5 * 60 * 1000;
allow-flight = true;
};
in {
# Vanilla Survival
sv = {
enable = false;
serverConfig =
{
server-port = 25569;
serverConfig =
{
server-port = 25569;
extra-options = {
};
}
// defaults;
};
extra-options = {
};
}
// defaults;
};
# Vanilla Creative
cv = {
enable = true;
# Vanilla Creative
cv = {
enable = true;
jvmMaxAllocation = "6G";
jvmInitialAllocation = "2G";
jvmPackage = jre17;
jvmOpts = "";
jvmMaxAllocation = "6G";
jvmInitialAllocation = "2G";
jvmPackage = jre17;
jvmOpts = "";
serverConfig =
{
server-port = 25566;
motd = "creative mode gaming";
serverConfig =
{
server-port = 25566;
motd = "creative mode gaming";
extra-options = {
difficulty = "hard";
enable-command-block = true;
enforce-whitelist = true;
gamemode = "creative";
max-players = 6;
view-distance = 16;
};
}
// defaults;
};
extra-options = {
difficulty = "hard";
enable-command-block = true;
enforce-whitelist = true;
gamemode = "creative";
max-players = 6;
view-distance = 16;
};
}
// defaults;
};
# Modded https://www.curseforge.com/minecraft/modpacks/nomi-ceu
nomi = {
enable = true;
# Modded https://www.curseforge.com/minecraft/modpacks/nomi-ceu
nomi = {
enable = false;
jvmMaxAllocation = "10G";
jvmInitialAllocation = "2G";
jvmPackage = jre8;
jvmOpts = "";
jvmMaxAllocation = "10G";
jvmInitialAllocation = "2G";
jvmPackage = jre8;
jvmOpts = "";
serverConfig =
{
server-port = 25569;
motd = "Nomi CEu Server, v1.7-alpha-2";
serverConfig =
{
server-port = 25569;
motd = "Nomi CEu Server, v1.7-alpha-2";
extra-options = {
max-players = 8;
difficulty = 1;
view-distance = 10;
simulation-distance = 10;
level-type = "lostcities";
};
}
// defaults;
extra-options = {
max-players = 8;
difficulty = 1;
view-distance = 10;
simulation-distance = 10;
level-type = "lostcities";
};
}
// defaults;
};
};
};
borgmatic.configurations.mc =
config.services.borgmatic.defaults
// {
source_directories = [
"/var/lib/minecraft"
];
repositories = [
{
label = "PVE";
path = "ssh://matt@pve/data/backups/borg";
}
];
};
};
}

View file

@ -334,11 +334,11 @@
]
},
"locked": {
"lastModified": 1703626263,
"narHash": "sha256-gmETBj8mZPFDm/EKoXEPxfs1kRYE5zZT2AiY6LYol0E=",
"lastModified": 1703648064,
"narHash": "sha256-c4bkc1HnLiFQrwBu5WTKLFY03f9D6Ia61aRmIGW55eU=",
"owner": "horriblename",
"repo": "hyprgrass",
"rev": "e377be95fe95c2dc490891b76deee81effad8422",
"rev": "0165a9ed8679f3f2c62cc868bdaf620e4520d504",
"type": "github"
},
"original": {
@ -358,11 +358,11 @@
"xdph": "xdph"
},
"locked": {
"lastModified": 1703616278,
"narHash": "sha256-xipHN28RIfB36qNoqesh4NnE/M6YZbEiYhkPHS3BFhI=",
"lastModified": 1703630866,
"narHash": "sha256-umubRI/GMVQGWVAfERbybfIGA5Rynh2Okc6KGPPKM8Y=",
"owner": "hyprwm",
"repo": "Hyprland",
"rev": "9fb50252d3a128466e80bfc2fb67b45dc923ad41",
"rev": "191fa587f4daf9f3bf3e3f791de9e2dc5e95a459",
"type": "github"
},
"original": {
@ -426,11 +426,11 @@
]
},
"locked": {
"lastModified": 1703549056,
"narHash": "sha256-FYARnqNH1C3L7ygW33zh/lXgBiI917H/VYR3Xwl8pS4=",
"lastModified": 1703635470,
"narHash": "sha256-mKhYnxtK0mogmUitf9hcamAcGtJbmMyfAIT9KUeDPcU=",
"owner": "nix-community",
"repo": "neovim-nightly-overlay",
"rev": "c36deb5e7d85e6d685b2d43ea460e145e01a70d9",
"rev": "35b4bc0f31b333ad631bf80fa005566c1af51f9e",
"type": "github"
},
"original": {
@ -449,11 +449,11 @@
},
"locked": {
"dir": "contrib",
"lastModified": 1703546163,
"narHash": "sha256-XKOAD8Yz/qPAH0OlQyZYuGgGAKbj2sPaowclr4TDfdk=",
"lastModified": 1703633178,
"narHash": "sha256-TKbXVF9zombPql9AxDC0uKVjkG3HnKpLQKj8gIea1QY=",
"owner": "neovim",
"repo": "neovim",
"rev": "bbd5c6363c25e8fbbfb962f8f6c5ea1800d431ca",
"rev": "c26dc1f77c792fe5cbefd578dc8d1e23c80d3688",
"type": "github"
},
"original": {
@ -719,11 +719,11 @@
"nixpkgs": "nixpkgs_6"
},
"locked": {
"lastModified": 1703625203,
"narHash": "sha256-Bl2t13cz93R9fpmJBboFriVoIEDJSNMZxp+P0UhjWHE=",
"lastModified": 1703628847,
"narHash": "sha256-CiMGqa1twXq50Ub2gGqwZ6jZuWWbISgvj61pUC5uAXc=",
"owner": "nix-community",
"repo": "nixpkgs-wayland",
"rev": "10103010f9794cfabb46540f7a6a99fe50864971",
"rev": "34e93cad9a011f28c094ba4d94adc7f59cec08ad",
"type": "github"
},
"original": {
@ -898,11 +898,11 @@
},
"nur": {
"locked": {
"lastModified": 1703627552,
"narHash": "sha256-thW9xfLa5Cd11jKizHF/61GCgeeJvAzG4QfEtFmje/E=",
"lastModified": 1703646418,
"narHash": "sha256-+O5UYPoboInEqQM0KeNVTz8Dff2dTxDwZOSRTgdOejM=",
"owner": "nix-community",
"repo": "NUR",
"rev": "11f7191037b0715f3fe788ffc94167dda60713a1",
"rev": "4b648583aa2718a55740bd6f7e2916c9771762c8",
"type": "github"
},
"original": {
@ -961,11 +961,11 @@
"sops-nix": "sops-nix"
},
"locked": {
"lastModified": 1703564272,
"narHash": "sha256-wDP3A087LAIWXyuYOSlSB+3gzto4UXgYcap+TwZuGLs=",
"lastModified": 1703648158,
"narHash": "sha256-z2My4To69oyY4xYofSJCAKK6BOMcbA9qRZJoUBpi6+U=",
"ref": "refs/heads/main",
"rev": "92f6bcc37d0098e939d183bc735eb65338ebdf2d",
"revCount": 15,
"rev": "22a1a1c6a18639e11e4e47a667870dffa527623e",
"revCount": 17,
"type": "git",
"url": "ssh://git@git.nelim.org/matt1432/nixos-secrets"
},