summary refs log tree commit diff
path: root/host/Rory-postgres
diff options
context:
space:
mode:
Diffstat (limited to 'host/Rory-postgres')
-rwxr-xr-xhost/Rory-postgres/configuration.nix30
-rwxr-xr-xhost/Rory-postgres/software.nix40
2 files changed, 41 insertions, 29 deletions
diff --git a/host/Rory-postgres/configuration.nix b/host/Rory-postgres/configuration.nix
index fef0296..f399f78 100755
--- a/host/Rory-postgres/configuration.nix
+++ b/host/Rory-postgres/configuration.nix
@@ -4,6 +4,7 @@
   imports =
     [
       ../../modules/base-server.nix
+      ./software.nix
     ];
 
   networking = {
@@ -17,35 +18,6 @@
       prefixLength = 16;
     } ];
   };
-  
-  systemd.tmpfiles.rules = [  "d /data/pg 0750 postgres postgres" ];
-
-  services.postgresql = {
-    enable = true;
-    package = pkgs.postgresql_14;
-    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.50/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 = "/data/pg";
-    settings = {
-      "max_connections" = "100";
-      "shared_buffers" = "128MB";
-      "max_wal_size" = "1GB";
-      "min_wal_size" = "80MB";
-    };
-  };
 
   system.stateVersion = "22.11"; # DO NOT EDIT!
 }
diff --git a/host/Rory-postgres/software.nix b/host/Rory-postgres/software.nix
new file mode 100755
index 0000000..99cdd64
--- /dev/null
+++ b/host/Rory-postgres/software.nix
@@ -0,0 +1,40 @@
+{ config, pkgs, lib, ... }:
+
+{
+  imports =
+    [
+      ../../modules/base-server.nix
+    ];
+  
+  systemd.tmpfiles.rules = [  "d /data/pg 0750 postgres postgres" ];
+
+  services.postgresql = {
+    enable = true;
+    package = pkgs.postgresql_14;
+    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.50/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 = "/data/pg";
+    settings = {
+      "max_connections" = "100";
+      "shared_buffers" = "128MB";
+      "max_wal_size" = "1GB";
+      "min_wal_size" = "80MB";
+    };
+  };
+
+  system.stateVersion = "22.11"; # DO NOT EDIT!
+}
+