forked from mirrors/nixpkgs
2c529c3cb8
The project has moved away from Freenode as an IRC network[1], and there is now a quite large channel on Libera. As such, we should point users towards that instead. This also changes all examples to refer to libera instead of freenode as, with the recent deletion of all freenode channels, it is perhaps where most communities are to be found nowadays. Finally, also link to the official Matrix room[2] as an alternative to IRC. Related: https://github.com/NixOS/nixpkgs/pull/129384 [1]: https://discourse.nixos.org/t/join-us-on-matrix-at-nix-nixos-org-migrating-from-freenode [2]: https://github.com/NixOS/rfcs/pull/94
121 lines
3.3 KiB
Nix
121 lines
3.3 KiB
Nix
{ options, config, pkgs, lib, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.services.matterbridge;
|
|
|
|
matterbridgeConfToml =
|
|
if cfg.configPath == null then
|
|
pkgs.writeText "matterbridge.toml" (cfg.configFile)
|
|
else
|
|
cfg.configPath;
|
|
|
|
in
|
|
|
|
{
|
|
options = {
|
|
services.matterbridge = {
|
|
enable = mkEnableOption "Matterbridge chat platform bridge";
|
|
|
|
configPath = mkOption {
|
|
type = with types; nullOr str;
|
|
default = null;
|
|
example = "/etc/nixos/matterbridge.toml";
|
|
description = ''
|
|
The path to the matterbridge configuration file.
|
|
'';
|
|
};
|
|
|
|
configFile = mkOption {
|
|
type = types.str;
|
|
example = ''
|
|
# WARNING: as this file contains credentials, do not use this option!
|
|
# It is kept only for backwards compatibility, and would cause your
|
|
# credentials to be in the nix-store, thus with the world-readable
|
|
# permission bits.
|
|
# Use services.matterbridge.configPath instead.
|
|
|
|
[irc]
|
|
[irc.libera]
|
|
Server="irc.libera.chat:6667"
|
|
Nick="matterbot"
|
|
|
|
[mattermost]
|
|
[mattermost.work]
|
|
# Do not prefix it with http:// or https://
|
|
Server="yourmattermostserver.domain"
|
|
Team="yourteam"
|
|
Login="yourlogin"
|
|
Password="yourpass"
|
|
PrefixMessagesWithNick=true
|
|
|
|
[[gateway]]
|
|
name="gateway1"
|
|
enable=true
|
|
[[gateway.inout]]
|
|
account="irc.libera"
|
|
channel="#testing"
|
|
|
|
[[gateway.inout]]
|
|
account="mattermost.work"
|
|
channel="off-topic"
|
|
'';
|
|
description = ''
|
|
WARNING: THIS IS INSECURE, as your password will end up in
|
|
<filename>/nix/store</filename>, thus publicly readable. Use
|
|
<literal>services.matterbridge.configPath</literal> instead.
|
|
|
|
The matterbridge configuration file in the TOML file format.
|
|
'';
|
|
};
|
|
user = mkOption {
|
|
type = types.str;
|
|
default = "matterbridge";
|
|
description = ''
|
|
User which runs the matterbridge service.
|
|
'';
|
|
};
|
|
|
|
group = mkOption {
|
|
type = types.str;
|
|
default = "matterbridge";
|
|
description = ''
|
|
Group which runs the matterbridge service.
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
warnings = optional options.services.matterbridge.configFile.isDefined
|
|
"The option services.matterbridge.configFile is insecure and should be replaced with services.matterbridge.configPath";
|
|
|
|
users.users = optionalAttrs (cfg.user == "matterbridge")
|
|
{ matterbridge = {
|
|
group = "matterbridge";
|
|
isSystemUser = true;
|
|
};
|
|
};
|
|
|
|
users.groups = optionalAttrs (cfg.group == "matterbridge")
|
|
{ matterbridge = { };
|
|
};
|
|
|
|
systemd.services.matterbridge = {
|
|
description = "Matterbridge chat platform bridge";
|
|
wantedBy = [ "multi-user.target" ];
|
|
after = [ "network.target" ];
|
|
|
|
serviceConfig = {
|
|
User = cfg.user;
|
|
Group = cfg.group;
|
|
ExecStart = "${pkgs.matterbridge}/bin/matterbridge -conf ${matterbridgeConfToml}";
|
|
Restart = "always";
|
|
RestartSec = "10";
|
|
};
|
|
};
|
|
};
|
|
}
|