41 lines
766 B
Nix
Raw Normal View History

2024-04-20 09:42:06 -04:00
{
config,
pkgs,
lib,
...
}:
2025-01-20 22:35:40 -05:00
let
cfg = config.nmasur.presets.services.postgresql;
in
2024-04-20 09:42:06 -04:00
{
2024-01-17 00:58:01 +00:00
2025-01-20 22:35:40 -05:00
options.nmasur.presets.services.postgresql.enable = lib.mkEnableOption "Postgresql database";
services.postgresql = lib.mkIf cfg.enable {
enable = true;
package = pkgs.postgresql_15;
2024-01-17 00:58:01 +00:00
settings = { };
2024-02-25 21:14:04 +00:00
authentication = ''
local all postgres peer map=root
local all admin peer map=admin
'';
identMap = ''
root postgres postgres
root root postgres
admin ${config.user} admin
'';
2024-04-20 09:42:06 -04:00
ensureUsers = [
{
name = "admin";
ensureClauses = {
createdb = true;
createrole = true;
login = true;
};
}
];
2024-04-20 09:42:06 -04:00
};
2024-01-17 00:58:01 +00:00
}