Skyler Grey | 13e45bd | 2023-01-26 00:39:17 +0000 | [diff] [blame] | 1 | { lib, config, username, pkgs, ... }: { |
| 2 | config = { |
| 3 | services = { |
| 4 | postgresql = { |
| 5 | enable = true; |
| 6 | dataDir = "/tmp/postgresql"; |
| 7 | initialScript = pkgs.writeText "init-postgresql" '' |
| 8 | CREATE ROLE ${username} WITH LOGIN PASSWORD '${username}' CREATEDB; |
| 9 | GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO ${username}; |
| 10 | GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO ${username}; |
| 11 | ''; |
| 12 | }; |
| 13 | pgadmin = { |
| 14 | enable = true; |
| 15 | initialEmail = "skyler3665@gmail.com"; |
| 16 | initialPasswordFile = config.sops.secrets.pgadminPassword.path; |
| 17 | }; |
| 18 | }; |
| 19 | sops.secrets.pgadminPassword = { |
| 20 | mode = "0400"; |
| 21 | owner = config.users.users.pgadmin.name; |
| 22 | group = config.users.users.nobody.group; |
| 23 | }; |
| 24 | }; |
| 25 | } |