nixos-config/modules/postgresql.nix

44 lines
852 B
Nix
Raw Normal View History

{ pkgs, config, ... }:
2021-11-23 11:17:26 +01:00
{
services.postgresql = {
enable = true;
package = pkgs.postgresql_14;
#ensureDatabases = [ "nextcloud" ];
#ensureUsers = [
# {
# name = "nextcloud";
# ensurePermissions = {
# "DATABASE nextcloud" = "ALL PRIVILEGES";
# };
# }
#];
2021-11-23 11:17:26 +01:00
};
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
'';
};
};
2021-11-23 11:17:26 +01:00
}
# vim: set et ts=2 sw=2 ai: