matrix-sdk-crypto-nodejs: init at 0.1.0-beta.2

main
Winter 2 years ago
parent 597cb6ecae
commit 867d3dd394
  1. 65
      pkgs/development/libraries/matrix-sdk-crypto-nodejs/default.nix
  2. 47
      pkgs/development/libraries/matrix-sdk-crypto-nodejs/remove-duplicate-dependency.patch
  3. 2
      pkgs/top-level/all-packages.nix

@ -0,0 +1,65 @@
{ lib, stdenv, fetchFromGitHub, rustPlatform, napi-rs-cli, nodejs, libiconv }:
stdenv.mkDerivation rec {
pname = "matrix-sdk-crypto-nodejs";
version = "0.1.0-beta.2";
src = fetchFromGitHub {
owner = "matrix-org";
repo = "matrix-rust-sdk";
rev = "${pname}-v${version}";
hash = "sha256-E++0tm/2d8/3zAXwovJ71uF2sxDORWyJNnA3e1Q3NLA=";
};
patches = [
# This is needed because two versions of indexed_db_futures are present (which will fail to vendor, see https://github.com/rust-lang/cargo/issues/10310).
# (matrix-sdk-crypto-nodejs doesn't use this dependency, we only need to remove it to vendor the dependencies successfully.)
./remove-duplicate-dependency.patch
];
cargoDeps = rustPlatform.fetchCargoTarball {
inherit src patches;
name = "${pname}-${version}";
hash = "sha256-G2Um7vHinOuOx9U2BH14LAx+s/0Sxtlc9Nz6nPJfmU8=";
};
postPatch = ''
cd bindings/${pname}
'';
nativeBuildInputs = [
rustPlatform.cargoSetupHook
rustPlatform.rust.cargo
rustPlatform.rust.rustc
napi-rs-cli
nodejs
];
buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
buildPhase = ''
runHook preBuild
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; {
description = "A no-network-IO implementation of a state machine that handles E2EE for Matrix clients";
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;
};
}

@ -0,0 +1,47 @@
diff --git a/Cargo.lock b/Cargo.lock
index 2ddfdd0..3fcca5f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1985,20 +1985,6 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683"
-[[package]]
-name = "indexed_db_futures"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d26ac735f676c52305becf53264b91cea9866a8de61ccbf464405b377b9cbca9"
-dependencies = [
- "cfg-if",
- "js-sys",
- "uuid 0.8.2",
- "wasm-bindgen",
- "wasm-bindgen-futures",
- "web-sys",
-]
-
[[package]]
name = "indexed_db_futures"
version = "0.2.3"
@@ -2558,8 +2544,7 @@ dependencies = [
"derive_builder",
"futures-util",
"getrandom 0.2.7",
- "indexed_db_futures 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "indexed_db_futures 0.2.3 (git+https://github.com/Hywan/rust-indexed-db?branch=feat-factory-nodejs)",
+ "indexed_db_futures",
"js-sys",
"matrix-sdk-base",
"matrix-sdk-common",
diff --git a/crates/matrix-sdk-indexeddb/Cargo.toml b/crates/matrix-sdk-indexeddb/Cargo.toml
index 7f23dfc..c57e29a 100644
--- a/crates/matrix-sdk-indexeddb/Cargo.toml
+++ b/crates/matrix-sdk-indexeddb/Cargo.toml
@@ -30,7 +30,6 @@ js-sys = { version = "0.3.58" }
matrix-sdk-base = { version = "0.6.0", path = "../matrix-sdk-base", features = ["js"] }
matrix-sdk-crypto = { version = "0.6.0", path = "../matrix-sdk-crypto", features = ["js"], optional = true }
matrix-sdk-store-encryption = { version = "0.2.0", path = "../matrix-sdk-store-encryption" }
-indexed_db_futures = "0.2.3"
indexed_db_futures_nodejs = { package = "indexed_db_futures", git = "https://github.com/Hywan/rust-indexed-db", branch = "feat-factory-nodejs", optional = true }
ruma = "0.7.0"
serde = "1.0.136"

@ -8946,6 +8946,8 @@ with pkgs;
sasl = gsasl;
};
matrix-sdk-crypto-nodejs = callPackage ../development/libraries/matrix-sdk-crypto-nodejs { };
email = callPackage ../tools/networking/email { };
maim = callPackage ../tools/graphics/maim {};

Loading…
Cancel
Save