mail.idimitrov.dev/mailserver/postgres/default.nix

40 lines
995 B
Nix
Raw Normal View History

2023-11-15 15:37:04 +01:00
{ config, pkgs, ... }:
{
services = {
postgresql = {
enable = true;
2023-12-16 10:50:47 +01:00
ensureDatabases = [ "roundcube" "gitea" ];
2023-11-15 15:37:04 +01:00
ensureUsers = [
{
name = "roundcube";
2023-11-27 14:25:32 +01:00
ensureDBOwnership = true;
2023-11-15 15:37:04 +01:00
}
2023-12-16 10:50:47 +01:00
{
name = "gitea";
ensureDBOwnership = true;
}
2023-11-15 15:37:04 +01:00
{
name = "root";
ensureClauses = {
superuser = true;
createrole = true;
createdb = true;
};
}
];
2023-12-16 10:50:47 +01:00
authentication = ''
local gitea all ident map=gitea-users
'';
identMap = ''
gitea-users gitea gitea
'';
2023-11-15 15:37:04 +01:00
initialScript = pkgs.writeText "init" ''
GRANT ALL PRIVILEGES ON DATABASE roundcube TO roundcube;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO roundcube;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO roundcube;
GRANT ALL PRIVILEGES ON SCHEMA public TO roundcube;
'';
};
};
}