all repos — nixfiles @ c4c4fcd8a90c9a62bb640f6dc2a14bb11d4ac5f1

System and user configuration, managed by nix and home-manager

SatoshiPay: set up PostgreSQL server
Alan Pearce alan@alanpearce.eu
Wed, 26 Aug 2020 14:07:27 +0200
commit

c4c4fcd8a90c9a62bb640f6dc2a14bb11d4ac5f1

parent

8183780e3193c469de85d24038ceb8ec1e3bac61

1 files changed, 24 insertions(+), 0 deletions(-)

jump to
M system/settings/satoshipay.nixsystem/settings/satoshipay.nix
@@ -61,6 +61,30 @@ OnActiveSec = "1 min";     };
   };
 
+  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";