server-configs/shared/applications/server/postgresql.nix
2024-12-30 22:53:38 +01:00

31 lines
1,010 B
Nix

{ config, ... }:
{
services.postgresql = {
enable = true;
};
# backup postgresql databases (everything in ensuredatabases)
services.postgresqlBackup = {
enable = true;
compression = "zstd";
# default to backup all databases
databases = config.services.postgresql.ensureDatabases;
};
# default the locale to C. I have NO CLUE why you would
# like to use any other locale, than the default C.
# However, matrix synapse complains A LOT if it isn't C,
# so we just default to it! No worries!
# Matrix Synapse Locale Note
# - https://github.com/element-hq/synapse/blob/develop/docs/postgres.md#fixing-incorrect-collate-or-ctype
# NOTE from postgresql here https://www.postgresql.org/docs/current/locale.html
# Using C.UTF-8, because setting `LC_CTYPE=C` will default encoding to SQL_ASCII.
# https://pganalyze.com/blog/5mins-postgres-17-builtin-c-utf8-locale
systemd.services.postgresql.environment = {
LC_CTYPE = "C.UTF-8";
LC_COLLATE = "C";
};
}