about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
authorsefidel <contact@sefidel.net>2024-02-03 18:40:13 +0900
committersefidel <contact@sefidel.net>2024-02-03 18:40:13 +0900
commitc5519703534567ef84617a58c1b8a622bedd83f3 (patch)
treeef4a830071d395e75a6560af136c26e402cd5e12 /modules
parent761677b8799147598c040c6aebd5748c457c9a55 (diff)
downloadnixrc-c5519703534567ef84617a58c1b8a622bedd83f3.tar.gz
nixrc-c5519703534567ef84617a58c1b8a622bedd83f3.zip
feat(modules): add postgresql
Diffstat (limited to 'modules')
-rw-r--r--modules/services/postgresql.nix34
1 files changed, 34 insertions, 0 deletions
diff --git a/modules/services/postgresql.nix b/modules/services/postgresql.nix
new file mode 100644
index 0000000..05835a4
--- /dev/null
+++ b/modules/services/postgresql.nix
@@ -0,0 +1,34 @@
+{ config, lib, ... }:
+
+with lib;
+let
+  cfg = config.modules.services.postgresql;
+in
+{
+  options.modules.services.postgresql = {
+    enable = mkEnableOption "postgresql with laxed limits";
+  };
+
+  config = mkIf cfg.enable {
+    services.postgresql = {
+      enable = true;
+      settings = {
+        max_connections = "300";
+        shared_buffers = "80MB";
+      };
+      authentication = lib.mkForce ''
+        # Generated file; do not edit!
+        # TYPE  DATABASE        USER            ADDRESS                 METHOD
+        local   all             all                                     trust
+        host    all             all             127.0.0.1/32            trust
+        host    all             all             ::1/128                 trust
+      '';
+    };
+    services.postgresqlBackup.enable = true;
+
+    modules.persistence.directories = [
+      "/var/lib/postgresql"
+      "/var/backup/postgresql"
+    ];
+  };
+}