11 matrix-sdk-crypto-nodejs,
15 pin = lib.importJSON ./pin.json;
16 nodeSources = srcOnly nodejs;
20 pname = "matrix-appservice-discord";
21 inherit (pin) version;
23 src = fetchFromGitHub {
25 repo = "matrix-appservice-discord";
30 packageJSON = ./package.json;
31 offlineCache = fetchYarnDeps {
32 yarnLock = "${src}/yarn.lock";
33 sha256 = pin.yarnSha256;
37 "@matrix-org/matrix-sdk-crypto-nodejs" = {
39 # replace with the built package
41 rm -r matrix-sdk-crypto-nodejs
42 ln -s ${matrix-sdk-crypto-nodejs}/lib/node_modules/@matrix-org/* ./
47 nativeBuildInputs = [ python3 ];
49 # build native sqlite bindings
50 npm run build-release --offline --nodedir="${nodeSources}"
51 find build -type f -exec \
52 ${removeReferencesTo}/bin/remove-references-to \
53 -t "${nodeSources}" {} \;
58 nativeBuildInputs = [ makeWrapper ];
63 # compile TypeScript sources
73 # the default 2000ms timeout is sometimes too short on our busy builders
74 yarn --offline test --timeout 10000
80 OUT_JS_DIR="$out/${passthru.nodeAppDir}/build"
83 makeWrapper '${nodejs}/bin/node' "$out/bin/${pname}" \
84 --add-flags "$OUT_JS_DIR/src/discordas.js"
86 # admin tools wrappers
87 for toolPath in $OUT_JS_DIR/tools/*; do
88 makeWrapper '${nodejs}/bin/node' \
89 "$out/bin/${pname}-$(basename $toolPath .js)" \
90 --add-flags "$toolPath"
94 # don't generate the dist tarball
98 nodeAppDir = "libexec/${pname}/deps/${pname}";
99 updateScript = ./update.sh;
103 description = "Bridge between Matrix and Discord";
104 homepage = "https://github.com/Half-Shot/matrix-appservice-discord";
105 license = lib.licenses.asl20;
106 maintainers = with lib.maintainers; [ euxane ];
107 platforms = lib.platforms.linux;
108 mainProgram = "matrix-appservice-discord";