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/binary-cache.nix
|
||||
./modules/borgmatic.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,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";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
BIN
flake.lock
BIN
flake.lock
Binary file not shown.
Loading…
Reference in a new issue