nixos/modules/backups/matrix.nix
Jake Hillion d7a8562c7d
All checks were successful
flake / flake (push) Successful in 1m25s
restic: modularise server component
2024-10-19 15:24:32 +01:00

37 lines
929 B
Nix

{ config, pkgs, lib, ... }:
let
cfg = config.custom.backups.matrix;
in
{
options.custom.backups.matrix = {
enable = lib.mkEnableOption "matrix";
};
config = lib.mkIf cfg.enable {
age.secrets."backups/matrix/restic/128G".file = ../../secrets/restic/128G.age;
services = {
postgresqlBackup = {
enable = true;
compression = "none"; # for better diffing
databases = [ "matrix-synapse" ];
};
restic.backups."matrix" = {
user = "root";
timerConfig = {
OnCalendar = "03:00";
RandomizedDelaySec = "60m";
};
repository = "rest:https://restic.ts.hillion.co.uk/128G";
passwordFile = config.age.secrets."backups/matrix/restic/128G".path;
paths = [
"${config.services.postgresqlBackup.location}/matrix-synapse.sql"
config.services.matrix-synapse.dataDir
];
};
};
};
}