1{
2 mkDerivation,
3 lib,
4 fetchFromGitHub,
5 cmake,
6 extra-cmake-modules,
7 makeWrapper,
8 boost,
9 doxygen,
10 openssl,
11 libmysqlclient,
12 postgresql,
13 graphviz,
14 loki,
15 qscintilla,
16 qtbase,
17 qttools,
18}:
19
20mkDerivation {
21 pname = "tora";
22 version = "3.2.176";
23
24 src = fetchFromGitHub {
25 owner = "tora-tool";
26 repo = "tora";
27 rev = "39bf2837779bf458fc72a9f0e49271152e57829f";
28 sha256 = "0fr9b542i8r6shgnz33lc3cz333fnxgmac033yxfrdjfglzk0j2k";
29 };
30
31 nativeBuildInputs = [
32 cmake
33 extra-cmake-modules
34 makeWrapper
35 qttools
36 ];
37
38 buildInputs = [
39 boost
40 doxygen
41 graphviz
42 loki
43 libmysqlclient
44 openssl
45 postgresql # needs libecpg, which is not available in libpq package
46 qscintilla
47 qtbase
48 ];
49
50 preConfigure = ''
51 substituteInPlace src/widgets/toglobalsetting.cpp \
52 --replace 'defaultGvHome = "/usr/bin"' 'defaultGvHome = "${lib.getBin graphviz}/bin"'
53 substituteInPlace extlibs/libermodel/dotgraph.cpp \
54 --replace /usr/bin/dot ${lib.getBin graphviz}/bin/dot
55 '';
56
57 cmakeFlags = [
58 "-DWANT_INTERNAL_LOKI=0"
59 "-DWANT_INTERNAL_QSCINTILLA=0"
60 # cmake/modules/FindQScintilla.cmake looks in qtbase and for the wrong library name
61 "-DQSCINTILLA_INCLUDE_DIR=${qscintilla}/include"
62 "-DQSCINTILLA_LIBRARY=${qscintilla}/lib/libqscintilla2.so"
63 "-DENABLE_DB2=0"
64 "-DENABLE_ORACLE=0"
65 "-DENABLE_TERADATA=0"
66 "-DQT5_BUILD=1"
67 "-Wno-dev"
68 ];
69
70 # these libraries are only searched for at runtime so we need to force-link them
71 NIX_LDFLAGS = "-lgvc -lmysqlclient -lecpg -lssl -L${libmysqlclient}/lib/mariadb";
72
73 qtWrapperArgs = [
74 ''--prefix PATH : ${lib.getBin graphviz}/bin''
75 ];
76
77 meta = with lib; {
78 description = "Tora SQL tool";
79 mainProgram = "tora";
80 maintainers = with maintainers; [ peterhoeg ];
81 platforms = platforms.linux;
82 license = licenses.asl20;
83 };
84}