2023-07-15 17:15:38 +00:00
|
|
|
{ version, hash, outputHashes, cargoLock, patches }:
|
|
|
|
|
|
|
|
{ lib, stdenv, fetchFromGitHub
|
|
|
|
, cargo, rustPlatform, rustc, napi-rs-cli, nodejs, libiconv
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "matrix-sdk-crypto-nodejs";
|
|
|
|
inherit version patches;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "matrix-org";
|
|
|
|
repo = "matrix-rust-sdk";
|
|
|
|
rev = "${pname}-v${version}";
|
|
|
|
inherit hash;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
cargoDeps = rustPlatform.importCargoLock {
|
|
|
|
lockFile = cargoLock;
|
|
|
|
inherit outputHashes;
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
rustPlatform.cargoSetupHook
|
|
|
|
cargo
|
|
|
|
rustc
|
|
|
|
napi-rs-cli
|
|
|
|
nodejs
|
|
|
|
];
|
|
|
|
|
2024-09-26 11:04:55 +00:00
|
|
|
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ];
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
|
|
|
cd bindings/${pname}
|
|
|
|
npm run release-build --offline
|
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
local -r outPath="$out/lib/node_modules/@matrix-org/${pname}"
|
|
|
|
mkdir -p "$outPath"
|
|
|
|
cp package.json index.js index.d.ts matrix-sdk-crypto.*.node "$outPath"
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "No-network-IO implementation of a state machine that handles E2EE for Matrix clients";
|
2023-07-15 17:15:38 +00:00
|
|
|
homepage = "https://github.com/matrix-org/matrix-rust-sdk/tree/${src.rev}/bindings/matrix-sdk-crypto-nodejs";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ winter ];
|
|
|
|
inherit (nodejs.meta) platforms;
|
|
|
|
};
|
|
|
|
}
|