cooking
This commit is contained in:
parent
9ca7a8d8f6
commit
414e830efa
14 changed files with 376 additions and 62 deletions
39
modules/services/postgres.nix
Normal file
39
modules/services/postgres.nix
Normal 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
|
||||
}
|
||||
];
|
||||
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue