Merge pull request #277367 from niklaskorz/mautrix-signal-go

mautrix-signal: 0.4.3 -> unstable-2023-12-30
This commit is contained in:
Maximilian Bosch 2023-12-31 16:46:52 +01:00 committed by GitHub
commit a7e43d89e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 3898 additions and 52 deletions

View file

@ -13246,6 +13246,13 @@
githubId = 6391776;
name = "Nikita Voloboev";
};
niklaskorz = {
name = "Niklas Korz";
email = "niklas@niklaskorz.de";
matrix = "@niklaskorz:korz.dev";
github = "niklaskorz";
githubId = 590517;
};
NikolaMandic = {
email = "nikola@mandic.email";
github = "NikolaMandic";

3829
pkgs/by-name/li/libsignal-ffi/Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,46 @@
{ lib, stdenv, fetchFromGitHub, rustPlatform, runCommand, xcodebuild, protobuf, boringssl }:
let
# boring-sys expects the static libraries in build/ instead of lib/
boringssl-wrapper = runCommand "boringssl-wrapper" { } ''
mkdir $out
cd $out
ln -s ${boringssl.out}/lib build
ln -s ${boringssl.dev}/include include
'';
in
rustPlatform.buildRustPackage rec {
pname = "libsignal-ffi";
# must match the version used in mautrix-signal
# see https://github.com/mautrix/signal/issues/401
version = "0.36.1";
src = fetchFromGitHub {
owner = "signalapp";
repo = "libsignal";
rev = "v${version}";
hash = "sha256-UD4E2kI1ZNtFhwBGphTzF37NHqbSZjQGHbliOWAMYOE=";
};
nativeBuildInputs = [ protobuf ] ++ lib.optionals stdenv.isDarwin [ xcodebuild ];
buildInputs = [ rustPlatform.bindgenHook ];
env.BORING_BSSL_PATH = "${boringssl-wrapper}";
# The Cargo.lock contains git dependencies
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"boring-3.1.0" = "sha256-R6hh4K57mgV10nuVcMZETvxlQsMsmGapgCQ7pjuognk=";
"curve25519-dalek-4.1.1" = "sha256-p9Vx0lAaYILypsI4/RVsHZLOqZKaa4Wvf7DanLA38pc=";
};
};
cargoBuildFlags = [ "-p" "libsignal-ffi" ];
meta = with lib; {
description = "A C ABI library which exposes Signal protocol logic";
homepage = "https://github.com/signalapp/libsignal";
license = licenses.agpl3Plus;
maintainers = with maintainers; [ niklaskorz ];
};
}

View file

@ -1,72 +1,36 @@
{ lib, python3, fetchFromGitHub }:
{ lib, buildGoModule, fetchFromGitHub, olm, libsignal-ffi }:
python3.pkgs.buildPythonPackage rec {
buildGoModule {
pname = "mautrix-signal";
version = "0.4.3";
# mautrix-signal's latest released version v0.4.3 still uses the Python codebase
# which is broken for new devices, see https://github.com/mautrix/signal/issues/388.
# The new Go version fixes this by using the official libsignal as a library and
# can be upgraded to directly from the Python version.
version = "unstable-2023-12-30";
src = fetchFromGitHub {
owner = "mautrix";
repo = "signal";
rev = "refs/tags/v${version}";
sha256 = "sha256-QShyuwHiWRcP1hGkvCQfixvoUQ/FXr2DYC5VrcMKX48=";
rev = "6abe80e6c79b31b5dc37a484b65d346a1ffd4f05";
hash = "sha256-EDSP+kU0EmIaYbAB/hxAUTEay+H5aqn9ovBQFZg6wJk=";
};
postPatch = ''
# the version mangling in mautrix_signal/get_version.py interacts badly with pythonRelaxDepsHook
substituteInPlace setup.py \
--replace 'version=version' 'version="${version}"'
'';
nativeBuildInputs = with python3.pkgs; [
pythonRelaxDepsHook
buildInputs = [
olm
# must match the version used in https://github.com/mautrix/signal/tree/main/pkg/libsignalgo
# see https://github.com/mautrix/signal/issues/401
libsignal-ffi
];
pythonRelaxDeps = [
"mautrix"
];
propagatedBuildInputs = with python3.pkgs; [
commonmark
aiohttp
aiosqlite
asyncpg
attrs
commonmark
mautrix
phonenumbers
pillow
prometheus-client
pycryptodome
python-olm
python-magic
qrcode
ruamel-yaml
unpaddedbase64
yarl
];
vendorHash = "sha256-f3sWX+mBouuxVKu+fZIYTWLXT64fllUWpcUYAxjzQpI=";
doCheck = false;
postInstall = ''
mkdir -p $out/bin
# Make a little wrapper for running mautrix-signal with its dependencies
echo "$mautrixSignalScript" > $out/bin/mautrix-signal
echo "#!/bin/sh
exec python -m mautrix_signal \"\$@\"
" > $out/bin/mautrix-signal
chmod +x $out/bin/mautrix-signal
wrapProgram $out/bin/mautrix-signal \
--prefix PATH : "${python3}/bin" \
--prefix PYTHONPATH : "$PYTHONPATH"
'';
meta = with lib; {
homepage = "https://github.com/mautrix/signal";
description = "A Matrix-Signal puppeting bridge";
license = licenses.agpl3Plus;
platforms = platforms.linux;
maintainers = with maintainers; [ expipiplus1 ];
maintainers = with maintainers; [ expipiplus1 niklaskorz ma27 ];
mainProgram = "mautrix-signal";
};
}