make postgres module

This commit is contained in:
Sakooooo 2024-12-31 22:44:37 +04:00
parent a58420e719
commit ce14f19125
Signed by: sako
GPG key ID: 3FD715D87D7725E0
2 changed files with 33 additions and 1 deletions

View file

@ -0,0 +1,30 @@
{ 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;
}
];
};
};
}

View file

@ -7,7 +7,9 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
services.forgejo = { services.forgejo = {
enable = true; enable = true;
# settings = { }; # settings = {
# };
}; };
}; };
} }