summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2020-08-26 14:07:27 +0200
committerAlan Pearce2020-08-26 14:07:27 +0200
commitc4c4fcd8a90c9a62bb640f6dc2a14bb11d4ac5f1 (patch)
tree8ff50e1350dc4cff290e4c6914f22247754f46fa
parent8183780e3193c469de85d24038ceb8ec1e3bac61 (diff)
downloadnixfiles-c4c4fcd8a90c9a62bb640f6dc2a14bb11d4ac5f1.tar.lz
nixfiles-c4c4fcd8a90c9a62bb640f6dc2a14bb11d4ac5f1.tar.zst
nixfiles-c4c4fcd8a90c9a62bb640f6dc2a14bb11d4ac5f1.zip
SatoshiPay: set up PostgreSQL server
-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";