photoqt: 4.6 -> 4.7 (#361171)
[NixPkgs.git] / pkgs / desktops / lomiri / services / lomiri-content-hub / default.nix
bloba2bb44340024736724fabf4d15ccc1326f931ab6
2   stdenv,
3   lib,
4   fetchFromGitLab,
5   gitUpdater,
6   testers,
7   cmake,
8   cmake-extras,
9   dbus-test-runner,
10   gettext,
11   glib,
12   gsettings-qt,
13   gtest,
14   libapparmor,
15   libnotify,
16   lomiri-api,
17   lomiri-app-launch,
18   lomiri-download-manager,
19   lomiri-ui-toolkit,
20   pkg-config,
21   properties-cpp,
22   qtbase,
23   qtdeclarative,
24   qtfeedback,
25   qtgraphicaleffects,
26   qttools,
27   validatePkgConfig,
28   wrapGAppsHook3,
29   xvfb-run,
32 stdenv.mkDerivation (finalAttrs: {
33   pname = "lomiri-content-hub";
34   version = "2.0.0";
36   src = fetchFromGitLab {
37     owner = "ubports";
38     repo = "development/core/lomiri-content-hub";
39     rev = finalAttrs.version;
40     hash = "sha256-eA5oCoAZB7fWyWm0Sy6wXh0EW+h76bdfJ2dotr7gUC0=";
41   };
43   outputs = [
44     "out"
45     "dev"
46     "doc"
47     "examples"
48   ];
50   postPatch = ''
51     substituteInPlace import/*/Content/CMakeLists.txt \
52       --replace-fail "\''${CMAKE_INSTALL_LIBDIR}/qt5/qml" "\''${CMAKE_INSTALL_PREFIX}/${qtbase.qtQmlPrefix}"
54     # Look for peer files in running system
55     substituteInPlace src/com/lomiri/content/service/registry-updater.cpp \
56       --replace-fail '/usr' '/run/current-system/sw'
58     # Don't override default theme search path (which honours XDG_DATA_DIRS) with a FHS assumption
59     substituteInPlace import/Lomiri/Content/contenthubplugin.cpp \
60       --replace-fail 'QIcon::setThemeSearchPaths(QStringList() << ("/usr/share/icons/"));' ""
61   '';
63   strictDeps = true;
65   nativeBuildInputs = [
66     cmake
67     gettext
68     pkg-config
69     qtdeclarative # qmlplugindump
70     qttools # qdoc
71     validatePkgConfig
72     wrapGAppsHook3
73   ];
75   buildInputs = [
76     cmake-extras
77     glib
78     gsettings-qt
79     libapparmor
80     libnotify
81     lomiri-api
82     lomiri-app-launch
83     lomiri-download-manager
84     lomiri-ui-toolkit
85     properties-cpp
86     qtbase
87     qtdeclarative
88     qtfeedback
89     qtgraphicaleffects
90   ];
92   nativeCheckInputs = [
93     dbus-test-runner
94     xvfb-run
95   ];
97   checkInputs = [ gtest ];
99   dontWrapQtApps = true;
101   cmakeFlags = [
102     (lib.cmakeBool "GSETTINGS_COMPILE" true)
103     (lib.cmakeBool "GSETTINGS_LOCALINSTALL" true)
104     (lib.cmakeBool "ENABLE_TESTS" finalAttrs.finalPackage.doCheck)
105     (lib.cmakeBool "ENABLE_DOC" true)
106     (lib.cmakeBool "ENABLE_UBUNTU_COMPAT" true) # in case something still depends on it
107   ];
109   preBuild =
110     let
111       listToQtVar =
112         list: suffix: lib.strings.concatMapStringsSep ":" (drv: "${lib.getBin drv}/${suffix}") list;
113     in
114     ''
115       # Executes qmlplugindump
116       export QT_PLUGIN_PATH=${listToQtVar [ qtbase ] qtbase.qtPluginPrefix}
117       export QML2_IMPORT_PATH=${
118         listToQtVar [
119           qtdeclarative
120           lomiri-ui-toolkit
121           qtfeedback
122           qtgraphicaleffects
123         ] qtbase.qtQmlPrefix
124       }
125     '';
127   doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
129   # Starts & talks to D-Bus services, breaks under parallelism
130   enableParallelChecking = false;
132   preFixup = ''
133     for exampleExe in content-hub-test-{importer,exporter,sharer}; do
134       moveToOutput bin/$exampleExe $examples
135       moveToOutput share/applications/$exampleExe.desktop $examples
136     done
137     moveToOutput share/icons $examples
138     moveToOutput share/lomiri-content-hub/peers $examples
139   '';
141   postFixup = ''
142     for exampleBin in $examples/bin/*; do
143       wrapGApp $exampleBin
144     done
145   '';
147   passthru = {
148     tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
149     updateScript = gitUpdater { };
150   };
152   meta = {
153     description = "Content sharing/picking service for the Lomiri desktop";
154     longDescription = ''
155       lomiri-content-hub is a mediation service to let applications share content between them,
156       even if they are not running at the same time.
157     '';
158     homepage = "https://gitlab.com/ubports/development/core/lomiri-content-hub";
159     changelog = "https://gitlab.com/ubports/development/core/lomiri-content-hub/-/blob/${finalAttrs.version}/ChangeLog";
160     license = with lib.licenses; [
161       gpl3Only
162       lgpl3Only
163     ];
164     mainProgram = "lomiri-content-hub-service";
165     maintainers = lib.teams.lomiri.members;
166     platforms = lib.platforms.linux;
167     pkgConfigModules = [
168       "liblomiri-content-hub"
169       "liblomiri-content-hub-glib"
170     ];
171   };