2023-05-11 05:33:08 +07:00
|
|
|
{ config
|
|
|
|
, lib
|
2023-06-27 15:25:19 +07:00
|
|
|
, pkgs
|
2023-05-11 05:33:08 +07:00
|
|
|
, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.server;
|
|
|
|
# i've yet to create a maubot module so this is hardcoded
|
|
|
|
maubotAddr = "127.0.0.1";
|
|
|
|
maubotPort = 29316;
|
|
|
|
in {
|
2023-05-17 06:29:03 +07:00
|
|
|
impermanence.directories = [
|
|
|
|
{ directory = /var/lib/maubot; user = "maubot"; group = "maubot"; mode = "0755"; }
|
|
|
|
];
|
2023-05-11 05:33:08 +07:00
|
|
|
services.nginx.virtualHosts."matrix.${cfg.domainName}".locations = {
|
|
|
|
"/_matrix/maubot/" = {
|
2023-05-17 06:29:03 +07:00
|
|
|
proxyPass = "http://${lib.quoteListenAddr maubotAddr}:${toString maubotPort}";
|
2023-05-11 05:33:08 +07:00
|
|
|
proxyWebsockets = true;
|
|
|
|
};
|
|
|
|
};
|
2023-06-27 15:25:19 +07:00
|
|
|
/*users.users.maubot = {
|
2023-05-11 05:33:08 +07:00
|
|
|
home = "/var/lib/maubot";
|
|
|
|
group = "maubot";
|
|
|
|
isSystemUser = true;
|
|
|
|
};
|
2023-06-27 15:25:19 +07:00
|
|
|
users.groups.maubot = { };*/
|
|
|
|
/*systemd.services.maubot = {
|
2023-05-11 05:33:08 +07:00
|
|
|
description = "Maubot";
|
|
|
|
wants = [ "matrix-synapse.service" "nginx.service" ];
|
|
|
|
after = [ "matrix-synapse.service" "nginx.service" ];
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
environment = {
|
|
|
|
LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib";
|
|
|
|
};
|
|
|
|
serviceConfig = {
|
|
|
|
User = "maubot";
|
|
|
|
Group = "maubot";
|
|
|
|
WorkingDirectory = "/var/lib/maubot/data";
|
|
|
|
};
|
|
|
|
script = "${pkgs.python3.withPackages (pks: with pks; [
|
|
|
|
pkgs.maubot (pkgs.pineapplebot.override {
|
|
|
|
magic = cfg.pizzabotMagic;
|
|
|
|
}) feedparser levenshtein python-dateutil pytz
|
|
|
|
])}/bin/python3 -m maubot";
|
2023-06-27 15:25:19 +07:00
|
|
|
};*/
|
|
|
|
systemd.services.maubot = {
|
|
|
|
after = [ "nginx.service" ];
|
|
|
|
requires = [ "nginx.service" ];
|
|
|
|
};
|
|
|
|
services.maubot.enable = true;
|
|
|
|
services.maubot.settings = {
|
2023-06-29 03:10:41 +07:00
|
|
|
database = "postgresql://maubot@localhost/maubot";
|
2023-06-27 15:25:19 +07:00
|
|
|
server.public_url = "https://matrix.${cfg.domainName}";
|
2023-05-11 05:33:08 +07:00
|
|
|
};
|
2023-06-27 15:25:19 +07:00
|
|
|
services.maubot.plugins = with config.services.maubot.package.plugins; [
|
2023-07-12 03:26:50 +07:00
|
|
|
weather
|
|
|
|
urban
|
|
|
|
media
|
|
|
|
reactbot
|
|
|
|
reminder
|
|
|
|
translate
|
|
|
|
rss
|
2023-06-27 15:25:19 +07:00
|
|
|
];
|
|
|
|
services.maubot.pythonPackages = [
|
|
|
|
(pkgs.pineapplebot.override { magic = cfg.pizzabotMagic; })
|
|
|
|
] ++ (with pkgs.python3.pkgs; [
|
|
|
|
levenshtein
|
|
|
|
]);
|
2023-05-11 05:33:08 +07:00
|
|
|
}
|