Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mautrix-signal: fix build with goolm, enable checks & version test #353730

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 27 additions & 6 deletions pkgs/servers/mautrix-signal/default.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
lib,
stdenv,
buildGoModule,
fetchFromGitHub,
fetchpatch,
olm,
libsignal-ffi,
versionCheckHook,
# 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
Expand Down Expand Up @@ -32,16 +34,35 @@ buildGoModule rec {
})
];

buildInputs = (lib.optional (!withGoolm) 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
];
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
];

tags = lib.optional withGoolm "goolm";

CGO_LDFLAGS = lib.optional withGoolm [ "-lstdc++" ];

vendorHash = "sha256-bKQKO5RqgMrWq7NyNF1rj2CLp5SeBP80HWxF8MWnZ1U=";

doCheck = false;
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++"
'');

doInstallCheck = true;
nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgramArg = [ "--version" ];

meta = with lib; {
homepage = "https://github.com/mautrix/signal";
Expand Down