10 , matrix-sdk-crypto-nodejs
14 pin = lib.importJSON ./pin.json;
15 nodeSources = srcOnly nodejs;
17 in mkYarnPackage rec {
18 pname = "matrix-appservice-discord";
19 inherit (pin) version;
21 src = fetchFromGitHub {
23 repo = "matrix-appservice-discord";
28 packageJSON = ./package.json;
29 offlineCache = fetchYarnDeps {
30 yarnLock = "${src}/yarn.lock";
31 sha256 = pin.yarnSha256;
35 "@matrix-org/matrix-sdk-crypto-nodejs" = {
37 # replace with the built package
39 rm -r matrix-sdk-crypto-nodejs
40 ln -s ${matrix-sdk-crypto-nodejs}/lib/node_modules/@matrix-org/* ./
45 nativeBuildInputs = [ python3 ];
47 # build native sqlite bindings
48 npm run build-release --offline --nodedir="${nodeSources}"
49 find build -type f -exec \
50 ${removeReferencesTo}/bin/remove-references-to \
51 -t "${nodeSources}" {} \;
56 nativeBuildInputs = [ makeWrapper ];
61 # compile TypeScript sources
71 # the default 2000ms timeout is sometimes too short on our busy builders
72 yarn --offline test --timeout 10000
78 OUT_JS_DIR="$out/${passthru.nodeAppDir}/build"
81 makeWrapper '${nodejs}/bin/node' "$out/bin/${pname}" \
82 --add-flags "$OUT_JS_DIR/src/discordas.js"
84 # admin tools wrappers
85 for toolPath in $OUT_JS_DIR/tools/*; do
86 makeWrapper '${nodejs}/bin/node' \
87 "$out/bin/${pname}-$(basename $toolPath .js)" \
88 --add-flags "$toolPath"
92 # don't generate the dist tarball
96 nodeAppDir = "libexec/${pname}/deps/${pname}";
97 updateScript = ./update.sh;
101 description = "A bridge between Matrix and Discord";
102 homepage = "https://github.com/Half-Shot/matrix-appservice-discord";
103 license = lib.licenses.asl20;
104 maintainers = with lib.maintainers; [ pacien ];
105 platforms = lib.platforms.linux;
106 mainProgram = "matrix-appservice-discord";