nixpkgs/nixos/modules
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
..
config 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
i18n/input-method nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
installer nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
misc nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
profiles NixOS AWS AMI: enable the serial console on ttyS0 2021-08-20 12:42:02 -04:00
programs 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
services nixos.mautrix-facebook: init module 2021-10-04 18:40:28 -04:00
system nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
tasks nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
testing nixos/lib/qemu-flags: rename to qemu-common 2021-09-18 16:58:16 +02:00
virtualisation nixos/doc: clean up defaults and examples 2021-10-04 12:47:20 +02:00
module-list.nix nixos.mautrix-facebook: init module 2021-10-04 18:40:28 -04:00
rename.nix treewide: yank wicd as it is abandoned 2021-09-11 23:46:52 +02:00