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