dotfiles/modules/nixos/services/postgresql.nix

37 lines
724 B
Nix
Raw Permalink Normal View History

2024-04-20 13:42:06 +00:00
{
config,
pkgs,
lib,
...
}:
{
2024-01-17 00:58:01 +00:00
services.postgresql = {
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 13:42:06 +00:00
ensureUsers = [
{
name = "admin";
ensureClauses = {
createdb = true;
createrole = true;
login = true;
};
}
];
2024-04-20 13:42:06 +00:00
};
2024-04-20 13:42:06 +00:00
home-manager.users.${config.user}.home.packages = lib.mkIf config.services.postgresql.enable [
pkgs.pgcli # Postgres client with autocomplete
];
2024-01-17 00:58:01 +00:00
}