blob: 29f9e444c1bb768361ca4b1c1b8536a5b5fd30c3 [file] [log] [blame]
Skyler Grey13e45bd2023-01-26 00:39:17 +00001{ 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}