blob: f2a8341a20971f17db08d9e87bdfab59a99d51a8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
{
lib,
stdenv,
fetchFromGitHub,
rustPlatform,
runCommand,
xcodebuild,
protobuf,
boringssl,
darwin,
}:
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.55.1";
src = fetchFromGitHub {
fetchSubmodules = true;
owner = "signalapp";
repo = "libsignal";
rev = "v${version}";
hash = "sha256-hQ3iWGLef1y3yyzjWH2MWcs32A7HxUSxGG8fCyMn/KE=";
};
buildInputs = lib.optional stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ];
nativeBuildInputs = [
protobuf
rustPlatform.bindgenHook
] ++ lib.optionals stdenv.isDarwin [ xcodebuild ];
env.BORING_BSSL_PATH = "${boringssl-wrapper}";
# The Cargo.lock contains git dependencies
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"boring-4.9.0" = "sha256-RSpaMzMUXp+WuqqDwLErP5yLT0YhYGoOUWCuSt4jR3I=";
"curve25519-dalek-4.1.3" = "sha256-bPh7eEgcZnq9C3wmSnnYv0C4aAP+7pnwk9Io29GrI4A=";
};
};
cargoBuildFlags = [
"-p"
"libsignal-ffi"
];
meta = with lib; {
description = "C ABI library which exposes Signal protocol logic";
homepage = "https://github.com/signalapp/libsignal";
license = licenses.agpl3Plus;
maintainers = with maintainers; [ niklaskorz ];
};
}
|