Created
December 6, 2022 09:14
-
-
Save drupol/920192c718f44031a23f95a437c0598c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ modulesPath, pkgs, lib, config, ... }: | |
let | |
db_name = "<name>"; | |
db_user = "<user>"; | |
in | |
{ | |
services.postgresql = | |
{ | |
enable = true; | |
package = pkgs.postgresql_13; | |
ensureDatabases = [ db_name ]; | |
authentication = pkgs.lib.mkOverride 10 '' | |
local all all trust | |
host all all 127.0.0.1/32 trust | |
host all all ::1/128 trust | |
''; | |
ensureUsers = [ | |
{ | |
name = db_user; | |
ensurePermissions = { "DATABASE ${db_name}" = "ALL PRIVILEGES"; }; | |
} | |
]; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment