feat(servers): setup borgmatic for auto backups
All checks were successful
Discord / discord commits (push) Successful in 1m13s
All checks were successful
Discord / discord commits (push) Successful in 1m13s
This commit is contained in:
parent
a454167053
commit
e3300dcac3
4 changed files with 116 additions and 66 deletions
|
@ -6,6 +6,7 @@
|
||||||
../../modules/tailscale.nix
|
../../modules/tailscale.nix
|
||||||
|
|
||||||
./modules/binary-cache.nix
|
./modules/binary-cache.nix
|
||||||
|
./modules/borgmatic.nix
|
||||||
./modules/minecraft.nix
|
./modules/minecraft.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
32
devices/servivi/modules/borgmatic.nix
Normal file
32
devices/servivi/modules/borgmatic.nix
Normal 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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -6,7 +6,8 @@
|
||||||
}: {
|
}: {
|
||||||
imports = [nms.nixosModules.default];
|
imports = [nms.nixosModules.default];
|
||||||
|
|
||||||
services.modded-minecraft-servers = {
|
services = {
|
||||||
|
modded-minecraft-servers = {
|
||||||
eula = true;
|
eula = true;
|
||||||
user = config.vars.user;
|
user = config.vars.user;
|
||||||
group = "users";
|
group = "users";
|
||||||
|
@ -63,7 +64,7 @@
|
||||||
|
|
||||||
# Modded https://www.curseforge.com/minecraft/modpacks/nomi-ceu
|
# Modded https://www.curseforge.com/minecraft/modpacks/nomi-ceu
|
||||||
nomi = {
|
nomi = {
|
||||||
enable = true;
|
enable = false;
|
||||||
|
|
||||||
jvmMaxAllocation = "10G";
|
jvmMaxAllocation = "10G";
|
||||||
jvmInitialAllocation = "2G";
|
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";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
BIN
flake.lock
BIN
flake.lock
Binary file not shown.
Loading…
Reference in a new issue