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-14 05:37:02 +00:00
|
|
|
"restic-scheduled-backup" = {
|
|
|
|
description = "Userdata restic backup trigger";
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "simple";
|
|
|
|
User = "restic";
|
|
|
|
ExecStart = "${pkgs.restic}/bin/restic -r rclone:backblaze:${cfg.backblaze.bucket}:/sfbackup --verbose --json backup /var";
|
|
|
|
};
|
|
|
|
};
|
2021-12-14 04:54:49 +00:00
|
|
|
};
|
|
|
|
timers = {
|
2021-12-14 05:37:02 +00:00
|
|
|
"restic-scheduled-backup" = {
|
|
|
|
wantedBy = [ "timers.target" ];
|
|
|
|
partOf = [ "restic-scheduled-backup.service" ];
|
|
|
|
timerConfig = {
|
|
|
|
OnCalendar = "daily";
|
|
|
|
};
|
2021-11-15 10:02:05 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
users.users.restic = {
|
|
|
|
isNormalUser = false;
|
|
|
|
isSystemUser = true;
|
|
|
|
};
|
|
|
|
}
|