{ 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 ''; ensureDatabases = [ "bridge_nightly" ]; ensureUsers = [ { name = "bridge_nightly"; ensurePermissions."DATABASE bridge_nightly" = "ALL PRIVILEGES"; } ]; }; }; }