2021-11-15 10:02:05 +00:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.services.userdata;
|
|
|
|
in
|
|
|
|
{
|
2021-12-14 04:54:49 +00:00
|
|
|
|
|
|
|
systemd = {
|
|
|
|
services = {
|
2021-12-17 05:13:34 +00:00
|
|
|
"restic-backup" = {
|
2021-12-14 05:37:02 +00:00
|
|
|
description = "Userdata restic backup trigger";
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "simple";
|
|
|
|
User = "restic";
|
2021-12-17 05:13:34 +00:00
|
|
|
ExecStart = "${pkgs.restic}/bin/restic -o rclone.args=serve restic --stdio -r rclone:backblaze:${cfg.backblaze.bucket}:/sfbackup --verbose --json backup /var";
|
2021-12-14 05:37:02 +00:00
|
|
|
};
|
|
|
|
};
|
2021-12-14 04:54:49 +00:00
|
|
|
};
|
|
|
|
timers = {
|
2021-12-14 05:37:02 +00:00
|
|
|
"restic-scheduled-backup" = {
|
|
|
|
wantedBy = [ "timers.target" ];
|
2021-12-17 05:13:34 +00:00
|
|
|
partOf = [ "restic-backup.service" ];
|
2021-12-14 05:37:02 +00:00
|
|
|
timerConfig = {
|
|
|
|
OnCalendar = "daily";
|
|
|
|
};
|
2021-11-15 10:02:05 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
users.users.restic = {
|
|
|
|
isNormalUser = false;
|
|
|
|
isSystemUser = true;
|
|
|
|
};
|
|
|
|
}
|