summary refs log tree commit diff
path: root/host/Rory-portable/postgres.nix
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2024-06-10 17:33:26 +0200
committerRory& <root@rory.gay>2024-07-04 14:45:02 +0200
commite37b430512bbef89dfe8ab75454286de4836ab6e (patch)
treeaf3468855573725fefc29ab8935edcc663d6b6a3 /host/Rory-portable/postgres.nix
parentBunch of changes (diff)
downloadRory-Open-Architecture-e37b430512bbef89dfe8ab75454286de4836ab6e.tar.xz
Add portable config, some updates
Diffstat (limited to 'host/Rory-portable/postgres.nix')
-rwxr-xr-xhost/Rory-portable/postgres.nix34
1 files changed, 34 insertions, 0 deletions
diff --git a/host/Rory-portable/postgres.nix b/host/Rory-portable/postgres.nix
new file mode 100755
index 0000000..e1e4432
--- /dev/null
+++ b/host/Rory-portable/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";
+    };
+  };
+
+}
+