This commit is contained in:
Lucy Hochkamp 2025-07-29 03:02:25 +02:00
parent 9ca7a8d8f6
commit 414e830efa
No known key found for this signature in database
14 changed files with 376 additions and 62 deletions

View file

@ -0,0 +1,39 @@
{
pkgs,
lib,
config,
...
}:
let
cfg = config.xyno.services.postgres;
in
{
options.xyno.services.postgres.enable = lib.mkEnableOption "enables postgres";
config = lib.mkIf cfg.enable {
services.postgresql = {
enable = true;
package = pkgs.postgresql_17_jit;
identMap = ''
# ArbitraryMapName systemUser DBUser
superuser_map root postgres
superuser_map postgres postgres
# Let other names login as themselves
superuser_map /^(.*)$ \1
'';
};
services.prometheus.exporters.postgres = lib.mkIf config.xyno.services.monitoring.enable {
enable = true;
listenAddress = config.xyno.services.monitoring.ip;
port = 9187;
};
xyno.impermanence.extraDirectories = [ "/var/lib/postgresql" ];
services.borgmatic.settings.postgresql_databases = [
{
name = "all"; # gets run as root anyways so can log in
}
];
};
}