1 { options, config, pkgs, lib, ... }:
4 cfg = config.services.matterbridge;
7 if cfg.configPath == null then
8 pkgs.writeText "matterbridge.toml" (cfg.configFile)
16 services.matterbridge = {
17 enable = lib.mkEnableOption "Matterbridge chat platform bridge";
19 package = lib.mkPackageOption pkgs "matterbridge" { };
21 configPath = lib.mkOption {
22 type = with lib.types; nullOr str;
24 example = "/etc/nixos/matterbridge.toml";
26 The path to the matterbridge configuration file.
30 configFile = lib.mkOption {
33 # WARNING: as this file contains credentials, do not use this option!
34 # It is kept only for backwards compatibility, and would cause your
35 # credentials to be in the nix-store, thus with the world-readable
37 # Use services.matterbridge.configPath instead.
41 Server="irc.libera.chat:6667"
46 # Do not prefix it with http:// or https://
47 Server="yourmattermostserver.domain"
51 PrefixMessagesWithNick=true
61 account="mattermost.work"
65 WARNING: THIS IS INSECURE, as your password will end up in
66 {file}`/nix/store`, thus publicly readable. Use
67 `services.matterbridge.configPath` instead.
69 The matterbridge configuration file in the TOML file format.
74 default = "matterbridge";
76 User which runs the matterbridge service.
80 group = lib.mkOption {
82 default = "matterbridge";
84 Group which runs the matterbridge service.
90 config = lib.mkIf cfg.enable {
91 warnings = lib.optional options.services.matterbridge.configFile.isDefined
92 "The option services.matterbridge.configFile is insecure and should be replaced with services.matterbridge.configPath";
94 users.users = lib.optionalAttrs (cfg.user == "matterbridge")
96 group = "matterbridge";
101 users.groups = lib.optionalAttrs (cfg.group == "matterbridge")
102 { matterbridge = { };
105 systemd.services.matterbridge = {
106 description = "Matterbridge chat platform bridge";
107 wantedBy = [ "multi-user.target" ];
108 after = [ "network.target" ];
113 ExecStart = "${cfg.package}/bin/matterbridge -conf ${matterbridgeConfToml}";