nixos/modules/server/postgresql.nix

31 lines
636 B
Nix
Raw Normal View History

2024-12-31 22:44:37 +04:00
{ config, lib, ... }:
with lib;
let cfg = config.void.server.postgresql;
in {
options.void.server.postgresql = { enable = mkEnableOption false; };
config = mkIf cfg.enable {
services.postgresql = {
enable = true;
ensureDatabases = [ "forgejo" ];
ensureUsers = [
{
name = "postgres";
ensureClauses = {
superuser = true;
login = true;
createrole = true;
createdb = true;
replication = true;
};
}
{
name = "forgejo";
ensureDBOwnereship = true;
}
];
};
};
}