nixfiles/hosts/hetzner-vm/containers/piped/profiles/restic.nix

54 lines
1.2 KiB
Nix
Raw Normal View History

2023-08-01 22:06:30 +01:00
{
pkgs,
host_secrets,
...
}: let
secrets = host_secrets;
#backupPrepareCommand = "${
# (pkgs.writeShellScriptBin "backupPrepareCommand" ''
# systemctl start postgresqlBackup-piped --wait
# '')
#}/bin/backupPrepareCommand";
2023-08-01 22:06:30 +01:00
in {
environment.systemPackages = with pkgs; [
restic
(pkgs.writeShellScriptBin "restic-piped" ''
env \
RESTIC_PASSWORD_FILE=${secrets.piped_restic_password.path} \
$(cat ${secrets.piped_restic_env.path}) \
${pkgs.restic}/bin/restic $@
'')
];
services.restic.backups.piped = {
user = "root";
paths = [
#"/var/backup/postgresql"
2023-08-01 22:06:30 +01:00
];
# repository is overrided in environmentFile to contain auth
# make sure to keep up to date when changing repository
repository = "rest:https://storage-restic.owo.monster/Piped";
passwordFile = "${secrets.piped_restic_password.path}";
environmentFile = "${secrets.piped_restic_env.path}";
pruneOpts = [
"--keep-last 5"
];
timerConfig = {
OnBootSec = "1m";
OnCalendar = "daily";
};
#inherit backupPrepareCommand;
2023-08-01 22:06:30 +01:00
};
#services.postgresqlBackup = {
# enable = true;
# backupAll = false;
# databases = ["piped"];
# compression = "zstd";
#};
2023-08-01 22:06:30 +01:00
}