10 cfg = config.services.matterbridge;
12 matterbridgeConfToml =
13 if cfg.configPath == null then
14 pkgs.writeText "matterbridge.toml" (cfg.configFile)
22 services.matterbridge = {
23 enable = lib.mkEnableOption "Matterbridge chat platform bridge";
25 package = lib.mkPackageOption pkgs "matterbridge" { };
27 configPath = lib.mkOption {
28 type = with lib.types; nullOr str;
30 example = "/etc/nixos/matterbridge.toml";
32 The path to the matterbridge configuration file.
36 configFile = lib.mkOption {
39 # WARNING: as this file contains credentials, do not use this option!
40 # It is kept only for backwards compatibility, and would cause your
41 # credentials to be in the nix-store, thus with the world-readable
43 # Use services.matterbridge.configPath instead.
47 Server="irc.libera.chat:6667"
52 # Do not prefix it with http:// or https://
53 Server="yourmattermostserver.domain"
57 PrefixMessagesWithNick=true
67 account="mattermost.work"
71 WARNING: THIS IS INSECURE, as your password will end up in
72 {file}`/nix/store`, thus publicly readable. Use
73 `services.matterbridge.configPath` instead.
75 The matterbridge configuration file in the TOML file format.
80 default = "matterbridge";
82 User which runs the matterbridge service.
86 group = lib.mkOption {
88 default = "matterbridge";
90 Group which runs the matterbridge service.
96 config = lib.mkIf cfg.enable {
97 warnings = lib.optional options.services.matterbridge.configFile.isDefined "The option services.matterbridge.configFile is insecure and should be replaced with services.matterbridge.configPath";
99 users.users = lib.optionalAttrs (cfg.user == "matterbridge") {
101 group = "matterbridge";
106 users.groups = lib.optionalAttrs (cfg.group == "matterbridge") {
110 systemd.services.matterbridge = {
111 description = "Matterbridge chat platform bridge";
112 wantedBy = [ "multi-user.target" ];
113 after = [ "network.target" ];
118 ExecStart = "${cfg.package}/bin/matterbridge -conf ${matterbridgeConfToml}";