2023-10-06 18:05:38 +02:00
|
|
|
{ lib, config, ... }:
|
2022-06-22 20:09:30 +02:00
|
|
|
{
|
|
|
|
services.postgresql = let
|
|
|
|
o = lib.optional;
|
|
|
|
cfg = config.services;
|
|
|
|
db = name: {
|
|
|
|
inherit name;
|
2024-06-10 00:43:04 +02:00
|
|
|
ensureDBOwnership = true;
|
2022-06-22 20:09:30 +02:00
|
|
|
};
|
|
|
|
in {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
ensureDatabases =
|
|
|
|
(o cfg.matrix-synapse.enable "matrix-synapse")
|
|
|
|
++ (o cfg.matrix-appservice-irc.enable "matrix-appservice-irc");
|
|
|
|
ensureUsers =
|
|
|
|
(o cfg.matrix-synapse.enable (db "matrix-synapse"))
|
|
|
|
++ (o cfg.matrix-appservice-irc.enable (db "matrix-appservice-irc"));
|
|
|
|
};
|
|
|
|
}
|