2023-02-22 10:55:15 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchYarnDeps
|
|
|
|
, makeWrapper
|
|
|
|
, matrix-sdk-crypto-nodejs
|
|
|
|
, mkYarnPackage
|
|
|
|
, rust
|
2023-05-24 13:37:59 +00:00
|
|
|
, cargo
|
2023-02-22 10:55:15 +00:00
|
|
|
, rustPlatform
|
2023-05-24 13:37:59 +00:00
|
|
|
, rustc
|
2023-02-22 10:55:15 +00:00
|
|
|
, napi-rs-cli
|
2023-07-15 17:15:38 +00:00
|
|
|
, pkg-config
|
2023-02-22 10:55:15 +00:00
|
|
|
, nodejs
|
2023-07-15 17:15:38 +00:00
|
|
|
, openssl
|
2023-02-22 10:55:15 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
data = lib.importJSON ./pin.json;
|
|
|
|
in
|
|
|
|
mkYarnPackage rec {
|
|
|
|
pname = "matrix-hookshot";
|
|
|
|
version = data.version;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "matrix-org";
|
|
|
|
repo = "matrix-hookshot";
|
|
|
|
rev = data.version;
|
2023-08-04 22:07:22 +00:00
|
|
|
hash = data.srcHash;
|
2023-02-22 10:55:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
packageJSON = ./package.json;
|
|
|
|
|
|
|
|
offlineCache = fetchYarnDeps {
|
|
|
|
yarnLock = src + "/yarn.lock";
|
|
|
|
sha256 = data.yarnHash;
|
|
|
|
};
|
|
|
|
|
|
|
|
cargoDeps = rustPlatform.fetchCargoTarball {
|
|
|
|
inherit src;
|
|
|
|
name = "${pname}-${version}";
|
2023-08-04 22:07:22 +00:00
|
|
|
hash = data.cargoHash;
|
2023-02-22 10:55:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
packageResolutions = {
|
|
|
|
"@matrix-org/matrix-sdk-crypto-nodejs" = "${matrix-sdk-crypto-nodejs}/lib/node_modules/@matrix-org/matrix-sdk-crypto-nodejs";
|
|
|
|
};
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
extraBuildInputs = [ openssl ];
|
|
|
|
|
2023-02-22 10:55:15 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
rustPlatform.cargoSetupHook
|
2023-07-15 17:15:38 +00:00
|
|
|
pkg-config
|
2023-05-24 13:37:59 +00:00
|
|
|
cargo
|
|
|
|
rustc
|
2023-02-22 10:55:15 +00:00
|
|
|
napi-rs-cli
|
|
|
|
makeWrapper
|
|
|
|
];
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
cd deps/${pname}
|
|
|
|
napi build --target ${rust.toRustTargetSpec stdenv.targetPlatform} --dts ../src/libRs.d.ts --release ./lib
|
|
|
|
yarn run build:app:fix-defs
|
|
|
|
yarn run build:app
|
|
|
|
yarn run build:web
|
|
|
|
cd ../..
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
makeWrapper '${nodejs}/bin/node' "$out/bin/matrix-hookshot" --add-flags \
|
|
|
|
"$out/libexec/matrix-hookshot/deps/matrix-hookshot/lib/App/BridgeApp.js"
|
|
|
|
'';
|
|
|
|
|
|
|
|
doDist = false;
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A bridge between Matrix and multiple project management services, such as GitHub, GitLab and JIRA";
|
|
|
|
maintainers = with maintainers; [ chvp ];
|
|
|
|
license = licenses.asl20;
|
2023-07-15 17:15:38 +00:00
|
|
|
platforms = platforms.linux;
|
2023-02-22 10:55:15 +00:00
|
|
|
};
|
|
|
|
}
|