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