Talk: PostgreSQL
From NixOS Wiki
The instructions are incomplete and lead to a system that never runs because it is missing the local part. This is what worked for me.
services.postgresql = {
settings = {
listen_addresses = "*";
};
enable = true;
enableTCPIP = true;
authentication = pkgs.lib.mkOverride 10 ''
local all all trust
host all all ::1/128 trust
host all postgres 127.0.0.1/32 trust
'';
};
if you just do the part that accepts TCP connections WITHOUT the local, it just doesn't run because it is missing it.