1{ lib
2, stdenv
3, fetchFromGitHub
4, cmake
5, openssl
6, perl
7, pkg-config
8, rustPlatform
9, sqlite
10, fixDarwinDylibNames
11, CoreFoundation
12, Security
13, libiconv
14}:
15
16stdenv.mkDerivation rec {
17 pname = "libdeltachat";
18 version = "1.65.0";
19
20 src = fetchFromGitHub {
21 owner = "deltachat";
22 repo = "deltachat-core-rust";
23 rev = version;
24 sha256 = "1k906pll4k8bc2xc9qd9g7q10rikbij2sy0w2wg9mf335rfym6z4";
25 };
26
27 patches = [
28 # https://github.com/deltachat/deltachat-core-rust/pull/2589
29 ./darwin-dylib.patch
30 ./no-static-lib.patch
31 ];
32
33 cargoDeps = rustPlatform.fetchCargoTarball {
34 inherit src;
35 name = "${pname}-${version}";
36 sha256 = "0jc9kyn5h3cn2ni5h3km47sfprpxr7hc96ca01yal2zyksm7zqxn";
37 };
38
39 nativeBuildInputs = [
40 cmake
41 perl
42 pkg-config
43 ] ++ (with rustPlatform; [
44 cargoSetupHook
45 rust.cargo
46 ]) ++ lib.optionals stdenv.isDarwin [
47 fixDarwinDylibNames
48 ];
49
50 buildInputs = [
51 openssl
52 sqlite
53 ] ++ lib.optionals stdenv.isDarwin [
54 CoreFoundation
55 Security
56 libiconv
57 ];
58
59 checkInputs = with rustPlatform; [
60 cargoCheckHook
61 ];
62
63 meta = with lib; {
64 description = "Delta Chat Rust Core library";
65 homepage = "https://github.com/deltachat/deltachat-core-rust/";
66 changelog = "https://github.com/deltachat/deltachat-core-rust/blob/${version}/CHANGELOG.md";
67 license = licenses.mpl20;
68 maintainers = with maintainers; [ dotlambda ];
69 platforms = platforms.unix;
70 };
71}