forked from emily/nixfiles
restic: add timer option
This commit is contained in:
parent
695892638a
commit
24819a7f56
3 changed files with 17 additions and 5 deletions
|
@ -16,9 +16,14 @@
|
||||||
kyouma.restic = {
|
kyouma.restic = {
|
||||||
enable = true;
|
enable = true;
|
||||||
remoteUser = "zh3485s1";
|
remoteUser = "zh3485s1";
|
||||||
|
timerConfig = {
|
||||||
|
OnCalendar = "hourly";
|
||||||
|
Persistent = true;
|
||||||
|
};
|
||||||
paths = [
|
paths = [
|
||||||
"/var/lib/akkoma"
|
"/var/lib/akkoma"
|
||||||
"/var/lib/postgresql"
|
"/var/lib/postgresql"
|
||||||
|
"/var/lib/secrets"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
systemd.network.networks."98-eth-default" = {
|
systemd.network.networks."98-eth-default" = {
|
||||||
|
|
|
@ -238,11 +238,10 @@
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
clientMaxBodySize = "256m";
|
clientMaxBodySize = "256m";
|
||||||
commonHttpConfig = ''
|
commonHttpConfig = ''
|
||||||
access_log /var/log/nginx/access.log;
|
access_log off;
|
||||||
error_log /var/log/nginx/err.log warn;
|
|
||||||
|
|
||||||
proxy_cache_path /var/cache/nginx/akkoma-media-cache
|
proxy_cache_path /var/cache/nginx/akkoma-media-cache
|
||||||
levels= keys_zone=akkoma_media_cache:32m max_size=64g
|
levels= keys_zone=akkoma_media_cache:64m max_size=64g
|
||||||
inactive=1y use_temp_path=off;
|
inactive=1y use_temp_path=off;
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, pkgs, ... }: let
|
{ config, lib, pkgs, utils, ... }: let
|
||||||
cfg = config.kyouma.restic;
|
cfg = config.kyouma.restic;
|
||||||
in {
|
in {
|
||||||
options.kyouma.restic = let
|
options.kyouma.restic = let
|
||||||
|
@ -40,6 +40,14 @@ in {
|
||||||
type = types.nonEmptyStr;
|
type = types.nonEmptyStr;
|
||||||
default = "${config.networking.hostName}-backup";
|
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 {
|
config = lib.mkIf cfg.enable {
|
||||||
sops.secrets."restic/${cfg.remoteUser}/password" = {
|
sops.secrets."restic/${cfg.remoteUser}/password" = {
|
||||||
|
@ -50,7 +58,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
services.restic.backups."${config.networking.hostName}-${cfg.remote}" = {
|
services.restic.backups."${config.networking.hostName}-${cfg.remote}" = {
|
||||||
inherit (cfg) paths user pruneOpts;
|
inherit (cfg) paths user pruneOpts timerConfig;
|
||||||
initialize = true;
|
initialize = true;
|
||||||
repository = "sftp:${cfg.remoteUser}@${cfg.remote}:${cfg.repo}";
|
repository = "sftp:${cfg.remoteUser}@${cfg.remote}:${cfg.repo}";
|
||||||
passwordFile = config.sops.secrets."restic/${cfg.remoteUser}/password".path;
|
passwordFile = config.sops.secrets."restic/${cfg.remoteUser}/password".path;
|
||||||
|
|
Loading…
Reference in a new issue