nixpkgs/pkgs/servers/matrix-synapse/matrix-appservice-slack/default.nix
2023-03-07 20:02:00 +01:00

54 lines
1.2 KiB
Nix

{ lib
, fetchFromGitHub
, fetchYarnDeps
, makeWrapper
, matrix-sdk-crypto-nodejs
, mkYarnPackage
, nodejs
}:
let
data = lib.importJSON ./pin.json;
in
mkYarnPackage rec {
pname = "matrix-appservice-slack";
version = data.version;
packageJSON = ./package.json;
src = fetchFromGitHub {
owner = "matrix-org";
repo = "matrix-appservice-slack";
rev = data.version;
sha256 = data.srcHash;
};
offlineCache = fetchYarnDeps {
yarnLock = src + "/yarn.lock";
sha256 = data.yarnHash;
};
packageResolutions = {
"@matrix-org/matrix-sdk-crypto-nodejs" = "${matrix-sdk-crypto-nodejs}/lib/node_modules/@matrix-org/matrix-sdk-crypto-nodejs";
};
nativeBuildInputs = [ makeWrapper ];
buildPhase = ''
runHook preBuild
yarn run build
runHook postBuild
'';
postInstall = ''
makeWrapper '${nodejs}/bin/node' "$out/bin/matrix-appservice-slack" --add-flags \
"$out/libexec/matrix-appservice-slack/deps/matrix-appservice-slack/lib/app.js"
'';
doDist = false;
meta = with lib; {
description = "A Matrix <--> Slack bridge";
maintainers = with maintainers; [ beardhatcode chvp ];
license = licenses.asl20;
};
}