45 lines
1 KiB
Nix
45 lines
1 KiB
Nix
{
|
|
pkgs,
|
|
config,
|
|
...
|
|
}: let
|
|
secrets = config.services.secrets.secrets;
|
|
|
|
mailConfig = config.services.mailserver;
|
|
in {
|
|
environment.systemPackages = with pkgs; [
|
|
restic
|
|
(pkgs.writeShellScriptBin "restic-mail" ''
|
|
env \
|
|
RESTIC_PASSWORD_FILE=${secrets.restic_password.path} \
|
|
$(cat ${secrets.restic_env.path}) \
|
|
${pkgs.restic}/bin/restic $@
|
|
'')
|
|
];
|
|
|
|
services.restic.backups.mail = {
|
|
user = "root";
|
|
paths = [
|
|
mailConfig.vmail.directory
|
|
mailConfig.sieveDirectory
|
|
mailConfig.dkim.directory
|
|
"/var/lib/redis-rspamd"
|
|
];
|
|
|
|
# repository is overrided in environmentFile to contain auth
|
|
# make sure to keep up to date when changing repository
|
|
repository = "rest:https://storage-restic.owo.monster/Mail";
|
|
passwordFile = "${secrets.restic_password.path}";
|
|
environmentFile = "${secrets.restic_env.path}";
|
|
|
|
pruneOpts = [
|
|
"--keep-last 100"
|
|
];
|
|
|
|
timerConfig = {
|
|
OnBootSec = "1m";
|
|
OnCalendar = "8h";
|
|
};
|
|
};
|
|
}
|