nixpkgs/pkgs/development/libraries/matrix-sdk-crypto-nodejs/generic.nix
Alexis Hildebrandt 755b915a15 treewide: Remove indefinite article from meta.description
nix run nixpkgs#silver-searcher -- -G '\.nix$' -0l 'description.*"[Aa]n?' pkgs \
  | xargs -0 nix run nixpkgs#gnused -- -i '' -Ee 's/(description.*")[Aa]n? (.)/\1\U\2/'
2024-06-09 23:07:45 +02:00

61 lines
1.4 KiB
Nix

{ 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 = "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;
};
}