tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
mjolnir: refactor, 1.9.1 -> 1.9.2, fix building
Tristan Ross
10 months ago
d69e8bbf
98195dde
+26
-104
2 changed files
expand all
collapse all
unified
split
pkgs
by-name
mj
mjolnir
package.json
package.nix
-75
pkgs/by-name/mj/mjolnir/package.json
···
1
1
-
{
2
2
-
"name": "mjolnir",
3
3
-
"version": "1.9.1",
4
4
-
"description": "A moderation tool for Matrix",
5
5
-
"main": "lib/index.js",
6
6
-
"repository": "git@github.com:matrix-org/mjolnir.git",
7
7
-
"author": "The Matrix.org Foundation C.I.C.",
8
8
-
"license": "Apache-2.0",
9
9
-
"private": true,
10
10
-
"scripts": {
11
11
-
"build": "tsc",
12
12
-
"postbuild": "rm -rf lib/test/ && cp -r lib/src/* lib/ && rm -rf lib/src/",
13
13
-
"lint": "tslint --project ./tsconfig.json -t stylish && npx prettier . --check",
14
14
-
"start:dev": "yarn build && node --async-stack-traces lib/index.js",
15
15
-
"test": "ts-mocha --project ./tsconfig.json test/commands/**/*.ts",
16
16
-
"test:integration": "NODE_ENV=harness ts-mocha --async-stack-traces --require test/integration/fixtures.ts --timeout 300000 --project ./tsconfig.json \"test/integration/**/*Test.ts\"",
17
17
-
"test:integration:single": "NODE_ENV=harness npx ts-mocha --require test/integration/fixtures.ts --timeout 300000 --project ./tsconfig.json",
18
18
-
"test:appservice:integration": "NODE_ENV=harness ts-mocha --async-stack-traces --timeout 300000 --project ./tsconfig.json \"test/appservice/integration/**/*Test.ts\"",
19
19
-
"test:appservice:integration:single": "NODE_ENV=harness npx ts-mocha --timeout 300000 --project ./tsconfig.json",
20
20
-
"test:manual": "NODE_ENV=harness ts-node test/integration/manualLaunchScript.ts",
21
21
-
"version": "sed -i '/# version automated/s/[0-9][0-9]*\\.[0-9][0-9]*\\.[0-9][0-9]*/'$npm_package_version'/' synapse_antispam/setup.py && git add synapse_antispam/setup.py && cat synapse_antispam/setup.py"
22
22
-
},
23
23
-
"devDependencies": {
24
24
-
"@types/config": "^3.3.0",
25
25
-
"@types/crypto-js": "^4.0.2",
26
26
-
"@types/express": "^4.17.13",
27
27
-
"@types/html-to-text": "^8.0.1",
28
28
-
"@types/humanize-duration": "^3.27.1",
29
29
-
"@types/js-yaml": "^4.0.5",
30
30
-
"@types/jsdom": "^16.2.11",
31
31
-
"@types/mocha": "^9.0.0",
32
32
-
"@types/nedb": "^1.8.12",
33
33
-
"@types/node": "^18.0.0",
34
34
-
"@types/pg": "^8.6.5",
35
35
-
"@types/request": "^2.48.8",
36
36
-
"@types/shell-quote": "1.7.1",
37
37
-
"crypto-js": "^4.2.0",
38
38
-
"eslint": "^7.32",
39
39
-
"expect": "^27.0.6",
40
40
-
"mocha": "^9.0.1",
41
41
-
"ts-mocha": "^9.0.2",
42
42
-
"tslint": "^6.1.3",
43
43
-
"typescript": "^4.8.4",
44
44
-
"typescript-formatter": "^7.2"
45
45
-
},
46
46
-
"dependencies": {
47
47
-
"@sentry/node": "^7.17.2",
48
48
-
"@sentry/tracing": "^7.17.2",
49
49
-
"@tensorflow/tfjs-node": "^4.21.0",
50
50
-
"@vector-im/matrix-bot-sdk": "^0.7.1-element.6",
51
51
-
"await-lock": "^2.2.2",
52
52
-
"axios": "^1.7.6",
53
53
-
"body-parser": "^1.20.1",
54
54
-
"config": "^3.3.8",
55
55
-
"express": "^4.20",
56
56
-
"html-to-text": "^8.0.0",
57
57
-
"humanize-duration": "^3.27.1",
58
58
-
"humanize-duration-ts": "^2.1.1",
59
59
-
"js-yaml": "^4.1.0",
60
60
-
"jsdom": "^16.6.0",
61
61
-
"lru-cache": "^11.0.1",
62
62
-
"matrix-appservice-bridge": "10.3.1",
63
63
-
"nsfwjs": "^4.1.0",
64
64
-
"parse-duration": "^1.0.2",
65
65
-
"pg": "^8.8.0",
66
66
-
"prom-client": "^14.1.0",
67
67
-
"shell-quote": "^1.7.3",
68
68
-
"ulidx": "^0.3.0",
69
69
-
"yaml": "^2.2.2"
70
70
-
},
71
71
-
"engines": {
72
72
-
"node": ">=20.0.0"
73
73
-
},
74
74
-
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
75
75
-
}
+26
-29
pkgs/by-name/mj/mjolnir/package.nix
···
1
1
{
2
2
lib,
3
3
-
mkYarnPackage,
3
3
+
stdenv,
4
4
+
yarnConfigHook,
5
5
+
yarnBuildHook,
6
6
+
yarnInstallHook,
7
7
+
nodejs,
4
8
fetchFromGitHub,
5
9
fetchYarnDeps,
6
10
matrix-sdk-crypto-nodejs,
7
11
makeWrapper,
8
8
-
nodejs,
9
12
nixosTests,
10
13
}:
11
14
12
12
-
mkYarnPackage rec {
15
15
+
stdenv.mkDerivation (finalAttrs: {
13
16
pname = "mjolnir";
14
14
-
version = "1.9.1";
17
17
+
version = "1.9.2";
15
18
16
19
src = fetchFromGitHub {
17
20
owner = "matrix-org";
18
21
repo = "mjolnir";
19
19
-
tag = "v${version}";
20
20
-
hash = "sha256-LK2CgMLDJHfr1+ejHYeJNw2ekCnUA8GHufZ6vbifzGQ=";
22
22
+
tag = "v${finalAttrs.version}";
23
23
+
hash = "sha256-OxHnCMP6IP0EaAs4YQgmV04tq6IdAYmKQX8O9Q48CPk=";
21
24
};
22
25
23
26
patches = [
···
25
28
./001-disable-nsfwprotection.patch
26
29
];
27
30
28
28
-
packageJSON = ./package.json;
29
29
-
30
31
offlineCache = fetchYarnDeps {
31
31
-
yarnLock = src + "/yarn.lock";
32
32
+
yarnLock = "${finalAttrs.src}/yarn.lock";
32
33
hash = "sha256-1V7ooONt9j+4hk/3w6Dsv/SdWwa1xsLk97EwhuPegNo=";
33
34
};
34
35
35
35
-
packageResolutions = {
36
36
-
"@matrix-org/matrix-sdk-crypto-nodejs" =
37
37
-
"${matrix-sdk-crypto-nodejs}/lib/node_modules/@matrix-org/matrix-sdk-crypto-nodejs";
38
38
-
};
36
36
+
nativeBuildInputs = [
37
37
+
yarnConfigHook
38
38
+
yarnBuildHook
39
39
+
yarnInstallHook
40
40
+
nodejs
41
41
+
makeWrapper
42
42
+
];
39
43
40
40
-
nativeBuildInputs = [ makeWrapper ];
41
41
-
42
42
-
buildPhase = ''
43
43
-
runHook preBuild
44
44
+
postInstall = ''
45
45
+
cp -r lib/* $out/lib/node_modules/mjolnir/lib/
44
46
45
45
-
pushd deps/${pname}
46
46
-
yarn run build
47
47
-
popd
47
47
+
rm -rf $out/lib/node_modules/mjolnir/node_modules/@matrix-org/matrix-sdk-crypto-nodejs
48
48
+
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
48
49
49
49
-
runHook postBuild
50
50
-
'';
51
51
-
52
52
-
postInstall = ''
53
50
makeWrapper ${nodejs}/bin/node "$out/bin/mjolnir" \
54
54
-
--add-flags "$out/libexec/mjolnir/deps/mjolnir/lib/index.js"
51
51
+
--add-flags "$out/lib/node_modules/mjolnir/lib/index.js"
55
52
'';
56
53
57
54
passthru = {
···
60
57
};
61
58
};
62
59
63
63
-
meta = with lib; {
60
60
+
meta = {
64
61
description = "Moderation tool for Matrix";
65
62
homepage = "https://github.com/matrix-org/mjolnir";
66
63
longDescription = ''
···
77
74
A Synapse module is also available to apply the same rulesets the bot
78
75
uses across an entire homeserver.
79
76
'';
80
80
-
license = licenses.asl20;
81
81
-
maintainers = with maintainers; [ jojosch ];
77
77
+
license = lib.licenses.asl20;
78
78
+
maintainers = with lib.maintainers; [ jojosch ];
82
79
mainProgram = "mjolnir";
83
80
};
84
84
-
}
81
81
+
})