mirror of
https://git.pvv.ntnu.no/Drift/pvv-nixos-config.git
synced 2026-02-04 09:10:01 +01:00
28 lines
697 B
Nix
28 lines
697 B
Nix
{ config, lib, ... }:
|
|
let
|
|
cfg = config.services.postgresql;
|
|
in
|
|
{
|
|
services.postgresqlBackup = lib.mkIf cfg.enable {
|
|
enable = true;
|
|
location = "/var/lib/postgres-backups";
|
|
backupAll = true;
|
|
};
|
|
|
|
services.rsync-pull-targets = lib.mkIf cfg.enable {
|
|
enable = true;
|
|
locations.${config.services.postgresqlBackup.location} = {
|
|
user = "root";
|
|
rrsyncArgs.ro = true;
|
|
authorizedKeysAttrs = [
|
|
"restrict"
|
|
"no-agent-forwarding"
|
|
"no-port-forwarding"
|
|
"no-pty"
|
|
"no-X11-forwarding"
|
|
];
|
|
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGvO7QX7QmwSiGLXEsaxPIOpAqnJP3M+qqQRe5dzf8gJ postgresql rsync backup";
|
|
};
|
|
};
|
|
}
|