about summary refs log tree commit diff
path: root/modules/services/postgresql.nix
blob: 05835a4a5d478e7842284636f6f698d89dee786a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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"
    ];
  };
}