mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-15 01:15:51 +00:00
4f0dadbf38
After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
111 lines
2.4 KiB
Nix
111 lines
2.4 KiB
Nix
{
|
|
lib,
|
|
mkYarnPackage,
|
|
fetchYarnDeps,
|
|
fetchFromGitHub,
|
|
srcOnly,
|
|
makeWrapper,
|
|
removeReferencesTo,
|
|
python3,
|
|
nodejs,
|
|
matrix-sdk-crypto-nodejs,
|
|
}:
|
|
|
|
let
|
|
pin = lib.importJSON ./pin.json;
|
|
nodeSources = srcOnly nodejs;
|
|
|
|
in
|
|
mkYarnPackage rec {
|
|
pname = "matrix-appservice-discord";
|
|
inherit (pin) version;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "matrix-org";
|
|
repo = "matrix-appservice-discord";
|
|
rev = "v${version}";
|
|
hash = pin.srcHash;
|
|
};
|
|
|
|
packageJSON = ./package.json;
|
|
offlineCache = fetchYarnDeps {
|
|
yarnLock = "${src}/yarn.lock";
|
|
sha256 = pin.yarnSha256;
|
|
};
|
|
|
|
pkgConfig = {
|
|
"@matrix-org/matrix-sdk-crypto-nodejs" = {
|
|
postInstall = ''
|
|
# replace with the built package
|
|
cd ..
|
|
rm -r matrix-sdk-crypto-nodejs
|
|
ln -s ${matrix-sdk-crypto-nodejs}/lib/node_modules/@matrix-org/* ./
|
|
'';
|
|
};
|
|
|
|
better-sqlite3 = {
|
|
nativeBuildInputs = [ python3 ];
|
|
postInstall = ''
|
|
# build native sqlite bindings
|
|
npm run build-release --offline --nodedir="${nodeSources}"
|
|
find build -type f -exec \
|
|
${removeReferencesTo}/bin/remove-references-to \
|
|
-t "${nodeSources}" {} \;
|
|
'';
|
|
};
|
|
};
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
|
|
# compile TypeScript sources
|
|
yarn --offline build
|
|
|
|
runHook postBuild
|
|
'';
|
|
|
|
doCheck = true;
|
|
checkPhase = ''
|
|
runHook preCheck
|
|
|
|
# the default 2000ms timeout is sometimes too short on our busy builders
|
|
yarn --offline test --timeout 10000
|
|
|
|
runHook postCheck
|
|
'';
|
|
|
|
postInstall = ''
|
|
OUT_JS_DIR="$out/${passthru.nodeAppDir}/build"
|
|
|
|
# server wrapper
|
|
makeWrapper '${nodejs}/bin/node' "$out/bin/${pname}" \
|
|
--add-flags "$OUT_JS_DIR/src/discordas.js"
|
|
|
|
# admin tools wrappers
|
|
for toolPath in $OUT_JS_DIR/tools/*; do
|
|
makeWrapper '${nodejs}/bin/node' \
|
|
"$out/bin/${pname}-$(basename $toolPath .js)" \
|
|
--add-flags "$toolPath"
|
|
done
|
|
'';
|
|
|
|
# don't generate the dist tarball
|
|
doDist = false;
|
|
|
|
passthru = {
|
|
nodeAppDir = "libexec/${pname}/deps/${pname}";
|
|
updateScript = ./update.sh;
|
|
};
|
|
|
|
meta = {
|
|
description = "Bridge between Matrix and Discord";
|
|
homepage = "https://github.com/Half-Shot/matrix-appservice-discord";
|
|
license = lib.licenses.asl20;
|
|
maintainers = with lib.maintainers; [ pacien ];
|
|
platforms = lib.platforms.linux;
|
|
mainProgram = "matrix-appservice-discord";
|
|
};
|
|
}
|