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 116 additions and 66 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,7 +6,8 @@
}: {
imports = [nms.nixosModules.default];
services.modded-minecraft-servers = {
services = {
modded-minecraft-servers = {
eula = true;
user = config.vars.user;
group = "users";
@ -63,7 +64,7 @@
# Modded https://www.curseforge.com/minecraft/modpacks/nomi-ceu
nomi = {
enable = true;
enable = false;
jvmMaxAllocation = "10G";
jvmInitialAllocation = "2G";
@ -87,4 +88,20 @@
};
};
};
borgmatic.configurations.mc =
config.services.borgmatic.defaults
// {
source_directories = [
"/var/lib/minecraft"
];
repositories = [
{
label = "PVE";
path = "ssh://matt@pve/data/backups/borg";
}
];
};
};
}

Binary file not shown.