selfprivacy-nixos-config/backup/restic.nix

33 lines
765 B
Nix
Raw Normal View History

2021-11-15 10:02:05 +00:00
{ config, pkgs, ... }:
let
cfg = config.services.userdata;
in
{
systemd = {
services = {
2021-12-17 05:13:34 +00:00
"restic-backup" = {
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";
};
};
};
timers = {
"restic-scheduled-backup" = {
wantedBy = [ "timers.target" ];
2021-12-17 05:13:34 +00:00
partOf = [ "restic-backup.service" ];
timerConfig = {
OnCalendar = "daily";
};
2021-11-15 10:02:05 +00:00
};
};
};
users.users.restic = {
isNormalUser = false;
isSystemUser = true;
};
}