restic: add timer option

This commit is contained in:
emily 2024-11-09 22:05:02 +01:00
parent 695892638a
commit 9a2955fa19
Signed by: emily
GPG key ID: F6F4C66207FCF995
3 changed files with 16 additions and 4 deletions

View file

@ -16,9 +16,14 @@
kyouma.restic = {
enable = true;
remoteUser = "zh3485s1";
timerConfig = {
OnCalander = "hourly";
Persistent = true;
};
paths = [
"/var/lib/akkoma"
"/var/lib/postgresql"
"/var/lib/secrets"
];
};
systemd.network.networks."98-eth-default" = {

View file

@ -238,8 +238,7 @@
services.nginx = {
clientMaxBodySize = "256m";
commonHttpConfig = ''
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/err.log warn;
access_log off;
proxy_cache_path /var/cache/nginx/akkoma-media-cache
levels= keys_zone=akkoma_media_cache:32m max_size=64g

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }: let
{ config, lib, pkgs, utils, ... }: let
cfg = config.kyouma.restic;
in {
options.kyouma.restic = let
@ -40,6 +40,14 @@ in {
type = types.nonEmptyStr;
default = "${config.networking.hostName}-backup";
};
timerConfig = mkOption {
description = "timer config";
type = with types; nullOr (attrsOf utils.systemdUtils.unitOptions.unitOption);
default = {
OnCalendar = "daily";
Persistent = true;
};
};
};
config = lib.mkIf cfg.enable {
sops.secrets."restic/${cfg.remoteUser}/password" = {
@ -50,7 +58,7 @@ in {
};
services.restic.backups."${config.networking.hostName}-${cfg.remote}" = {
inherit (cfg) paths user pruneOpts;
inherit (cfg) paths user pruneOpts timerConfig;
initialize = true;
repository = "sftp:${cfg.remoteUser}@${cfg.remote}:${cfg.repo}";
passwordFile = config.sops.secrets."restic/${cfg.remoteUser}/password".path;