1{
2 stdenv,
3 lib,
4 fetchurl,
5 doxygen,
6 extra-cmake-modules,
7 graphviz,
8 kdoctools,
9 wrapQtAppsHook,
10 autoPatchelfHook,
11
12 akonadi,
13 alkimia,
14 aqbanking,
15 gmp,
16 gwenhywfar,
17 kactivities,
18 karchive,
19 kcmutils,
20 kcontacts,
21 qtwebengine,
22 kdiagram,
23 kholidays,
24 kidentitymanagement,
25 kitemmodels,
26 libical,
27 libofx,
28 qgpgme,
29
30 sqlcipher,
31
32 # Needed for running tests:
33 xvfb-run,
34
35 python3,
36}:
37
38stdenv.mkDerivation rec {
39 pname = "kmymoney";
40 version = "5.1.3";
41
42 src = fetchurl {
43 url = "mirror://kde/stable/kmymoney/${version}/src/${pname}-${version}.tar.xz";
44 sha256 = "sha256-OTi4B4tzkboy4Su0I5di+uE0aDoMLsGnUQXDAso+Xj8=";
45 };
46
47 cmakeFlags = [
48 # Remove this when upgrading to a KMyMoney release that includes
49 # https://invent.kde.org/office/kmymoney/-/merge_requests/118
50 "-DENABLE_WEBENGINE=ON"
51 ];
52
53 # Hidden dependency that wasn't included in CMakeLists.txt:
54 env.NIX_CFLAGS_COMPILE = "-I${kitemmodels.dev}/include/KF5";
55
56 nativeBuildInputs = [
57 doxygen
58 extra-cmake-modules
59 graphviz
60 kdoctools
61 python3.pkgs.wrapPython
62 wrapQtAppsHook
63 autoPatchelfHook
64 ];
65
66 buildInputs = [
67 akonadi
68 alkimia
69 aqbanking
70 gmp
71 gwenhywfar
72 kactivities
73 karchive
74 kcmutils
75 kcontacts
76 qtwebengine
77 kdiagram
78 kholidays
79 kidentitymanagement
80 kitemmodels
81 libical
82 libofx
83 qgpgme
84 sqlcipher
85
86 # Put it into buildInputs so that CMake can find it, even though we patch
87 # it into the interface later.
88 python3.pkgs.woob
89 ];
90
91 postPatch = ''
92 buildPythonPath "${python3.pkgs.woob}"
93 patchPythonScript "kmymoney/plugins/woob/interface/kmymoneywoob.py"
94
95 # Within the embedded Python interpreter, sys.argv is unavailable, so let's
96 # assign it to a dummy value so that the assignment of sys.argv[0] injected
97 # by patchPythonScript doesn't fail:
98 sed -i -e '1i import sys; sys.argv = [""]' \
99 "kmymoney/plugins/woob/interface/kmymoneywoob.py"
100 '';
101
102 doInstallCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
103 nativeInstallCheckInputs = [ xvfb-run ];
104 installCheckPhase = lib.optionalString doInstallCheck ''
105 xvfb-run -s '-screen 0 1024x768x24' make test \
106 ARGS="-E '(reports-chart-test)'" # Test fails, so exclude it for now.
107 '';
108
109 # libpython is required by the python interpreter embedded in kmymoney, so we
110 # need to explicitly tell autoPatchelf about it.
111 postFixup = ''
112 patchelf --debug --add-needed libpython${python3.pythonVersion}.so \
113 "$out/bin/.kmymoney-wrapped"
114 '';
115
116 meta = {
117 description = "Personal finance manager for KDE";
118 mainProgram = "kmymoney";
119 homepage = "https://kmymoney.org/";
120 platforms = lib.platforms.linux;
121 license = lib.licenses.gpl2Plus;
122 maintainers = with lib.maintainers; [
123 aidalgol
124 das-g
125 ];
126 };
127}