diff options
author | Rory& <root@rory.gay> | 2024-02-19 11:18:45 +0100 |
---|---|---|
committer | Rory& <root@rory.gay> | 2024-06-05 17:25:16 +0200 |
commit | 7720ba2a8c17e31ea303e5b5c72bf8239d65c6c0 (patch) | |
tree | 3b7c1094a10b7dd8b3562debd8c9c72cf0d8cfd8 /host/Spacebar-nginx/containers/spacebar-server/services/postgres.nix | |
parent | Switch dev/nix instance to master (diff) | |
download | Spacebar-Open-Infrastructure-7720ba2a8c17e31ea303e5b5c72bf8239d65c6c0.tar.xz |
Fix container folder name
Diffstat (limited to 'host/Spacebar-nginx/containers/spacebar-server/services/postgres.nix')
-rw-r--r-- | host/Spacebar-nginx/containers/spacebar-server/services/postgres.nix | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/host/Spacebar-nginx/containers/spacebar-server/services/postgres.nix b/host/Spacebar-nginx/containers/spacebar-server/services/postgres.nix new file mode 100644 index 0000000..b3c8cad --- /dev/null +++ b/host/Spacebar-nginx/containers/spacebar-server/services/postgres.nix @@ -0,0 +1,30 @@ +{ config, pkgs, lib, ... }: + +{ + #systemd.tmpfiles.rules = [ "d /data/pg 0750 postgres postgres" ]; + + services.postgresql = { + enable = true; + package = pkgs.postgresql_15; + enableTCPIP = true; + authentication = pkgs.lib.mkOverride 10 '' + # TYPE, DATABASE, USER, ADDRESS, METHOD + local all all trust + host all all 127.0.0.1/32 trust + host all all ::1/128 trust + host all all 0.0.0.0/0 md5 + ''; + initialScript = pkgs.writeText "backend-initScript" '' + CREATE ROLE spacebar WITH LOGIN PASSWORD 'spacebar' CREATEDB; + CREATE DATABASE spacebar WITH OWNER spacebar ENCODING 'UTF8'; + GRANT ALL PRIVILEGES ON DATABASE spacebar TO spacebar; + ''; + #dataDir = "/data/pg"; + settings = { + "max_connections" = "100"; + "shared_buffers" = "128MB"; + "max_wal_size" = "1GB"; + "min_wal_size" = "80MB"; + }; + }; +} \ No newline at end of file |