lol

mjolnir: refactor, 1.9.1 -> 1.9.2, fix building

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