On nixos, I face a postgres error psql: FATAL: Peer authentication failed for user "postgres"
similar error to this question, and would like to edit the authentication settings to resolve the issue as described in an answer there:
edit pg_hba.conf to use md5 password authentication instead of peer authentication for unix sockets (local connection type) so Pg accepts password authentication
I have resolved this same error previously on ubuntu by editing authorization configuration in that pg_hba.conf
file. But my issue now is that nixos does not appear to have such an pg_hba.conf
to edit.
How do I make the corresponding postgres authorization configuration change in nixos?
I noticed this postgres.nix file on github which appears to do something with pg_hba.conf
, or at least contains the string, but I do not understand how to change my authentication settings from that. Also I have only used the one main configuration file /etc/nixos/configuration.nix
and this appears to be a separate module, at nixos/modules/services/databases/postgresql.nix
.