···
cfg = config.services.jicofo;
8
+
# HOCON is a JSON superset that some jitsi-meet components use for configuration
9
+
toHOCON = x: if isAttrs x && x ? __hocon_envvar then ("\${" + x.__hocon_envvar + "}")
10
+
else if isAttrs x && x ? __hocon_unquoted_string then x.__hocon_unquoted_string
11
+
else if isAttrs x then "{${ concatStringsSep "," (mapAttrsToList (k: v: ''"${k}":${toHOCON v}'') x) }}"
12
+
else if isList x then "[${ concatMapStringsSep "," toHOCON x }]"
13
+
else builtins.toJSON x;
15
+
configFile = pkgs.writeText "jicofo.conf" (toHOCON cfg.config);
options.services.jicofo = with types; {
···
80
+
type = (pkgs.formats.json {}).type;
example = literalExpression ''
75
-
"org.jitsi.jicofo.auth.URL" = "XMPP:jitsi-meet.example.com";
84
+
jicofo.bridge.max-bridge-participants = 42;
description = lib.mdDoc ''
79
-
Contents of the {file}`sip-communicator.properties` configuration file for jicofo.
88
+
Contents of the {file}`jicofo.conf` configuration file.
config = mkIf cfg.enable {
85
-
services.jicofo.config = mapAttrs (_: v: mkDefault v) {
86
-
"org.jitsi.jicofo.BRIDGE_MUC" = cfg.bridgeMuc;
94
+
services.jicofo.config = {
96
+
bridge.brewery-jid = cfg.bridgeMuc;
99
+
hostname = cfg.xmppHost;
100
+
username = cfg.userName;
101
+
domain = cfg.userDomain;
102
+
password = { __hocon_envvar = "JICOFO_AUTH_PASS"; };
103
+
xmpp-domain = if cfg.xmppDomain == null then cfg.xmppHost else cfg.xmppDomain;
users.groups.jitsi-meet = {};
···
"-Dnet.java.sip.communicator.SC_HOME_DIR_LOCATION" = "/etc/jitsi";
"-Dnet.java.sip.communicator.SC_HOME_DIR_NAME" = "jicofo";
"-Djava.util.logging.config.file" = "/etc/jitsi/jicofo/logging.properties";
117
+
"-Dconfig.file" = configFile;
···
after = [ "network.target" ];
104
-
config.environment.etc."jitsi/jicofo/sip-communicator.properties".source
environment.JAVA_SYS_PROPS = concatStringsSep " " (mapAttrsToList (k: v: "${k}=${toString v}") jicofoProps);
109
-
${pkgs.jicofo}/bin/jicofo \
110
-
--host=${cfg.xmppHost} \
111
-
--domain=${if cfg.xmppDomain == null then cfg.xmppHost else cfg.xmppDomain} \
112
-
--secret=$(cat ${cfg.componentPasswordFile}) \
113
-
--user_name=${cfg.userName} \
114
-
--user_domain=${cfg.userDomain} \
115
-
--user_password=$(cat ${cfg.userPasswordFile})
131
+
export JICOFO_AUTH_PASS="$(<${cfg.userPasswordFile})"
132
+
exec "${pkgs.jicofo}/bin/jicofo"
···
143
-
environment.etc."jitsi/jicofo/sip-communicator.properties".source =
144
-
pkgs.writeText "sip-communicator.properties" (
145
-
generators.toKeyValue {} cfg.config
160
+
environment.etc."jitsi/jicofo/sip-communicator.properties".text = "";
environment.etc."jitsi/jicofo/logging.properties".source =
mkDefault "${pkgs.jicofo}/etc/jitsi/jicofo/logging.properties-journal";