nixos/modules/backups/matrix.nix
Jake Hillion ca1c83a8f6
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
matrix: move backups to self-hosted restic
2023-07-03 22:19:14 +01:00

37 lines
942 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:http://restic.tywin.storage.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
];
};
};
};
}