matrix-sdk-crypto-nodejs: reintroduce 0.1.0-beta.3

Use in matrix-appservice-slack, matrix-appservice-discord & mjolnir
This commit is contained in:
Charlotte Van Petegem 2023-05-16 21:50:34 +02:00
parent 7c8ebabaaa
commit 8329281111
No known key found for this signature in database
GPG key ID: 019E764B7184435A
7 changed files with 5710 additions and 61 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,13 @@
import ./generic.nix {
version = "0.1.0-beta.3";
hash = "sha256-0p+1cMn9PU+Jk2JW7G+sdzxhMaI3gEAk5w2nm05oBSU=";
outputHashes = {
"uniffi-0.21.0" = "sha256-blKCfCsSNtr8NtO7Let7VJ/9oGuW9Eu8j9A6/oHUcP0=";
};
cargoLock = ./Cargo-beta.3.lock;
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
];
}

View file

@ -1,61 +1,11 @@
{ lib, stdenv, fetchFromGitHub
, cargo, rustPlatform, rustc, napi-rs-cli, nodejs, libiconv
}:
stdenv.mkDerivation rec {
pname = "matrix-sdk-crypto-nodejs";
import ./generic.nix {
version = "0.1.0-beta.6";
src = fetchFromGitHub {
owner = "matrix-org";
repo = "matrix-rust-sdk";
rev = "${pname}-v${version}";
hash = "sha256-0oLk7yq/XELS0GkeZj7PxY3KKXfzws0djF3KmxYisY0=";
};
cargoDeps = rustPlatform.importCargoLock {
lockFile = ./Cargo.lock;
outputHashes = {
"ruma-0.8.2" = "sha256-bKvcElIVugj+gZZhPFPGfCqva4fo1IqW/e9gf+q/Tfw=";
"uniffi-0.23.0" = "sha256-4WUp3PQm3ZgqHNMvz9+PBtNAeiq6m4PBViwXpQDglLk=";
"vodozemac-0.3.0" = "sha256-tAimsVD8SZmlVybb7HvRffwlNsfb7gLWGCplmwbLIVE=";
};
};
nativeBuildInputs = [
rustPlatform.cargoSetupHook
cargo
rustc
napi-rs-cli
nodejs
];
buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
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; {
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;
hash = "sha256-0oLk7yq/XELS0GkeZj7PxY3KKXfzws0djF3KmxYisY0=";
outputHashes = {
"ruma-0.8.2" = "sha256-bKvcElIVugj+gZZhPFPGfCqva4fo1IqW/e9gf+q/Tfw=";
"uniffi-0.23.0" = "sha256-4WUp3PQm3ZgqHNMvz9+PBtNAeiq6m4PBViwXpQDglLk=";
"vodozemac-0.3.0" = "sha256-tAimsVD8SZmlVybb7HvRffwlNsfb7gLWGCplmwbLIVE=";
};
cargoLock = ./Cargo-beta.6.lock;
patches = [];
}

View file

@ -0,0 +1,60 @@
{ 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
];
buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
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; {
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;
};
}

View file

@ -0,0 +1,55 @@
diff --git a/Cargo.lock b/Cargo.lock
index 208ef4ff..b5045040 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2124,19 +2124,6 @@ dependencies = [
"web-sys",
]
-[[package]]
-name = "indexed_db_futures"
-version = "0.2.3"
-source = "git+https://github.com/Hywan/rust-indexed-db?branch=feat-factory-nodejs#5dab67890cea0ab88b967031adc09179a537d77c"
-dependencies = [
- "cfg-if",
- "js-sys",
- "uuid 0.8.2",
- "wasm-bindgen",
- "wasm-bindgen-futures",
- "web-sys",
-]
-
[[package]]
name = "indexmap"
version = "1.9.1"
@@ -2726,8 +2713,7 @@ dependencies = [
"derive_builder",
"getrandom 0.2.7",
"gloo-utils",
- "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 5b0ef4f4..da73979b 100644
--- a/crates/matrix-sdk-indexeddb/Cargo.toml
+++ b/crates/matrix-sdk-indexeddb/Cargo.toml
@@ -16,7 +16,7 @@ rustdoc-args = ["--cfg", "docsrs"]
[features]
default = ["e2e-encryption"]
e2e-encryption = ["matrix-sdk-base/e2e-encryption", "dep:matrix-sdk-crypto", "dashmap"]
-experimental-nodejs = ["indexed_db_futures_nodejs"]
+experimental-nodejs = []
[dependencies]
anyhow = "1.0.57"
@@ -26,7 +26,6 @@ dashmap = { version = "5.2.0", optional = true }
derive_builder = "0.11.2"
gloo-utils = { version = "0.1", features = ["serde"] }
indexed_db_futures = "0.2.3"
-indexed_db_futures_nodejs = { version = "0.2.3", package = "indexed_db_futures", git = "https://github.com/Hywan/rust-indexed-db", branch = "feat-factory-nodejs", optional = true }
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 }

View file

@ -9277,9 +9277,13 @@ with pkgs;
matrix-appservice-irc = callPackage ../servers/matrix-synapse/matrix-appservice-irc { };
matrix-appservice-slack = callPackage ../servers/matrix-synapse/matrix-appservice-slack { };
matrix-appservice-slack = callPackage ../servers/matrix-synapse/matrix-appservice-slack {
matrix-sdk-crypto-nodejs = matrix-sdk-crypto-nodejs-0_1_0-beta_3;
};
matrix-appservice-discord = callPackage ../servers/matrix-appservice-discord { };
matrix-appservice-discord = callPackage ../servers/matrix-appservice-discord {
matrix-sdk-crypto-nodejs = matrix-sdk-crypto-nodejs-0_1_0-beta_3;
};
matrix-corporal = callPackage ../servers/matrix-corporal { };
@ -9382,7 +9386,9 @@ with pkgs;
ministat = callPackage ../tools/misc/ministat { };
mjolnir = callPackage ../servers/mjolnir { };
mjolnir = callPackage ../servers/mjolnir {
matrix-sdk-crypto-nodejs = matrix-sdk-crypto-nodejs-0_1_0-beta_3;
};
mmutils = callPackage ../tools/X11/mmutils { };
@ -9912,6 +9918,7 @@ with pkgs;
};
matrix-sdk-crypto-nodejs = callPackage ../development/libraries/matrix-sdk-crypto-nodejs { };
matrix-sdk-crypto-nodejs-0_1_0-beta_3 = callPackage ../development/libraries/matrix-sdk-crypto-nodejs/beta3.nix { };
email = callPackage ../tools/networking/email { };