nixos-infra/services/synapse/database.nix
Rustam Efimov 30ce0dafc2
Some checks failed
Nix CI / build (push) Failing after 31s
initial commit
2026-04-01 08:50:01 +03:00

26 lines
556 B
Nix

{
config,
lib,
...
}:
let
pgsqlEnable = config.machine.postgresql.enable;
inherit (config.machine.synapse) enable;
in
with lib; mkIf enable {
services.postgresql = with lib; mkIf pgsqlEnable {
ensureUsers = [
{
name = "matrix-synapse";
ensureDBOwnership = true;
}
];
ensureDatabases = [ "matrix-synapse" ];
};
services.matrix-synapse.settings.database = {
name = if pgsqlEnable then "psycopg2" else "sqlite3";
args = with lib; mkIf pgsqlEnable {
host = "/run/postgresql";
};
};
}