3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/modules/services
Kevin Cox ed5403efc3
nixos.mautrix-facebook: init module
This is the first version of the mautrix-facebook module. Due to lack of secret support on NixOS as well as the requirement of a homeserver domain it requires some setup. For completeness here is my working config using NixOps secrets:

```nix
deployment.keys."mautrix-facebook-config.env" = {
	text = ''
		MAUTRIX_FACEBOOK_APPSERVICE_AS_TOKEN=${secrets.as_token}
		MAUTRIX_FACEBOOK_APPSERVICE_HS_TOKEN=${secrets.hs_token}
	'';
	destDir = "/var/keys";
};

deployment.keys."mautrix-facebook-registration.yaml" = {
	text = builtins.toJSON config.services.mautrix-facebook.registrationData;
	destDir = "/var/keys";
	user = "matrix-synapse";
};

users.users.matrix-synapse.extraGroups = ["keys"];

systemd.services.matrix-synapse.after = ["keys.service"];
systemd.services.matrix-synapse.wants = ["keys.service"];

services.mautrix-facebook = {
	enable = true;
	settings = {
		homeserver.domain = "bots.kevincox.ca";

		bridge = {
			displayname_template = "{displayname}";

			permissions = {
				"@kevincox:matrix.org" = "admin";
			};
		};
	};

	environmentFile = "/var/keys/mautrix-facebook-config.env";

	registrationData = {
		as_token = secrets.as_token;
		hs_token = secrets.hs_token;
	};
};

systemd.services.mautrix-facebook = rec {
	wants = ["keys.target"];
	after = wants;
};

services.matrix-synapse.app_service_config_files = [
	"/var/keys/mautrix-facebook-registration.yaml"
];
```
2021-10-04 18:40:28 -04:00
..
admin nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
amqp nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
audio Merge pull request #136909 from ncfavier/cleanup-defaults-examples 2021-10-04 20:37:42 +02:00
backup nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
blockchain/ethereum nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
cluster nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
computing nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
continuous-integration nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
databases nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
desktops Merge pull request #136909 from ncfavier/cleanup-defaults-examples 2021-10-04 20:37:42 +02:00
development nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
display-managers nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
editors nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
games nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
hardware nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
logging nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
mail nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
misc nixos.mautrix-facebook: init module 2021-10-04 18:40:28 -04:00
monitoring nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
network-filesystems nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
networking nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
printing nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
scheduling nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
search nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
security nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
system nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
torrent nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
ttys nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
video nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
wayland nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
web-apps nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
web-servers nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
x11 nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00