{ pkgs, ... }:

{
  systemd = {
    timers.restic = {
      wantedBy = [ "timers.target" ];
      partOf = [ "restic.service" ];
      timerConfig.OnCalendar = [ "hourly" "daily" ];
    };
    services.restic = {
	  serviceConfig = {
        Type = "oneshot";
        User = "restic";
		Environment = [ "AWS_ACCESS_KEY_ID=AKIAJOVDNQ6FERMIDHKA" "AWS_SECRET_ACCESS_KEY=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" ];
      };
      script = ''
	 restic -r s3:s3.amazonaws.com/haep9c-backup backup /var/vmail /var/vmail 
	 '';
    };
  };
  users.users.restic = {
    isNormalUser = false;
  };
}
