1{
2 lib,
3 stdenv,
4 fetchFromGitLab,
5 fetchFromGitHub,
6 gperf,
7 gawk,
8 gitUpdater,
9 pkg-config,
10 boost,
11 luajit_openresty,
12 asciidoctor,
13 emilua,
14 liburing,
15 openssl,
16 cmake,
17 fmt,
18 zlib,
19}:
20
21let
22 td-wrap = fetchFromGitHub {
23 owner = "tdlib";
24 repo = "td";
25 rev = "4041ecb535802ba1c55fcd11adf5d3ada41c2be7";
26 hash = "sha256-/TaPYy+FUOVhyocDZ13zwR07xbzp6g8c6xvAGVFLQvk=";
27 };
28
29 trial-circular-wrap = fetchFromGitHub {
30 owner = "breese";
31 repo = "trial.protocol";
32 rev = "79149f604a49b8dfec57857ca28aaf508069b669";
33 hash = "sha256-Xd8bX3z9PZWU17N9R95HXdj6qo9at5FBL/+PTVaJgkw=";
34 };
35in
36stdenv.mkDerivation rec {
37 pname = "emilua-tdlib";
38 version = "1.0.4";
39
40 src = fetchFromGitLab {
41 owner = "emilua";
42 repo = "tdlib";
43 rev = "v${version}";
44 hash = "sha256-dqbSECQLM664l2QrkEAfT65/NBI0ghj286dt7eaxcks=";
45 fetchSubmodules = true;
46 };
47
48 buildInputs = [
49 emilua
50 liburing
51 fmt
52 luajit_openresty
53 openssl
54 boost
55 td-wrap
56 trial-circular-wrap
57 ];
58
59 nativeBuildInputs = [
60 gperf
61 gawk
62 pkg-config
63 asciidoctor
64 cmake
65 zlib
66 ];
67
68 postPatch = ''
69 substituteInPlace CMakeLists.txt \
70 --replace-warn 'pkg_get_variable(EMILUA_PLUGINSDIR emilua pluginsdir)' 'set(EMILUA_PLUGINSDIR "${"$"}{CMAKE_INSTALL_PREFIX}/${emilua.sitePackages}")'
71 '';
72
73 passthru = {
74 updateScript = gitUpdater { rev-prefix = "v"; };
75 };
76
77 meta = with lib; {
78 description = "Telegram Database Library bindings for Emilua";
79 homepage = "https://emilua.org/";
80 license = licenses.mit;
81 maintainers = with maintainers; [ manipuladordedados ];
82 platforms = platforms.linux;
83 };
84}