43 lines
852 B
Nix
43 lines
852 B
Nix
{ pkgs, config, ... }:
|
|
{
|
|
services.postgresql = {
|
|
enable = true;
|
|
package = pkgs.postgresql_14;
|
|
#ensureDatabases = [ "nextcloud" ];
|
|
#ensureUsers = [
|
|
# {
|
|
# name = "nextcloud";
|
|
# ensurePermissions = {
|
|
# "DATABASE nextcloud" = "ALL PRIVILEGES";
|
|
# };
|
|
# }
|
|
#];
|
|
};
|
|
|
|
services.postgresqlBackup = {
|
|
enable = true;
|
|
startAt = "*-*-* *:30:00";
|
|
compression = "zstd";
|
|
databases = [
|
|
"postgres"
|
|
];
|
|
};
|
|
|
|
services.logrotate = {
|
|
paths.postgresqlBackup = {
|
|
path = "${config.services.postgresqlBackup.location}/*.sql.zstd";
|
|
user = "postgres";
|
|
group = "postgres";
|
|
keep = 24;
|
|
frequency = "hourly";
|
|
extraConfig = ''
|
|
dateext
|
|
dateformat _%Y-%m-%d:%H
|
|
extension = .zstd
|
|
'';
|
|
|
|
};
|
|
};
|
|
}
|
|
|
|
# vim: set et ts=2 sw=2 ai:
|