python312Packages.llama-index: 0.12.9 -> 0.12.9.post1 (#371957)
[NixPkgs.git] / pkgs / by-name / li / libsignal-ffi / package.nix
blob8ad229ef12ba3a39f8369d47353ae000a0ea28bf
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   rustPlatform,
6   runCommand,
7   xcodebuild,
8   protobuf,
9   boringssl,
10   darwin,
12 let
13   # boring-sys expects the static libraries in build/ instead of lib/
14   boringssl-wrapper = runCommand "boringssl-wrapper" { } ''
15     mkdir $out
16     cd $out
17     ln -s ${boringssl.out}/lib build
18     ln -s ${boringssl.dev}/include include
19   '';
21 rustPlatform.buildRustPackage rec {
22   pname = "libsignal-ffi";
23   # must match the version used in mautrix-signal
24   # see https://github.com/mautrix/signal/issues/401
25   version = "0.64.1";
27   src = fetchFromGitHub {
28     fetchSubmodules = true;
29     owner = "signalapp";
30     repo = "libsignal";
31     rev = "v${version}";
32     hash = "sha256-36z8Tgf3w0ZDLOS7hMTeVbZLiq/M/es6+sL8rEWtps4=";
33   };
35   buildInputs = lib.optional stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.Security ];
37   nativeBuildInputs = [
38     protobuf
39     rustPlatform.bindgenHook
40   ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ xcodebuild ];
42   env.BORING_BSSL_PATH = "${boringssl-wrapper}";
43   env.NIX_LDFLAGS = "-lstdc++";
45   # The Cargo.lock contains git dependencies
46   cargoLock = {
47     lockFile = ./Cargo.lock;
48     outputHashes = {
49       "boring-4.13.0" = "sha256-+0LeCN4YtHe84GzkMZog8gCTvrzVNoAYXv04jQXZaUo=";
50       "intmap-2.0.0" = "sha256-PGlkaZl+DYS4QkpJFfUf+2unVKwd9vLNF0N+/YFg8qE=";
51       "curve25519-dalek-4.1.3" = "sha256-bPh7eEgcZnq9C3wmSnnYv0C4aAP+7pnwk9Io29GrI4A=";
52     };
53   };
55   cargoBuildFlags = [
56     "-p"
57     "libsignal-ffi"
58   ];
60   meta = with lib; {
61     description = "C ABI library which exposes Signal protocol logic";
62     homepage = "https://github.com/signalapp/libsignal";
63     license = licenses.agpl3Plus;
64     maintainers = with maintainers; [ niklaskorz ];
65   };