summary refs log tree commit diff
path: root/host/Rory-desktop/postgres.nix
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-12-14 07:24:04 +0100
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-12-14 07:24:55 +0100
commitd935a4f3e1d67152149945adc31b7886ccf37701 (patch)
treeae4d39bda4c767b4675d6477c7d9c3ed88939237 /host/Rory-desktop/postgres.nix
parentUpdate synapse cache settings (diff)
downloadRory-Open-Architecture-d935a4f3e1d67152149945adc31b7886ccf37701.tar.xz
Desktop updates
Diffstat (limited to 'host/Rory-desktop/postgres.nix')
-rwxr-xr-xhost/Rory-desktop/postgres.nix34
1 files changed, 34 insertions, 0 deletions
diff --git a/host/Rory-desktop/postgres.nix b/host/Rory-desktop/postgres.nix
new file mode 100755
index 0000000..e1e4432
--- /dev/null
+++ b/host/Rory-desktop/postgres.nix
@@ -0,0 +1,34 @@
+{ config, pkgs, lib, ... }:
+
+{
+  #systemd.tmpfiles.rules = [  "d /mnt/postgres/data 0750 postgres postgres" ];
+
+  services.postgresql = {
+    enable = true;
+    package = pkgs.postgresql_16;
+    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 discordbots discordbots 192.168.1.2/32 trust
+      host matrix-synapse-rory-gay matrix-synapse-rory-gay 192.168.1.5/32 trust
+      host all all 0.0.0.0/0 md5
+    '';
+    # initialScript = pkgs.writeText "backend-initScript" ''
+    #   CREATE ROLE nixcloud WITH LOGIN PASSWORD 'nixcloud' CREATEDB;
+    #   CREATE DATABASE nixcloud;
+    #   GRANT ALL PRIVILEGES ON DATABASE nixcloud TO nixcloud;
+    # '';
+    #dataDir = "/mnt/postgres/data";
+    settings = {
+      "max_connections" = "100";
+      "shared_buffers" = "128MB";
+      "max_wal_size" = "1GB";
+      "min_wal_size" = "80MB";
+    };
+  };
+
+}
+