2024-09-19 14:19:46 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
fetchFromGitHub,
|
|
|
|
rustPlatform,
|
|
|
|
runCommand,
|
|
|
|
xcodebuild,
|
|
|
|
protobuf,
|
|
|
|
boringssl,
|
|
|
|
darwin,
|
|
|
|
}:
|
2024-01-02 11:29:13 +00:00
|
|
|
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
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "0.55.1";
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2024-09-19 14:19:46 +00:00
|
|
|
fetchSubmodules = true;
|
2024-01-02 11:29:13 +00:00
|
|
|
owner = "signalapp";
|
|
|
|
repo = "libsignal";
|
|
|
|
rev = "v${version}";
|
2024-09-19 14:19:46 +00:00
|
|
|
hash = "sha256-hQ3iWGLef1y3yyzjWH2MWcs32A7HxUSxGG8fCyMn/KE=";
|
2024-01-02 11:29:13 +00:00
|
|
|
};
|
|
|
|
|
2024-09-26 11:04:55 +00:00
|
|
|
buildInputs = lib.optional stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.Security ];
|
2024-09-19 14:19:46 +00:00
|
|
|
|
2024-06-24 18:47:55 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
protobuf
|
|
|
|
rustPlatform.bindgenHook
|
2024-09-26 11:04:55 +00:00
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isDarwin [ xcodebuild ];
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
env.BORING_BSSL_PATH = "${boringssl-wrapper}";
|
|
|
|
|
|
|
|
# The Cargo.lock contains git dependencies
|
|
|
|
cargoLock = {
|
|
|
|
lockFile = ./Cargo.lock;
|
|
|
|
outputHashes = {
|
2024-09-19 14:19:46 +00:00
|
|
|
"boring-4.9.0" = "sha256-RSpaMzMUXp+WuqqDwLErP5yLT0YhYGoOUWCuSt4jR3I=";
|
2024-07-27 06:49:29 +00:00
|
|
|
"curve25519-dalek-4.1.3" = "sha256-bPh7eEgcZnq9C3wmSnnYv0C4aAP+7pnwk9Io29GrI4A=";
|
2024-01-02 11:29:13 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
cargoBuildFlags = [
|
|
|
|
"-p"
|
|
|
|
"libsignal-ffi"
|
|
|
|
];
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "C ABI library which exposes Signal protocol logic";
|
2024-01-02 11:29:13 +00:00
|
|
|
homepage = "https://github.com/signalapp/libsignal";
|
|
|
|
license = licenses.agpl3Plus;
|
|
|
|
maintainers = with maintainers; [ niklaskorz ];
|
|
|
|
};
|
|
|
|
}
|