nixos/services.jigasi: remove with lib;

This commit is contained in:
Felix Buehler
2024-08-28 21:19:10 +02:00
committed by Jörg Thalheim
parent 0cca8e9756
commit fee0a07c28

View File

@@ -1,7 +1,4 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with lib;
let let
cfg = config.services.jigasi; cfg = config.services.jigasi;
homeDirName = "jigasi-home"; homeDirName = "jigasi-home";
@@ -10,10 +7,10 @@ let
sipCommunicatorPropertiesFileUnsubstituted = "${pkgs.jigasi}/etc/jitsi/jigasi/sip-communicator.properties"; sipCommunicatorPropertiesFileUnsubstituted = "${pkgs.jigasi}/etc/jitsi/jigasi/sip-communicator.properties";
in in
{ {
options.services.jigasi = with types; { options.services.jigasi = with lib.types; {
enable = mkEnableOption "Jitsi Gateway to SIP - component of Jitsi Meet"; enable = lib.mkEnableOption "Jitsi Gateway to SIP - component of Jitsi Meet";
xmppHost = mkOption { xmppHost = lib.mkOption {
type = str; type = str;
example = "localhost"; example = "localhost";
description = '' description = ''
@@ -21,7 +18,7 @@ in
''; '';
}; };
xmppDomain = mkOption { xmppDomain = lib.mkOption {
type = nullOr str; type = nullOr str;
example = "meet.example.org"; example = "meet.example.org";
description = '' description = ''
@@ -31,7 +28,7 @@ in
''; '';
}; };
componentPasswordFile = mkOption { componentPasswordFile = lib.mkOption {
type = str; type = str;
example = "/run/keys/jigasi-component"; example = "/run/keys/jigasi-component";
description = '' description = ''
@@ -39,7 +36,7 @@ in
''; '';
}; };
userName = mkOption { userName = lib.mkOption {
type = str; type = str;
default = "callcontrol"; default = "callcontrol";
description = '' description = ''
@@ -47,7 +44,7 @@ in
''; '';
}; };
userDomain = mkOption { userDomain = lib.mkOption {
type = str; type = str;
example = "internal.meet.example.org"; example = "internal.meet.example.org";
description = '' description = ''
@@ -55,7 +52,7 @@ in
''; '';
}; };
userPasswordFile = mkOption { userPasswordFile = lib.mkOption {
type = str; type = str;
example = "/run/keys/jigasi-user"; example = "/run/keys/jigasi-user";
description = '' description = ''
@@ -63,7 +60,7 @@ in
''; '';
}; };
bridgeMuc = mkOption { bridgeMuc = lib.mkOption {
type = str; type = str;
example = "jigasibrewery@internal.meet.example.org"; example = "jigasibrewery@internal.meet.example.org";
description = '' description = ''
@@ -71,7 +68,7 @@ in
''; '';
}; };
defaultJvbRoomName = mkOption { defaultJvbRoomName = lib.mkOption {
type = str; type = str;
default = ""; default = "";
example = "siptest"; example = "siptest";
@@ -80,8 +77,8 @@ in
''; '';
}; };
environmentFile = mkOption { environmentFile = lib.mkOption {
type = types.nullOr types.path; type = lib.types.nullOr lib.types.path;
default = null; default = null;
description = '' description = ''
File containing environment variables to be passed to the jigasi service, File containing environment variables to be passed to the jigasi service,
@@ -93,10 +90,10 @@ in
''; '';
}; };
config = mkOption { config = lib.mkOption {
type = attrsOf str; type = attrsOf str;
default = { }; default = { };
example = literalExpression '' example = lib.literalExpression ''
{ {
"org.jitsi.jigasi.auth.URL" = "XMPP:jitsi-meet.example.com"; "org.jitsi.jigasi.auth.URL" = "XMPP:jitsi-meet.example.com";
} }
@@ -107,12 +104,12 @@ in
}; };
}; };
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
services.jicofo.config = { services.jicofo.config = {
"org.jitsi.jicofo.jigasi.BREWERY" = "${cfg.bridgeMuc}"; "org.jitsi.jicofo.jigasi.BREWERY" = "${cfg.bridgeMuc}";
}; };
services.jigasi.config = mapAttrs (_: v: mkDefault v) { services.jigasi.config = lib.mapAttrs (_: v: lib.mkDefault v) {
"org.jitsi.jigasi.BRIDGE_MUC" = cfg.bridgeMuc; "org.jitsi.jigasi.BRIDGE_MUC" = cfg.bridgeMuc;
}; };
@@ -186,7 +183,7 @@ in
restartTriggers = [ restartTriggers = [
config.environment.etc."jitsi/jigasi/sip-communicator.properties".source config.environment.etc."jitsi/jigasi/sip-communicator.properties".source
]; ];
environment.JAVA_SYS_PROPS = concatStringsSep " " (mapAttrsToList (k: v: "${k}=${toString v}") jigasiProps); environment.JAVA_SYS_PROPS = lib.concatStringsSep " " (lib.mapAttrsToList (k: v: "${k}=${toString v}") jigasiProps);
script = '' script = ''
${pkgs.jigasi}/bin/jigasi \ ${pkgs.jigasi}/bin/jigasi \
@@ -228,9 +225,9 @@ in
}; };
environment.etc."jitsi/jigasi/sip-communicator.properties".source = environment.etc."jitsi/jigasi/sip-communicator.properties".source =
mkDefault "${sipCommunicatorPropertiesFile}"; lib.mkDefault "${sipCommunicatorPropertiesFile}";
environment.etc."jitsi/jigasi/logging.properties".source = environment.etc."jitsi/jigasi/logging.properties".source =
mkDefault "${stateDir}/logging.properties-journal"; lib.mkDefault "${stateDir}/logging.properties-journal";
}; };
meta.maintainers = lib.teams.jitsi.members; meta.maintainers = lib.teams.jitsi.members;