2023-06-12 23:25:40 +02:00
|
|
|
{ pkgs, ... }:
|
|
|
|
{
|
2023-06-28 14:25:16 +02:00
|
|
|
boot.zfs.extraPools = [
|
|
|
|
"storfa"
|
|
|
|
];
|
2023-06-12 23:25:40 +02:00
|
|
|
|
|
|
|
services.restic.backups.cartman = {
|
|
|
|
initialize = true;
|
|
|
|
timerConfig = {
|
|
|
|
OnCalendar = "03:00";
|
|
|
|
};
|
|
|
|
|
|
|
|
paths = [ "/run/restic/cartman" ];
|
|
|
|
backupPrepareCommand = ''
|
|
|
|
snapshot="$(date +restic%+4Y_%U_%u)"
|
|
|
|
${pkgs.zfs-relmount}/bin/zfs-relmount snapshot storfa/ds1/cartman "''${snapshot}"
|
|
|
|
|
|
|
|
mkdir /run/restic/cartman
|
|
|
|
${pkgs.zfs-relmount}/bin/zfs-relmount mount-snapshot storfa/ds1/cartman /run/restic/cartman "''${snapshot}"
|
|
|
|
|
|
|
|
export RESTIC_PROGRESS_FPS=1
|
|
|
|
'';
|
|
|
|
backupCleanupCommand = ''
|
|
|
|
${pkgs.zfs-relmount}/bin/zfs-relmount umount storfa/ds1/cartman /run/restic/cartman
|
|
|
|
rm -r /run/restic/cartman
|
|
|
|
'';
|
|
|
|
|
|
|
|
passwordFile = "";
|
|
|
|
repository = "";
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.timers."restic-backups-cartman" = {
|
|
|
|
timerConfig = {
|
|
|
|
Persistent = true;
|
|
|
|
WakeSystem = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.services."restic-backups-cartman" = {
|
|
|
|
path = with pkgs; [
|
|
|
|
util-linux
|
|
|
|
zfs
|
|
|
|
];
|
|
|
|
serviceConfig = {
|
|
|
|
Nice = 19;
|
|
|
|
IOSchedulingClass = "idle";
|
|
|
|
EnvironmentFile = "/var/secrets/restic-b2";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|