Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
82 lines
2.2 KiB
Nix
82 lines
2.2 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
yarnConfigHook,
|
|
yarnBuildHook,
|
|
yarnInstallHook,
|
|
nodejs,
|
|
fetchFromGitHub,
|
|
fetchYarnDeps,
|
|
matrix-sdk-crypto-nodejs,
|
|
makeWrapper,
|
|
nixosTests,
|
|
}:
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "mjolnir";
|
|
version = "1.9.2";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "matrix-org";
|
|
repo = "mjolnir";
|
|
tag = "v${finalAttrs.version}";
|
|
hash = "sha256-OxHnCMP6IP0EaAs4YQgmV04tq6IdAYmKQX8O9Q48CPk=";
|
|
};
|
|
|
|
patches = [
|
|
# TODO: Fix tfjs-node dependency
|
|
./001-disable-nsfwprotection.patch
|
|
];
|
|
|
|
offlineCache = fetchYarnDeps {
|
|
yarnLock = "${finalAttrs.src}/yarn.lock";
|
|
hash = "sha256-1V7ooONt9j+4hk/3w6Dsv/SdWwa1xsLk97EwhuPegNo=";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
yarnConfigHook
|
|
yarnBuildHook
|
|
yarnInstallHook
|
|
nodejs
|
|
makeWrapper
|
|
];
|
|
|
|
postInstall = ''
|
|
cp -r lib/* $out/lib/node_modules/mjolnir/lib/
|
|
|
|
rm -rf $out/lib/node_modules/mjolnir/node_modules/@matrix-org/matrix-sdk-crypto-nodejs
|
|
ln -s ${matrix-sdk-crypto-nodejs}/lib/node_modules/@matrix-org/matrix-sdk-crypto-nodejs $out/lib/node_modules/mjolnir/node_modules/@matrix-org/matrix-sdk-crypto-nodejs
|
|
|
|
makeWrapper ${nodejs}/bin/node "$out/bin/mjolnir" \
|
|
--add-flags "$out/lib/node_modules/mjolnir/lib/index.js"
|
|
'';
|
|
|
|
passthru = {
|
|
tests = {
|
|
inherit (nixosTests) mjolnir;
|
|
};
|
|
};
|
|
|
|
meta = {
|
|
description = "Moderation tool for Matrix";
|
|
homepage = "https://github.com/matrix-org/mjolnir";
|
|
longDescription = ''
|
|
As an all-in-one moderation tool, it can protect your server from
|
|
malicious invites, spam messages, and whatever else you don't want.
|
|
In addition to server-level protection, Mjolnir is great for communities
|
|
wanting to protect their rooms without having to use their personal
|
|
accounts for moderation.
|
|
|
|
The bot by default includes support for bans, redactions, anti-spam,
|
|
server ACLs, room directory changes, room alias transfers, account
|
|
deactivation, room shutdown, and more.
|
|
|
|
A Synapse module is also available to apply the same rulesets the bot
|
|
uses across an entire homeserver.
|
|
'';
|
|
license = lib.licenses.asl20;
|
|
maintainers = with lib.maintainers; [ jojosch ];
|
|
mainProgram = "mjolnir";
|
|
};
|
|
})
|