Skip to content

Commit

Permalink
matrix-appservice-irc: 0.34.1 -> 0.35.0
Browse files Browse the repository at this point in the history
Fetches, injects and patchelfs the rust native crypto bindings for the
two most prominent targets.
  • Loading branch information
mweinelt committed Sep 13, 2022
1 parent cb8c505 commit 24d1560
Show file tree
Hide file tree
Showing 4 changed files with 1,327 additions and 1,598 deletions.
32 changes: 30 additions & 2 deletions pkgs/servers/matrix-synapse/matrix-appservice-irc/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ pkgs, nodePackages, makeWrapper, nixosTests, nodejs, stdenv, lib, fetchFromGitHub }:
{ pkgs, nodePackages, makeWrapper, nixosTests, nodejs, stdenv, lib, fetchFromGitHub, fetchurl, autoPatchelfHook }:

let
ourNodePackages = import ./node-composition.nix {
Expand All @@ -7,6 +7,26 @@ let
};
version = (lib.importJSON ./package.json).version;
srcInfo = lib.importJSON ./src.json;

# TODO: package matrix-rust-sdk and use that instead of fetching & patching binaries
platform = {
"x86_64-linux" = "linux-x64-gnu";
"aarch64-linux" = "linux-arm64-gnu";
}.${stdenv.hostPlatform.system} or
(throw "matrix-appservice-irc: Unsupported platform ${stdenv.hostPlatform.system}");

matrix-sdk-crypto = let
version = "0.1.0-beta.1";
base = "https://github.com/matrix-org/matrix-rust-sdk/releases/download/matrix-sdk-crypto-nodejs-v${version}";
in
fetchurl {
url = "${base}/matrix-sdk-crypto.${platform}.node";
hash = {
"x86_64-linux" = "sha256-a6FX+KhHooipIMsJ7Fl7gmUBt8WbTUgT6sXN4N3NXRk=";
"aarch64-linux" = "sha256-jvr6gMTQ4aAk5x0iXpA28ADdaCgDpvOjmogd52Z6bIY=";
}.${stdenv.hostPlatform.system} or
(throw "matrix-appservice-irc: Unsupported platform ${stdenv.hostPlatform.system}");
};
in
ourNodePackages.package.override {
pname = "matrix-appservice-irc";
Expand All @@ -19,11 +39,18 @@ ourNodePackages.package.override {
inherit (srcInfo) sha256;
};

nativeBuildInputs = [ makeWrapper nodePackages.node-gyp-build ];
nativeBuildInputs = [ autoPatchelfHook makeWrapper nodePackages.node-gyp-build ];

dontAutoPatchelf = true;

postInstall = ''
makeWrapper '${nodejs}/bin/node' "$out/bin/matrix-appservice-irc" \
--add-flags "$out/lib/node_modules/matrix-appservice-irc/app.js"
# install the native bindings for matrix-sdk-crypto
export CRYPTO_SDK_PATH="$out/lib/node_modules/matrix-appservice-irc/node_modules/@matrix-org/matrix-sdk-crypto-nodejs/matrix-sdk-crypto.${platform}.node"
cp -v ${matrix-sdk-crypto} "$CRYPTO_SDK_PATH"
autoPatchelf "$CRYPTO_SDK_PATH"
'';

passthru.tests.matrix-appservice-irc = nixosTests.matrix-appservice-irc;
Expand All @@ -34,5 +61,6 @@ ourNodePackages.package.override {
maintainers = with maintainers; [ ];
homepage = "https://github.com/matrix-org/matrix-appservice-irc";
license = licenses.asl20;
platforms = platforms.linux;
};
}
Loading

0 comments on commit 24d1560

Please sign in to comment.