diff --git a/nixos/modules/services/networking/coturn.nix b/nixos/modules/services/networking/coturn.nix index 215d679c09dd..ab8806dc03a1 100644 --- a/nixos/modules/services/networking/coturn.nix +++ b/nixos/modules/services/networking/coturn.nix @@ -3,39 +3,39 @@ let cfg = config.services.coturn; pidfile = "/run/turnserver/turnserver.pid"; configFile = pkgs.writeText "turnserver.conf" '' -listening-port=${toString cfg.listening-port} -tls-listening-port=${toString cfg.tls-listening-port} -alt-listening-port=${toString cfg.alt-listening-port} -alt-tls-listening-port=${toString cfg.alt-tls-listening-port} -${lib.concatStringsSep "\n" (map (x: "listening-ip=${x}") cfg.listening-ips)} -${lib.concatStringsSep "\n" (map (x: "relay-ip=${x}") cfg.relay-ips)} -min-port=${toString cfg.min-port} -max-port=${toString cfg.max-port} -${lib.optionalString cfg.lt-cred-mech "lt-cred-mech"} -${lib.optionalString cfg.no-auth "no-auth"} -${lib.optionalString cfg.use-auth-secret "use-auth-secret"} -${lib.optionalString (cfg.static-auth-secret != null) ("static-auth-secret=${cfg.static-auth-secret}")} -${lib.optionalString (cfg.static-auth-secret-file != null) ("static-auth-secret=#static-auth-secret#")} -realm=${cfg.realm} -${lib.optionalString cfg.no-udp "no-udp"} -${lib.optionalString cfg.no-tcp "no-tcp"} -${lib.optionalString cfg.no-tls "no-tls"} -${lib.optionalString cfg.no-dtls "no-dtls"} -${lib.optionalString cfg.no-udp-relay "no-udp-relay"} -${lib.optionalString cfg.no-tcp-relay "no-tcp-relay"} -${lib.optionalString (cfg.cert != null) "cert=${cfg.cert}"} -${lib.optionalString (cfg.pkey != null) "pkey=${cfg.pkey}"} -${lib.optionalString (cfg.dh-file != null) ("dh-file=${cfg.dh-file}")} -no-stdout-log -syslog -pidfile=${pidfile} -${lib.optionalString cfg.secure-stun "secure-stun"} -${lib.optionalString cfg.no-cli "no-cli"} -cli-ip=${cfg.cli-ip} -cli-port=${toString cfg.cli-port} -${lib.optionalString (cfg.cli-password != null) ("cli-password=${cfg.cli-password}")} -${cfg.extraConfig} -''; + listening-port=${toString cfg.listening-port} + tls-listening-port=${toString cfg.tls-listening-port} + alt-listening-port=${toString cfg.alt-listening-port} + alt-tls-listening-port=${toString cfg.alt-tls-listening-port} + ${lib.concatStringsSep "\n" (map (x: "listening-ip=${x}") cfg.listening-ips)} + ${lib.concatStringsSep "\n" (map (x: "relay-ip=${x}") cfg.relay-ips)} + min-port=${toString cfg.min-port} + max-port=${toString cfg.max-port} + ${lib.optionalString cfg.lt-cred-mech "lt-cred-mech"} + ${lib.optionalString cfg.no-auth "no-auth"} + ${lib.optionalString cfg.use-auth-secret "use-auth-secret"} + ${lib.optionalString (cfg.static-auth-secret != null) "static-auth-secret=${cfg.static-auth-secret}"} + ${lib.optionalString (cfg.static-auth-secret-file != null) "static-auth-secret=#static-auth-secret#"} + realm=${cfg.realm} + ${lib.optionalString cfg.no-udp "no-udp"} + ${lib.optionalString cfg.no-tcp "no-tcp"} + ${lib.optionalString cfg.no-tls "no-tls"} + ${lib.optionalString cfg.no-dtls "no-dtls"} + ${lib.optionalString cfg.no-udp-relay "no-udp-relay"} + ${lib.optionalString cfg.no-tcp-relay "no-tcp-relay"} + ${lib.optionalString (cfg.cert != null) "cert=${cfg.cert}"} + ${lib.optionalString (cfg.pkey != null) "pkey=${cfg.pkey}"} + ${lib.optionalString (cfg.dh-file != null) "dh-file=${cfg.dh-file}"} + no-stdout-log + syslog + pidfile=${pidfile} + ${lib.optionalString cfg.secure-stun "secure-stun"} + ${lib.optionalString cfg.no-cli "no-cli"} + cli-ip=${cfg.cli-ip} + cli-port=${toString cfg.cli-port} + ${lib.optionalString (cfg.cli-password != null) "cli-password=${cfg.cli-password}"} + ${cfg.extraConfig} + ''; in { options = { services.coturn = { @@ -301,7 +301,7 @@ in { }; }; - config = lib.mkIf cfg.enable (lib.mkMerge ([ + config = lib.mkIf cfg.enable (lib.mkMerge [ { assertions = [ { assertion = cfg.static-auth-secret != null -> cfg.static-auth-secret-file == null ; message = "static-auth-secret and static-auth-secret-file cannot be set at the same time"; @@ -402,5 +402,5 @@ in { UMask = "0077"; }; }; - }])); + }]); }