summaryrefslogtreecommitdiff
path: root/modules/bridge.nix
blob: e26ba73f0608d4fa10869206d0fe05cbd0081a31 (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
{ config, lib, pkgs, ... }:
let
  cfg = config.orbekk.bridge;
in
with lib;
{
  options = {
    orbekk.bridge = {
      enable = mkEnableOption "Enable bridge service";
    };
  };

  config = mkIf cfg.enable {
    services.postgresql = {
      enable = true;
      enableTCPIP = true;
      authentication = ''
        host  all all 2001:470:8e2e:1000::/64      md5
        host  all all 2001:470:8e2e:100::/64      md5
      '';
      ensureDatabases = [ "bridge_nightly" ];
      ensureUsers = [
        {
          name = "bridge_nightly";
          ensurePermissions."DATABASE bridge_nightly" = "ALL PRIVILEGES";
        }
      ];
    };
  };
}