2024-08-28 00:15:47 +00:00
|
|
|
{
|
|
|
|
lib,
|
2024-11-04 16:26:36 +00:00
|
|
|
stdenv,
|
2024-08-28 00:15:47 +00:00
|
|
|
buildGoModule,
|
|
|
|
fetchFromGitHub,
|
|
|
|
olm,
|
|
|
|
libsignal-ffi,
|
2024-11-05 12:37:07 +00:00
|
|
|
versionCheckHook,
|
2024-08-28 00:15:47 +00:00
|
|
|
# This option enables the use of an experimental pure-Go implementation of
|
|
|
|
# the Olm protocol instead of libolm for end-to-end encryption. Using goolm
|
|
|
|
# is not recommended by the mautrix developers, but they are interested in
|
|
|
|
# people trying it out in non-production-critical environments and reporting
|
|
|
|
# any issues they run into.
|
|
|
|
withGoolm ? false,
|
|
|
|
}:
|
2021-04-13 03:37:17 +00:00
|
|
|
|
2024-02-18 18:58:39 +00:00
|
|
|
buildGoModule rec {
|
2021-04-13 03:37:17 +00:00
|
|
|
pname = "mautrix-signal";
|
2024-11-24 18:44:49 +00:00
|
|
|
version = "0.7.3";
|
2021-04-13 03:37:17 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2021-11-17 12:23:31 +00:00
|
|
|
owner = "mautrix";
|
|
|
|
repo = "signal";
|
2024-02-18 18:58:39 +00:00
|
|
|
rev = "v${version}";
|
2024-11-24 18:44:49 +00:00
|
|
|
hash = "sha256-VU0VZkh1sjOuSI+/JXZKWQF5pZ3NebBFbDdsOgaocg4=";
|
2021-04-13 03:37:17 +00:00
|
|
|
};
|
|
|
|
|
2024-11-04 16:26:36 +00:00
|
|
|
buildInputs =
|
|
|
|
(lib.optional (!withGoolm) olm)
|
|
|
|
++ (lib.optional withGoolm stdenv.cc.cc.lib)
|
|
|
|
++ [
|
|
|
|
# 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
|
|
|
|
];
|
|
|
|
|
2024-08-28 00:15:47 +00:00
|
|
|
tags = lib.optional withGoolm "goolm";
|
2023-01-31 05:52:58 +00:00
|
|
|
|
2024-11-04 16:26:36 +00:00
|
|
|
CGO_LDFLAGS = lib.optional withGoolm [ "-lstdc++" ];
|
|
|
|
|
2024-11-24 18:44:49 +00:00
|
|
|
vendorHash = "sha256-fERAigormEy6+240AOkMyrjMDj5/eU0Lo4wD0AuAn+4=";
|
2021-04-13 03:37:17 +00:00
|
|
|
|
2024-11-04 23:24:44 +00:00
|
|
|
doCheck = true;
|
|
|
|
preCheck =
|
|
|
|
''
|
|
|
|
# Needed by the tests to be able to find libstdc++
|
|
|
|
export LD_LIBRARY_PATH="${stdenv.cc.cc.lib}/lib:$LD_LIBRARY_PATH"
|
|
|
|
''
|
|
|
|
+ (lib.optionalString (!withGoolm) ''
|
|
|
|
# When using libolm, the tests need explicit linking to libstdc++
|
|
|
|
export CGO_LDFLAGS="-lstdc++"
|
|
|
|
'');
|
|
|
|
|
|
|
|
postCheck = ''
|
|
|
|
unset LD_LIBRARY_PATH
|
|
|
|
'';
|
2021-04-13 03:37:17 +00:00
|
|
|
|
2024-11-05 12:37:07 +00:00
|
|
|
doInstallCheck = true;
|
|
|
|
nativeInstallCheckInputs = [ versionCheckHook ];
|
|
|
|
versionCheckProgramArg = [ "--version" ];
|
|
|
|
|
2021-04-13 03:37:17 +00:00
|
|
|
meta = with lib; {
|
2021-11-17 12:23:31 +00:00
|
|
|
homepage = "https://github.com/mautrix/signal";
|
2021-04-13 03:37:17 +00:00
|
|
|
description = "Matrix-Signal puppeting bridge";
|
|
|
|
license = licenses.agpl3Plus;
|
2024-09-02 18:38:04 +00:00
|
|
|
maintainers = with maintainers; [
|
|
|
|
niklaskorz
|
|
|
|
ma27
|
|
|
|
];
|
2023-11-27 01:17:53 +00:00
|
|
|
mainProgram = "mautrix-signal";
|
2021-04-13 03:37:17 +00:00
|
|
|
};
|
|
|
|
}
|