summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--system/settings/satoshipay.nix24
1 files changed, 24 insertions, 0 deletions
diff --git a/system/settings/satoshipay.nix b/system/settings/satoshipay.nix
index 53384e09..bd5f3202 100644
--- a/system/settings/satoshipay.nix
+++ b/system/settings/satoshipay.nix
@@ -61,6 +61,30 @@
     };
   };
 
+  services.postgresql = {
+    enable = true;
+    ensureDatabases = ["satoshipay"];
+    authentication = ''
+      # TYPE  DATABASE        USER            ADDRESS                 METHOD
+      local   all             postgres                                trust
+      local   all             all                                     md5
+    '';
+    ensureUsers = [
+      {
+        name = "alan";
+        ensurePermissions = {
+          "ALL TABLES IN SCHEMA public" = "ALL PRIVILEGES";
+        };
+      }
+      {
+        name = "satoshipay";
+        ensurePermissions = {
+          "DATABASE satoshipay" = "ALL PRIVILEGES";
+        };
+      }
+    ];
+  };
+
   nix.gc.dates = "12:30";
   system.autoUpgrade.dates = "13:05";