1{
2 stdenv,
3 lib,
4 fetchFromGitLab,
5 unstableGitUpdater,
6 accounts-qt,
7 dbus-test-runner,
8 pkg-config,
9 qmake,
10 qtbase,
11 qtdeclarative,
12 qttools,
13 signond,
14 xvfb-run,
15}:
16
17stdenv.mkDerivation (finalAttrs: {
18 pname = "accounts-qml-module";
19 version = "0.7-unstable-2023-10-28";
20
21 src = fetchFromGitLab {
22 owner = "accounts-sso";
23 repo = "accounts-qml-module";
24 rev = "05e79ebbbf3784a87f72b7be571070125c10dfe3";
25 hash = "sha256-ZpnkZauowLPBnO3DDDtG/x07XoQGVNqEF8AQB5TZK84=";
26 };
27
28 outputs = [
29 "out"
30 "doc"
31 ];
32
33 postPatch = ''
34 substituteInPlace src/src.pro \
35 --replace '$$[QT_INSTALL_BINS]/qmlplugindump' 'qmlplugindump' \
36 --replace '$$[QT_INSTALL_QML]' '${placeholder "out"}/${qtbase.qtQmlPrefix}'
37
38 # Find qdoc
39 substituteInPlace doc/doc.pri \
40 --replace-fail 'QDOC = $$[QT_INSTALL_BINS]/qdoc' 'QDOC = qdoc'
41
42 # Don't install test binary
43 sed -i tests/tst_plugin.pro \
44 -e '/TARGET = tst_plugin/a INSTALLS -= target'
45 ''
46 + lib.optionalString (!finalAttrs.finalPackage.doCheck) ''
47 sed -i accounts-qml-module.pro -e '/tests/d'
48 '';
49
50 # QMake can't find Qt modules in buildInputs
51 strictDeps = false;
52
53 nativeBuildInputs = [
54 pkg-config
55 qmake
56 qtdeclarative # qmlplugindump
57 qttools # qdoc
58 ];
59
60 buildInputs = [
61 accounts-qt
62 qtbase
63 qtdeclarative
64 signond
65 ];
66
67 nativeCheckInputs = [
68 dbus-test-runner
69 xvfb-run
70 ];
71
72 dontWrapQtApps = true;
73
74 postConfigure = ''
75 make qmake_all
76 '';
77
78 doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
79
80 preCheck = ''
81 # Needs xcb platform plugin
82 export QT_PLUGIN_PATH=${lib.getBin qtbase}/${qtbase.qtPluginPrefix}
83 '';
84
85 preInstall = ''
86 # Same plugin needed here, re-export in case checks are disabled
87 export QT_PLUGIN_PATH=${lib.getBin qtbase}/${qtbase.qtPluginPrefix}
88 '';
89
90 postFixup = ''
91 moveToOutput share/accounts-qml-module/doc $doc
92 '';
93
94 passthru.updateScript = unstableGitUpdater {
95 tagPrefix = "VERSION_";
96 };
97
98 meta = {
99 description = "QML bindings for libaccounts-qt + libsignon-qt";
100 homepage = "https://gitlab.com/accounts-sso/accounts-qml-module";
101 license = lib.licenses.lgpl21Only;
102 maintainers = with lib.maintainers; [ OPNA2608 ];
103 platforms = lib.platforms.linux;
104 };
105})