{ config, lib, ... }: # TODO: rename with lib; let cfg = config.modules.services.matrix-moderation; in { disabledModules = [ "services/matrix/mjolnir.nix" ]; imports = [ ../../overlays/mjolnir-module ]; options.modules.services.matrix-moderation = { enable = mkEnableOption "matrix-moderation"; domain = mkOption { type = types.str; }; realHost = mkOption { type = types.str; default = "matrix.${cfg.domain}"; }; secrets.userPassword = mkOption { type = types.str; description = "path to the mjolnir password"; }; }; config = mkIf cfg.enable { services.mjolnir = { enable = true; homeserverUrl = "https://${cfg.realHost}"; pantalaimon.enable = true; pantalaimon.username = "abuse"; pantalaimon.passwordFile = cfg.secrets.userPassword; managementRoom = "#moderation:${cfg.domain}"; settings = { homeserverUrl = "http://127.0.0.1:8009"; automaticallyRedactForReasons = [ "spam" "advertising" "unwanted" ]; }; }; systemd.services.mjolnir.after = [ "dendrite.service" ]; environment.persistence."/persist".directories = [ "/var/lib/private/pantalaimon-mjolnir" "/var/lib/mjolnir" ]; }; }