draft: postgres in container

This commit is contained in:
Luka Dekanozishvili 2026-01-26 22:16:26 +01:00
parent 181e6f681e
commit f48059e37e
9 changed files with 327 additions and 103 deletions

32
pkgs/postgres.nix Normal file
View file

@ -0,0 +1,32 @@
{ lib, pkgs, ... }:
{
services.postgresql = {
enable = true;
# settings = {
# listen_addresses = lib.mkForce "127.0.0.1,10.89.0.10";
# };
# Allow root to log in as postgres in the DB (for the PowerDNS container)
identMap = ''
postgres root postgres
'';
authentication = lib.mkForce ''
# TYPE DATABASE USER ADDRESS AUTH-METHOD [auth-options]
host hexname-backend hexname-backend 127.0.0.1/24 scram-sha-256
# host all powerdns-user 127.0.0.1/24 scram-sha-256
# local all root trust
'';
ensureUsers = [ { name = "hexname-backend"; } ];
# No need to define the DB since `diesel` creates everything
# This password is only the initial one - don't get too excited
initialScript = pkgs.writeText "set-initial-password-script" ''
alter user hexname-backend with password 'shuaze-gagyof';
'';
};
}