nixos-config/machines/bsky/backup.nix

40 lines
809 B
Nix
Raw Normal View History

2024-12-20 11:19:26 +01:00
{ pkgs, config, ... }:
let
borgJob = name: {
environment = {
BORG_RSH = "ssh -i ${config.sops.secrets.bsky-backup-ssh-key.path}";
};
repo = "ssh://zh2088@zh2088.rsync.net/./backups/bsky/${name}";
compression = "zstd,10";
startAt = "*-*-* 2:30:00";
extraInitArgs = "--make-parent-dirs";
archiveBaseName = name;
encryption = {
mode = "repokey-blake2";
passCommand = "cat ${config.sops.secrets.bsky-backup-pass.path}";
};
prune = {
keep = {
within = "1d";
daily = 7;
weekly = 4;
monthly = -1;
};
};
};
in
{
services = {
borgbackup.jobs = {
bsky-pds = borgJob "bsky-pds" // {
paths = [ "/var/lib/pds" ];
};
};
};
environment.systemPackages = [ pkgs.borgbackup ];
}