about summary refs log tree commit diff
path: root/nixpkgs/pkgs/desktops/lomiri
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2024-01-06 02:12:23 +0100
committerAlyssa Ross <hi@alyssa.is>2024-01-06 02:12:23 +0100
commitf34a1b70eb86e4a63cfb88ea460345bb1aed88e3 (patch)
tree32834d23912250e0c4b86aa4420baacf8091c0fe /nixpkgs/pkgs/desktops/lomiri
parent003ab91dd67b093890db1dd0bab564345db6e496 (diff)
parent7a7cfff8915e06365bc2365ff33d4d413184fa9f (diff)
downloadnixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.gz
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.bz2
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.lz
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.xz
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.tar.zst
nixlib-f34a1b70eb86e4a63cfb88ea460345bb1aed88e3.zip
Merge branch 'nixos-unstable-small' of https://github.com/NixOS/nixpkgs
Conflicts:
	nixpkgs/pkgs/build-support/go/module.nix
Diffstat (limited to 'nixpkgs/pkgs/desktops/lomiri')
-rw-r--r--nixpkgs/pkgs/desktops/lomiri/default.nix10
-rw-r--r--nixpkgs/pkgs/desktops/lomiri/development/cmake-extras/default.nix12
-rw-r--r--nixpkgs/pkgs/desktops/lomiri/development/trust-store/default.nix119
-rw-r--r--nixpkgs/pkgs/desktops/lomiri/qml/lomiri-action-api/default.nix93
-rw-r--r--nixpkgs/pkgs/desktops/lomiri/qml/lomiri-notifications/default.nix92
-rw-r--r--nixpkgs/pkgs/desktops/lomiri/qml/lomiri-ui-extras/default.nix125
-rw-r--r--nixpkgs/pkgs/desktops/lomiri/services/hfd-service/default.nix7
-rw-r--r--nixpkgs/pkgs/desktops/lomiri/services/history-service/default.nix203
-rw-r--r--nixpkgs/pkgs/desktops/lomiri/services/history-service/update_schema.sh.in34
-rw-r--r--nixpkgs/pkgs/desktops/lomiri/services/lomiri-download-manager/default.nix159
-rw-r--r--nixpkgs/pkgs/desktops/lomiri/services/lomiri-url-dispatcher/default.nix169
-rw-r--r--nixpkgs/pkgs/desktops/lomiri/services/mediascanner2/default.nix122
12 files changed, 1135 insertions, 10 deletions
diff --git a/nixpkgs/pkgs/desktops/lomiri/default.nix b/nixpkgs/pkgs/desktops/lomiri/default.nix
index a1f87820df02..70caa9d64420 100644
--- a/nixpkgs/pkgs/desktops/lomiri/default.nix
+++ b/nixpkgs/pkgs/desktops/lomiri/default.nix
@@ -18,16 +18,24 @@ let
     gmenuharness = callPackage ./development/gmenuharness { };
     libusermetrics = callPackage ./development/libusermetrics { };
     lomiri-api = callPackage ./development/lomiri-api { };
+    lomiri-app-launch = callPackage ./development/lomiri-app-launch { };
+    trust-store = callPackage ./development/trust-store { };
     u1db-qt = callPackage ./development/u1db-qt { };
 
     #### QML / QML-related
+    lomiri-action-api = callPackage ./qml/lomiri-action-api { };
+    lomiri-notifications = callPackage ./qml/lomiri-notifications { };
     lomiri-settings-components = callPackage ./qml/lomiri-settings-components { };
+    lomiri-ui-extras = callPackage ./qml/lomiri-ui-extras { };
     lomiri-ui-toolkit = callPackage ./qml/lomiri-ui-toolkit { };
 
     #### Services
     biometryd = callPackage ./services/biometryd { };
     hfd-service = callPackage ./services/hfd-service { };
-    lomiri-app-launch = callPackage ./development/lomiri-app-launch { };
+    history-service = callPackage ./services/history-service { };
+    lomiri-download-manager = callPackage ./services/lomiri-download-manager { };
+    lomiri-url-dispatcher = callPackage ./services/lomiri-url-dispatcher { };
+    mediascanner2 = callPackage ./services/mediascanner2 { };
   };
 in
   lib.makeScope libsForQt5.newScope packages
diff --git a/nixpkgs/pkgs/desktops/lomiri/development/cmake-extras/default.nix b/nixpkgs/pkgs/desktops/lomiri/development/cmake-extras/default.nix
index ee5665cd668f..fcad286f4daf 100644
--- a/nixpkgs/pkgs/desktops/lomiri/development/cmake-extras/default.nix
+++ b/nixpkgs/pkgs/desktops/lomiri/development/cmake-extras/default.nix
@@ -5,21 +5,21 @@
 , qtbase
 }:
 
-stdenvNoCC.mkDerivation {
+stdenvNoCC.mkDerivation (finalAttrs: {
   pname = "cmake-extras";
-  version = "unstable-2022-11-21";
+  version = "1.7";
 
   src = fetchFromGitLab {
     owner = "ubports";
     repo = "development/core/cmake-extras";
-    rev = "99aab4514ee182cb7a94821b4b51e4d8cb9a82ef";
-    hash = "sha256-axj5QxgDrHy0HiZkfrbm22hVvSCKkWFoQC8MdQMm9tg=";
+    rev = finalAttrs.version;
+    hash = "sha256-5bLMk21pSZkuU3jAGTnjPc9ZrvVZqMUWSfFgkTtkYLw=";
   };
 
   postPatch = ''
     # We have nothing to build here, no need to depend on a C compiler
     substituteInPlace CMakeLists.txt \
-      --replace 'project(cmake-extras)' 'project(cmake-extras NONE)'
+      --replace 'project(cmake-extras' 'project(cmake-extras LANGUAGES NONE'
 
     # This is in a function that reverse dependencies use to determine where to install their files to
     substituteInPlace src/QmlPlugins/QmlPluginsConfig.cmake \
@@ -46,4 +46,4 @@ stdenvNoCC.mkDerivation {
     maintainers = teams.lomiri.members;
     platforms = platforms.all;
   };
-}
+})
diff --git a/nixpkgs/pkgs/desktops/lomiri/development/trust-store/default.nix b/nixpkgs/pkgs/desktops/lomiri/development/trust-store/default.nix
new file mode 100644
index 000000000000..477cdd0511f8
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/lomiri/development/trust-store/default.nix
@@ -0,0 +1,119 @@
+{ stdenv
+, lib
+, fetchFromGitLab
+, testers
+, boost
+, cmake
+, cmake-extras
+, dbus
+, dbus-cpp
+, doxygen
+, gettext
+, glog
+, graphviz
+, gtest
+, libapparmor
+, newt
+, pkg-config
+, process-cpp
+, properties-cpp
+, qtbase
+, qtdeclarative
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "trust-store";
+  version = "unstable-2023-10-17";
+
+  src = fetchFromGitLab {
+    owner = "ubports";
+    repo = "development/core/trust-store";
+    rev = "7aa7ab5b7f3843e24c13ae6d9b8607455296d60e";
+    hash = "sha256-j+4FZzbG3qh1pGRapFuuMiwT4Lv9P6Ji9/3Z0uGvXmw=";
+  };
+
+  outputs = [
+    "out"
+    "dev"
+    "doc"
+    "bin"
+  ];
+
+  postPatch = ''
+    # pkg-config patching hook expects prefix variable
+    substituteInPlace data/trust-store.pc.in \
+      --replace 'includedir=''${exec_prefix}' 'includedir=''${prefix}'
+
+    substituteInPlace src/core/trust/terminal_agent.h \
+      --replace '/bin/whiptail' '${lib.getExe' newt "whiptail"}'
+  '' + lib.optionalString (!finalAttrs.doCheck) ''
+    sed -i CMakeLists.txt -e '/add_subdirectory(tests)/d'
+  '';
+
+  strictDeps = true;
+
+  nativeBuildInputs = [
+    cmake
+    doxygen
+    gettext
+    graphviz
+    pkg-config
+  ];
+
+  buildInputs = [
+    boost
+    cmake-extras
+    dbus-cpp
+    glog
+    libapparmor
+    newt
+    process-cpp
+    properties-cpp
+    qtbase
+    qtdeclarative
+  ];
+
+  nativeCheckInputs = [
+    dbus
+  ];
+
+  checkInputs = [
+    gtest
+  ];
+
+  dontWrapQtApps = true;
+
+  cmakeFlags = [
+    # Requires mirclient API, unavailable in Mir 2.x
+    # https://gitlab.com/ubports/development/core/trust-store/-/issues/2
+    "-DTRUST_STORE_MIR_AGENT_ENABLED=OFF"
+    "-DTRUST_STORE_ENABLE_DOC_GENERATION=ON"
+  ];
+
+  # Not working
+  # - remote_agent_test cases using unix domain socket fail to do *something*, with std::system_error "Invalid argument" + follow-up "No such file or directory".
+  #   potentially something broken/missing on our end
+  # - dbus_test hangs indefinitely waiting for a std::future, not provicient enough to debug this.
+  #   same hang on upstream CI
+  doCheck = false;
+
+  preCheck = ''
+    export XDG_DATA_HOME=$TMPDIR
+  '';
+
+  # Starts & talks to DBus
+  enableParallelChecking = false;
+
+  passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
+
+  meta = with lib; {
+    description = "Common implementation of a trust store to be used by trusted helpers";
+    homepage = "https://gitlab.com/ubports/development/core/trust-store";
+    license = licenses.lgpl3Only;
+    maintainers = teams.lomiri.members;
+    platforms = platforms.linux;
+    pkgConfigModules = [
+      "trust-store"
+    ];
+  };
+})
diff --git a/nixpkgs/pkgs/desktops/lomiri/qml/lomiri-action-api/default.nix b/nixpkgs/pkgs/desktops/lomiri/qml/lomiri-action-api/default.nix
new file mode 100644
index 000000000000..34a8f8740ac0
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/lomiri/qml/lomiri-action-api/default.nix
@@ -0,0 +1,93 @@
+{ stdenv
+, lib
+, fetchFromGitLab
+, fetchpatch
+, gitUpdater
+, testers
+, cmake
+, dbus
+, dbus-test-runner
+, pkg-config
+, qtbase
+, qtdeclarative
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "lomiri-action-api";
+  version = "1.1.2";
+
+  src = fetchFromGitLab {
+    owner = "ubports";
+    repo = "development/core/lomiri-action-api";
+    rev = finalAttrs.version;
+    hash = "sha256-FOHjZ5F4IkjSn/SpZEz25CbTR/gaK4D7BRxDVSDuAl8=";
+  };
+
+  outputs = [
+    "out"
+    "dev"
+  ];
+
+  patches = [
+    # Drop deprecated qt5_use_modules usage
+    # Remove when https://gitlab.com/ubports/development/core/lomiri-action-api/-/merge_requests/4 merged & in release
+    (fetchpatch {
+      url = "https://gitlab.com/OPNA2608/lomiri-action-api/-/commit/ff1d7f7eb127f6a00a99e8b278c963899d0303f0.patch";
+      hash = "sha256-nLUoRl260hMbtEPjOQJI/3w54xgFxjcxerAqNN5FU/0=";
+    })
+  ];
+
+  postPatch = ''
+    # Queries QMake for broken Qt variable: '/build/qtbase-<commit>/$(out)/$(qtQmlPrefix)'
+    substituteInPlace qml/Lomiri/Action/CMakeLists.txt \
+      --replace "\''${QT_IMPORTS_DIR}/Lomiri" '${qtbase.qtQmlPrefix}/Lomiri'
+  '';
+
+  strictDeps = true;
+
+  nativeBuildInputs = [
+    cmake
+    pkg-config
+  ];
+
+  buildInputs = [
+    qtbase
+    qtdeclarative
+  ];
+
+  nativeCheckInputs = [
+    dbus
+    dbus-test-runner
+  ];
+
+  cmakeFlags = [
+    "-DENABLE_TESTING=${lib.boolToString finalAttrs.finalPackage.doCheck}"
+    "-Duse_libhud2=OFF" # Use vendored libhud2, TODO package libhud2 separately?
+    "-DGENERATE_DOCUMENTATION=OFF" # QML docs need qdoc, https://github.com/NixOS/nixpkgs/pull/245379
+  ];
+
+  dontWrapQtApps = true;
+
+  doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
+
+  preCheck = ''
+    export QT_PLUGIN_PATH=${lib.getBin qtbase}/${qtbase.qtPluginPrefix}
+    export QML2_IMPORT_PATH=${lib.getBin qtdeclarative}/${qtbase.qtQmlPrefix}
+  '';
+
+  passthru = {
+    tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
+    updateScript = gitUpdater { };
+  };
+
+  meta = with lib; {
+    description = "Allow applications to export actions in various forms to the Lomiri Shell";
+    homepage = "https://gitlab.com/ubports/development/core/lomiri-action-api";
+    license = licenses.lgpl3Only;
+    maintainers = teams.lomiri.members;
+    platforms = platforms.linux;
+    pkgConfigModules = [
+      "lomiri-action-qt-1"
+    ];
+  };
+})
diff --git a/nixpkgs/pkgs/desktops/lomiri/qml/lomiri-notifications/default.nix b/nixpkgs/pkgs/desktops/lomiri/qml/lomiri-notifications/default.nix
new file mode 100644
index 000000000000..56b86eaa3918
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/lomiri/qml/lomiri-notifications/default.nix
@@ -0,0 +1,92 @@
+{ stdenv
+, lib
+, fetchFromGitLab
+, fetchpatch
+, gitUpdater
+, cmake
+, dbus
+, libqtdbustest
+, lomiri-api
+, pkg-config
+, qtbase
+, qtdeclarative
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "lomiri-notifications";
+  version = "1.3.0";
+
+  src = fetchFromGitLab {
+    owner = "ubports";
+    repo = "development/core/lomiri-notifications";
+    rev = finalAttrs.version;
+    hash = "sha256-EGslfTgfADrmVGhNLG7HWqcDKhu52H/r41j7fxoliko=";
+  };
+
+  patches = [
+    # Drop use of deprecated qt5_use_modules
+    # Remove when https://gitlab.com/ubports/development/core/lomiri-notifications/-/merge_requests/11 merged & in release
+    (fetchpatch {
+      url = "https://gitlab.com/OPNA2608/lomiri-notifications/-/commit/5d164d6d8d68efe1d14154eca4d0d736ce2a1265.patch";
+      hash = "sha256-nUg0zUft1n4AlotOaZgDqWbiVDvWvMizdlClavwygoI=";
+    })
+  ];
+
+  postPatch = ''
+    substituteInPlace CMakeLists.txt \
+      --replace "\''${CMAKE_INSTALL_LIBDIR}/qt5/qml" "\''${CMAKE_INSTALL_PREFIX}/${qtbase.qtQmlPrefix}"
+
+    # Need to replace prefix to not try to install into lomiri-api prefix
+    substituteInPlace src/CMakeLists.txt \
+      --replace '--variable=plugindir' '--define-variable=prefix=''${CMAKE_INSTALL_PREFIX} --variable=plugindir'
+  '' + lib.optionalString (!finalAttrs.finalPackage.doCheck) ''
+    sed -i CMakeLists.txt -e '/add_subdirectory(test)/d'
+  '';
+
+  strictDeps = true;
+
+  nativeBuildInputs = [
+    cmake
+    pkg-config
+  ];
+
+  buildInputs = [
+    lomiri-api
+    qtbase
+    qtdeclarative
+  ];
+
+  nativeCheckInputs = [
+    dbus
+  ];
+
+  checkInputs = [
+    libqtdbustest
+  ];
+
+  dontWrapQtApps = true;
+
+  cmakeFlags = [
+    # In case anything still depends on deprecated hints
+    "-DENABLE_UBUNTU_COMPAT=ON"
+  ];
+
+  doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
+
+  # Deals with DBus
+  enableParallelChecking = false;
+
+  preCheck = ''
+    export QT_PLUGIN_PATH=${lib.getBin qtbase}/${qtbase.qtPluginPrefix}
+  '';
+
+  passthru.updateScript = gitUpdater { };
+
+  meta = with lib; {
+    description = "Free Desktop Notification server QML implementation for Lomiri";
+    homepage = "https://gitlab.com/ubports/development/core/lomiri-notifications";
+    license = licenses.gpl3Only;
+    maintainers = teams.lomiri.members;
+    platforms = platforms.linux;
+  };
+})
diff --git a/nixpkgs/pkgs/desktops/lomiri/qml/lomiri-ui-extras/default.nix b/nixpkgs/pkgs/desktops/lomiri/qml/lomiri-ui-extras/default.nix
new file mode 100644
index 000000000000..06d5c1c31941
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/lomiri/qml/lomiri-ui-extras/default.nix
@@ -0,0 +1,125 @@
+{ stdenv
+, lib
+, fetchFromGitLab
+, fetchpatch
+, gitUpdater
+, cmake
+, cmake-extras
+, cups
+, exiv2
+, lomiri-ui-toolkit
+, pam
+, pkg-config
+, qtbase
+, qtdeclarative
+, xvfb-run
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "lomiri-ui-extras";
+  version = "0.6.2";
+
+  src = fetchFromGitLab {
+    owner = "ubports";
+    repo = "development/core/lomiri-ui-extras";
+    rev = finalAttrs.version;
+    hash = "sha256-RZTGTe18ebqKz8kWOpRgFJO2sR97sVbdPQMW/XLHs68=";
+  };
+
+  patches = [
+    # Fix compatibility with Exiv2 0.28.0
+    # Remove when version > 0.6.2
+    (fetchpatch {
+      name = "0001-lomiri-ui-extras-Fix-for-exiv2-0.28.0.patch";
+      url = "https://gitlab.com/ubports/development/core/lomiri-ui-extras/-/commit/f337ceefa7c4f8f39dc7c75d51df8b86f148891a.patch";
+      hash = "sha256-dm50un46eTeBZsyHJF1npGBqOAF1BopJZ1Uln1PqSOE=";
+    })
+
+    # Remove deprecated qt5_use_modules usage
+    # Remove when version > 0.6.2
+    (fetchpatch {
+      name = "0002-lomiri-ui-extras-Stop-using-qt5_use_modules.patch";
+      url = "https://gitlab.com/ubports/development/core/lomiri-ui-extras/-/commit/df506e7ebe7107dd0465d7d65727753f07abd122.patch";
+      hash = "sha256-VmOhJaUgjp9BHoYAO780uxI5tE7F0Gtp9gRNe0QCrhs=";
+    })
+
+    # Find qmltestrunner via PATH instead of hardcoded path
+    # https://gitlab.com/ubports/development/core/lomiri-ui-extras/-/merge_requests/84
+    (fetchpatch {
+      name = "0003-lomiri-ui-extras-Dont-insist-on-finding-qmltestrunner-only-at-hardcoded-guess.patch";
+      url = "https://gitlab.com/OPNA2608/lomiri-ui-extras/-/commit/b0c4901818761b516a45b7f0524ac713ddf33cfe.patch";
+      hash = "sha256-oFeaGiYEDr9XHRlCpXX+0ALlVdfb0FmGBFF1RzIXSBE=";
+    })
+  ];
+
+  postPatch = ''
+    substituteInPlace modules/Lomiri/Components/Extras{,/{plugin,PamAuthentication}}/CMakeLists.txt \
+      --replace "\''${CMAKE_INSTALL_LIBDIR}/qt5/qml" "\''${CMAKE_INSTALL_PREFIX}/${qtbase.qtQmlPrefix}"
+
+    # tst_busy_indicator runs into a codepath in lomiri-ui-toolkit that expects a working GL context
+    sed -i tests/qml/CMakeLists.txt \
+      -e '/declare_qml_test("tst_busy_indicator"/d'
+  '';
+
+  strictDeps = true;
+
+  nativeBuildInputs = [
+    cmake
+    pkg-config
+  ];
+
+  buildInputs = [
+    cmake-extras
+    cups
+    exiv2
+    pam
+    qtbase
+    qtdeclarative
+  ];
+
+  nativeCheckInputs = [
+    qtdeclarative # qmltestrunner
+    xvfb-run
+  ];
+
+  checkInputs = [
+    lomiri-ui-toolkit
+  ];
+
+  dontWrapQtApps = true;
+
+  cmakeFlags = [
+    "-DENABLE_TESTS=${lib.boolToString finalAttrs.finalPackage.doCheck}"
+  ];
+
+  # tst_PhotoEditorPhoto and tst_PhotoEditorPhotoImageProvider randomly fail, haven't had time to debug
+  doCheck = false;
+
+  # Parallelism breaks xvfb-run-launched script for QML tests
+  enableParallelChecking = false;
+
+  preCheck = let
+    listToQtVar = suffix: lib.makeSearchPathOutput "bin" suffix;
+  in ''
+    export QT_PLUGIN_PATH=${listToQtVar qtbase.qtPluginPrefix [ qtbase ]}
+    export QML2_IMPORT_PATH=${listToQtVar qtbase.qtQmlPrefix ([ qtdeclarative lomiri-ui-toolkit ] ++ lomiri-ui-toolkit.propagatedBuildInputs)}
+    export XDG_RUNTIME_DIR=$PWD
+  '';
+
+  passthru = {
+    updateScript = gitUpdater { };
+  };
+
+  meta = with lib; {
+    description = "Lomiri UI Extra Components";
+    longDescription = ''
+      A collection of UI components that for various reasons can't be included in
+      the main Lomiri UI toolkit - mostly because of the level of quality, lack of
+      documentation and/or lack of automated tests.
+    '';
+    homepage = "https://gitlab.com/ubports/development/core/lomiri-ui-extras";
+    license = licenses.gpl3Only;
+    maintainers = teams.lomiri.members;
+    platforms = platforms.linux;
+  };
+})
diff --git a/nixpkgs/pkgs/desktops/lomiri/services/hfd-service/default.nix b/nixpkgs/pkgs/desktops/lomiri/services/hfd-service/default.nix
index cffedb0af623..e9ae4a0fe2db 100644
--- a/nixpkgs/pkgs/desktops/lomiri/services/hfd-service/default.nix
+++ b/nixpkgs/pkgs/desktops/lomiri/services/hfd-service/default.nix
@@ -31,10 +31,11 @@ stdenv.mkDerivation (finalAttrs: {
 
     # Queries pkg-config via pkg_get_variable, can't override prefix
     substituteInPlace init/CMakeLists.txt \
-      --replace "\''${SYSTEMD_SYSTEM_DIR}" "$out/lib/systemd/system"
+      --replace 'pkg_get_variable(SYSTEMD_SYSTEM_DIR systemd systemdsystemunitdir)' 'set(SYSTEMD_SYSTEM_DIR ''${CMAKE_INSTALL_PREFIX}/lib/systemd/system)'
     substituteInPlace CMakeLists.txt \
-      --replace 'pkg_get_variable(AS_INTERFACES_DIR accountsservice interfacesdir)' 'set(AS_INTERFACES_DIR "''${CMAKE_INSTALL_DATADIR}/accountsservice/interfaces")' \
-      --replace 'DESTINATION ''${DBUS_INTERFACES_DIR}' 'DESTINATION ${placeholder "out"}/''${DBUS_INTERFACES_DIR}'
+      --replace 'pkg_get_variable(AS_INTERFACES_DIR accountsservice interfacesdir)' 'set(AS_INTERFACES_DIR "''${CMAKE_INSTALL_FULL_DATADIR}/accountsservice/interfaces")' \
+      --replace '../../dbus-1/interfaces' "\''${CMAKE_INSTALL_PREFIX}/\''${DBUS_INTERFACES_DIR}" \
+      --replace 'DESTINATION ''${DBUS_INTERFACES_DIR}' 'DESTINATION ''${CMAKE_INSTALL_PREFIX}/''${DBUS_INTERFACES_DIR}'
     substituteInPlace src/CMakeLists.txt \
       --replace "\''${DBUS_INTERFACES_DIR}/org.freedesktop.Accounts.xml" '${accountsservice}/share/dbus-1/interfaces/org.freedesktop.Accounts.xml'
   '';
diff --git a/nixpkgs/pkgs/desktops/lomiri/services/history-service/default.nix b/nixpkgs/pkgs/desktops/lomiri/services/history-service/default.nix
new file mode 100644
index 000000000000..de8b614ae3ea
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/lomiri/services/history-service/default.nix
@@ -0,0 +1,203 @@
+{ stdenv
+, lib
+, fetchFromGitLab
+, fetchpatch
+, gitUpdater
+, testers
+, cmake
+, dbus
+, dbus-test-runner
+, dconf
+, gnome
+, libphonenumber
+, libqtdbustest
+, pkg-config
+, protobuf
+, qtbase
+, qtdeclarative
+, qtpim
+, sqlite
+, telepathy
+, telepathy-mission-control
+, wrapQtAppsHook
+, xvfb-run
+}:
+
+let
+  replaceDbusService = pkg: name: "--replace \"\\\${DBUS_SERVICES_DIR}/${name}\" \"${pkg}/share/dbus-1/services/${name}\"";
+in
+stdenv.mkDerivation (finalAttrs: {
+  pname = "history-service";
+  version = "0.4";
+
+  src = fetchFromGitLab {
+    owner = "ubports";
+    repo = "development/core/history-service";
+    rev = finalAttrs.version;
+    hash = "sha256-oCX+moGQewzstbpddEYYp1kQdO2mVXpWJITfvzDzQDI=";
+  };
+
+  outputs = [
+    "out"
+    "dev"
+  ];
+
+  patches = [
+    # Deprecation warnings with Qt5.15, allow disabling -Werror
+    # Remove when version > 0.4
+    (fetchpatch {
+      url = "https://gitlab.com/ubports/development/core/history-service/-/commit/1370777952c6a2efb85f582ff8ba085c2c0e290a.patch";
+      hash = "sha256-Z/dFrFo7WoPZlKto6wNGeWdopsi8iBjmd5ycbqMKgxo=";
+    })
+
+    # Drop deprecated qt5_use_modules usage
+    # Remove when https://gitlab.com/ubports/development/core/history-service/-/merge_requests/36 merged & in release
+    (fetchpatch {
+      url = "https://gitlab.com/OPNA2608/history-service/-/commit/b36ab377aca93555b29d1471d6eaa706b5c843ca.patch";
+      hash = "sha256-mOpXqqd4JI7lHtcWDm9LGCrtB8ERge04jMpHIagDM2k=";
+    })
+
+    # Add more / correct existing GNUInstallDirs usage
+    # Remove when https://gitlab.com/ubports/development/core/history-service/-/merge_requests/37 merged & in release
+    (fetchpatch {
+      url = "https://gitlab.com/OPNA2608/history-service/-/commit/bb4dbdd16e80dcd286d8edfb86b08f0b61bc7fec.patch";
+      hash = "sha256-C/XaygI663yaU06klQD9g0NnbqYxHSmzdbrRxcfiJkk=";
+    })
+
+    # Correct version information
+    # Remove when https://gitlab.com/ubports/development/core/history-service/-/merge_requests/38 merged & in release
+    (fetchpatch {
+      url = "https://gitlab.com/OPNA2608/history-service/-/commit/30d9fbee203205ec1ea8fd19c9b6eb54c080a9e2.patch";
+      hash = "sha256-vSZ1ii5Yhw7pB+Pd1pjWnW7JsQxKnn+LeuBKo6qZjQs=";
+    })
+
+    # Make tests optional
+    # Remove when https://gitlab.com/ubports/development/core/history-service/-/merge_requests/39 merged & in release
+    (fetchpatch {
+      url = "https://gitlab.com/OPNA2608/history-service/-/commit/cb5c80cffc35611657244e15a7eb10edcd598ccd.patch";
+      hash = "sha256-MFHGu4OMScdThq9htUgFMpezP7Ym6YTIZUHWol20wqw=";
+    })
+  ];
+
+  postPatch = ''
+    # Upstream's way of generating their schema doesn't work for us, don't quite understand why.
+    # (gdb) bt
+    # #0  QSQLiteResult::prepare (this=0x4a4650, query=...) at qsql_sqlite.cpp:406
+    # #1  0x00007ffff344bcf4 in QSQLiteResult::reset (this=0x4a4650, query=...) at qsql_sqlite.cpp:378
+    # #2  0x00007ffff7f95f39 in QSqlQuery::exec (this=this@entry=0x7fffffffaad8, query=...) at kernel/qsqlquery.cpp:406
+    # #3  0x00000000004084cb in SQLiteDatabase::dumpSchema (this=<optimized out>) at /build/source/plugins/sqlite/sqlitedatabase.cpp:148
+    # #4  0x0000000000406d70 in main (argc=<optimized out>, argv=<optimized out>)
+    #     at /build/source/plugins/sqlite/schema/generate_schema.cpp:56
+    # (gdb) p lastError().driverText().toStdString()
+    # $17 = {_M_dataplus = {<std::allocator<char>> = {<std::__new_allocator<char>> = {<No data fields>}, <No data fields>},
+    #     _M_p = 0x4880d0 "Unable to execute statement"}, _M_string_length = 27, {
+    #     _M_local_buf = "\033\000\000\000\000\000\000\000+\344\371\367\377\177\000", _M_allocated_capacity = 27}}
+    # (gdb) p lastError().databaseText().toStdString()
+    # $18 = {_M_dataplus = {<std::allocator<char>> = {<std::__new_allocator<char>> = {<No data fields>}, <No data fields>},
+    #     _M_p = 0x48c480 "no such column: rowid"}, _M_string_length = 21, {
+    #     _M_local_buf = "\025\000\000\000\000\000\000\000A\344\371\367\377\177\000", _M_allocated_capacity = 21}}
+    #
+    # This makes the tests stall indefinitely and breaks history-service usage.
+    # This replacement script should hopefully achieve the same / a similar-enough result with just sqlite
+    cp ${./update_schema.sh.in} plugins/sqlite/schema/update_schema.sh.in
+
+    # libphonenumber -> protobuf -> abseil-cpp demands C++14
+    # But uses std::string_view which is C++17?
+    substituteInPlace CMakeLists.txt \
+      --replace '-std=c++11' '-std=c++17'
+
+    # Uses pkg_get_variable, cannot substitute prefix with that
+    substituteInPlace daemon/CMakeLists.txt \
+      --replace 'pkg_get_variable(SYSTEMD_USER_UNIT_DIR systemd systemduserunitdir)' 'set(SYSTEMD_USER_UNIT_DIR "''${CMAKE_INSTALL_PREFIX}/lib/systemd/user")'
+
+    # Queries qmake for the QML installation path, which returns a reference to Qt5's build directory
+    substituteInPlace CMakeLists.txt \
+      --replace "\''${QMAKE_EXECUTABLE} -query QT_INSTALL_QML" "echo $out/${qtbase.qtQmlPrefix}"
+  '' + lib.optionalString finalAttrs.finalPackage.doCheck ''
+    # Tests launch these DBus services, fix paths related to them
+    substituteInPlace tests/common/dbus-services/CMakeLists.txt \
+      ${replaceDbusService telepathy-mission-control "org.freedesktop.Telepathy.MissionControl5.service"} \
+      ${replaceDbusService telepathy-mission-control "org.freedesktop.Telepathy.AccountManager.service"} \
+      ${replaceDbusService dconf "ca.desrt.dconf.service"}
+
+    substituteInPlace cmake/modules/GenerateTest.cmake \
+      --replace '/usr/lib/dconf' '${lib.getLib dconf}/libexec' \
+      --replace '/usr/lib/telepathy' '${lib.getLib telepathy-mission-control}/libexec'
+  '';
+
+  strictDeps = true;
+
+  nativeBuildInputs = [
+    cmake
+    pkg-config
+    sqlite
+    wrapQtAppsHook
+  ];
+
+  buildInputs = [
+    libphonenumber
+    protobuf
+    qtbase
+    qtdeclarative
+    qtpim
+    telepathy
+  ];
+
+  nativeCheckInputs = [
+    dbus
+    dbus-test-runner
+    dconf
+    gnome.gnome-keyring
+    telepathy-mission-control
+    xvfb-run
+  ];
+
+  cmakeFlags = [
+    # Many deprecation warnings with Qt 5.15
+    (lib.cmakeBool "ENABLE_WERROR" false)
+    (lib.cmakeFeature "CMAKE_CTEST_ARGUMENTS" (lib.concatStringsSep ";" [
+      # DaemonTest is flaky
+      # https://gitlab.com/ubports/development/core/history-service/-/issues/13
+      "-E" "^DaemonTest"
+    ]))
+  ];
+
+  preBuild = ''
+    # SQLiteDatabase is used on host to generate SQL schemas
+    # Tests also need this to use SQLiteDatabase for verifying correct behaviour
+    export QT_PLUGIN_PATH=${lib.getBin qtbase}/${qtbase.qtPluginPrefix}
+  '';
+
+  doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
+
+  # Starts & talks to D-Bus services, breaks with parallelism
+  enableParallelChecking = false;
+
+  preCheck = ''
+    export QT_PLUGIN_PATH=${lib.getBin qtpim}/${qtbase.qtPluginPrefix}:$QT_PLUGIN_PATH
+    export HOME=$PWD
+  '';
+
+  passthru = {
+    tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
+    updateScript = gitUpdater { };
+  };
+
+  meta = with lib; {
+    description = "Service that provides call log and conversation history";
+    longDescription = ''
+      History service provides the database and an API to store/retrieve the call log (used by dialer-app) and the sms/mms history (used by messaging-app).
+
+      See as well telepathy-ofono for incoming message events.
+
+      Database location: ~/.local/share/history-service/history.sqlite
+    '';
+    homepage = "https://gitlab.com/ubports/development/core/history-service";
+    license = licenses.gpl3Only;
+    maintainers = teams.lomiri.members;
+    platforms = platforms.linux;
+    pkgConfigModules = [
+      "history-service"
+    ];
+  };
+})
diff --git a/nixpkgs/pkgs/desktops/lomiri/services/history-service/update_schema.sh.in b/nixpkgs/pkgs/desktops/lomiri/services/history-service/update_schema.sh.in
new file mode 100644
index 000000000000..3911c59ebe3a
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/lomiri/services/history-service/update_schema.sh.in
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+if [ $# -lt 3 ]; then
+    echo "Usage: $0 <source directory> <target file> <version info file>"
+    exit 1
+fi
+
+SOURCE_DIR=$1
+TARGET_FILE=$2
+VERSION_FILE=$3
+
+VERSION="1"
+LATEST_VERSION="1"
+MERGED_COMMANDS="merged.sql"
+
+[ -e $MERGED_COMMANDS ] && rm $MERGED_COMMANDS
+SCHEMA_FILE="$SOURCE_DIR/v${VERSION}.sql"
+while [ -e $SCHEMA_FILE ]; do
+    cat $SCHEMA_FILE >> $MERGED_COMMANDS
+    LATEST_VERSION=$VERSION
+    VERSION=$(($VERSION+1))
+    SCHEMA_FILE="$SOURCE_DIR/v${VERSION}.sql"
+done
+
+# To output the schema
+echo ".fullschema" >> $MERGED_COMMANDS
+
+# The schemas may use functions that history-service defines in C which don't affect the generated schema in a meaningful way.
+# sqlite will return an error after processing queries with such function calls, so remove them.
+sed -i -e '/normalizeId(/d' $MERGED_COMMANDS
+
+sqlite3 <$MERGED_COMMANDS >$TARGET_FILE
+
+echo $LATEST_VERSION > $VERSION_FILE
diff --git a/nixpkgs/pkgs/desktops/lomiri/services/lomiri-download-manager/default.nix b/nixpkgs/pkgs/desktops/lomiri/services/lomiri-download-manager/default.nix
new file mode 100644
index 000000000000..ea2032c7fffa
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/lomiri/services/lomiri-download-manager/default.nix
@@ -0,0 +1,159 @@
+{ stdenv
+, lib
+, fetchFromGitLab
+, fetchpatch
+, gitUpdater
+, testers
+, boost
+, cmake
+, cmake-extras
+, dbus
+, dbus-test-runner
+, withDocumentation ? true
+, doxygen
+, glog
+, graphviz
+, gtest
+, lomiri-api
+, pkg-config
+, python3
+, qtbase
+, qtdeclarative
+, wrapQtAppsHook
+, xvfb-run
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "lomiri-download-manager";
+  version = "0.1.2";
+
+  src = fetchFromGitLab {
+    owner = "ubports";
+    repo = "development/core/lomiri-download-manager";
+    rev = finalAttrs.version;
+    hash = "sha256-a9C+hactBMHMr31E+ImKDPgpzxajy1klkjDcSEkPHqI=";
+  };
+
+  outputs = [
+    "out"
+    "dev"
+  ] ++ lib.optionals withDocumentation [
+    "doc"
+  ];
+
+  patches = [
+    # Remove when version > 0.1.2
+    (fetchpatch {
+      name = "0001-lomiri-download-manager-Make-documentation-build-optional.patch";
+      url = "https://gitlab.com/ubports/development/core/lomiri-download-manager/-/commit/32d7369714c01bd425af9c6de5bdc04399a12e0a.patch";
+      hash = "sha256-UztcBAAFXDX2j0X5D3kMp9q0vFm3/PblUAKPJ5nZyiY=";
+    })
+
+    # Remove when version > 0.1.2
+    (fetchpatch {
+      name = "0002-lomiri-download-manager-Upgrade-C++-standard-to-C++17.patch";
+      url = "https://gitlab.com/ubports/development/core/lomiri-download-manager/-/commit/a6bc7ae80f2ff4c4743978c6c694149707d9d2e2.patch";
+      hash = "sha256-iA1sZhHI8Osgo1ofL5RTqgVzUG32zx0dU/28qcEqmQc=";
+    })
+
+    # Remove when version > 0.1.2
+    (fetchpatch {
+      name = "0003-lomiri-download-manager-Bump-version-make-Werror-and-tests-optional.patch";
+      url = "https://gitlab.com/ubports/development/core/lomiri-download-manager/-/commit/73ec04c429e5285f05dd72d5bb9720ba6ff31be2.patch";
+      hash = "sha256-0BrJSKCvUhITwfln05OrHgHEpldbgBoh4rivAvw+qrc=";
+    })
+
+    # Remove when version > 0.1.2
+    (fetchpatch {
+      name = "0004-lomiri-download-manager-Use-GNUInstallDirs-variables-for-more-install-destinations.patch";
+      url = "https://gitlab.com/ubports/development/core/lomiri-download-manager/-/commit/5d40daf053de62150aa5ee618285e415d7d3f1c8.patch";
+      hash = "sha256-r5fpiJkZkDsYX9fcX5JuPsE/qli9z5/DatmGJ9/QauU=";
+    })
+  ];
+
+  postPatch = ''
+    # fetchpatch strips renames
+    # Remove when version > 0.1.2
+    for service in src/{uploads,downloads}/daemon/{lomiri-*-manager,lomiri-*-manager-systemd,com.lomiri.*}.service; do
+      mv "$service" "$service".in
+    done
+
+    # pkg_get_variable doesn't let us substitute prefix pkg-config variable from systemd
+    substituteInPlace CMakeLists.txt \
+      --replace 'pkg_get_variable(SYSTEMD_USER_DIR systemd systemduserunitdir)' 'set(SYSTEMD_USER_DIR "${placeholder "out"}/lib/systemd/user")' \
+      --replace "\''${CMAKE_INSTALL_LIBDIR}/qt5/qml" "\''${CMAKE_INSTALL_PREFIX}/${qtbase.qtQmlPrefix}"
+  '';
+
+  strictDeps = true;
+
+  nativeBuildInputs = [
+    cmake
+    pkg-config
+    wrapQtAppsHook
+  ] ++ lib.optionals withDocumentation [
+    doxygen
+    graphviz
+  ];
+
+  buildInputs = [
+    boost
+    cmake-extras
+    glog
+    lomiri-api
+    qtbase
+    qtdeclarative
+  ];
+
+  nativeCheckInputs = [
+    dbus
+    dbus-test-runner
+    python3
+    xvfb-run
+  ];
+
+  checkInputs = [
+    gtest
+  ];
+
+  cmakeFlags = [
+    "-DENABLE_DOC=${lib.boolToString withDocumentation}"
+    # Deprecation warnings on Qt 5.15
+    # https://gitlab.com/ubports/development/core/lomiri-download-manager/-/issues/1
+    "-DENABLE_WERROR=OFF"
+  ];
+
+  makeTargets = [
+    "all"
+  ] ++ lib.optionals withDocumentation [
+    "doc"
+  ];
+
+  doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
+
+  # xvfb tests are flaky on xvfb shutdown when parallelised
+  enableParallelChecking = false;
+
+  preCheck = ''
+    export HOME=$TMPDIR # temp files in home
+    export QT_PLUGIN_PATH=${lib.getBin qtbase}/${qtbase.qtPluginPrefix} # xcb platform & sqlite driver
+  '';
+
+  passthru = {
+    tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
+    updateScript = gitUpdater { };
+  };
+
+  meta = with lib; {
+    description = "Performs uploads and downloads from a centralized location";
+    homepage = "https://gitlab.com/ubports/development/core/lomiri-download-manager";
+    license = licenses.lgpl3Only;
+    maintainers = teams.lomiri.members;
+    platforms = platforms.linux;
+    pkgConfigModules = [
+      "ldm-common"
+      "lomiri-download-manager-client"
+      "lomiri-download-manager-common"
+      "lomiri-upload-manager-common"
+    ];
+  };
+})
diff --git a/nixpkgs/pkgs/desktops/lomiri/services/lomiri-url-dispatcher/default.nix b/nixpkgs/pkgs/desktops/lomiri/services/lomiri-url-dispatcher/default.nix
new file mode 100644
index 000000000000..7629da2cbb84
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/lomiri/services/lomiri-url-dispatcher/default.nix
@@ -0,0 +1,169 @@
+{ stdenv
+, lib
+, fetchFromGitLab
+, fetchpatch
+, gitUpdater
+, testers
+, cmake
+, cmake-extras
+, dbus
+, dbus-test-runner
+, glib
+, gtest
+, intltool
+, json-glib
+, libapparmor
+, libxkbcommon
+, lomiri-app-launch
+, lomiri-ui-toolkit
+, makeWrapper
+, pkg-config
+, python3
+, qtbase
+, qtdeclarative
+, qtwayland
+, runtimeShell
+, sqlite
+, systemd
+, wrapQtAppsHook
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "lomiri-url-dispatcher";
+  version = "0.1.3";
+
+  src = fetchFromGitLab {
+    owner = "ubports";
+    repo = "development/core/lomiri-url-dispatcher";
+    rev = finalAttrs.version;
+    hash = "sha256-kde/HzhBHxTeyc2TCUJwpG7IfC8doDd/jNMF8KLM7KU=";
+  };
+
+  outputs = [
+    "out"
+    "dev"
+  ];
+
+  patches = [
+    # Fix case-sensitivity in tests
+    # Remove when https://gitlab.com/ubports/development/core/lomiri-url-dispatcher/-/merge_requests/8 merged & in release
+    (fetchpatch {
+      url = "https://gitlab.com/sunweaver/lomiri-url-dispatcher/-/commit/ebdd31b9640ca243e90bc7b8aca7951085998bd8.patch";
+      hash = "sha256-g4EohB3oDcWK4x62/3r/g6CFxqb7/rdK51+E/Fji1Do=";
+    })
+  ];
+
+  postPatch = ''
+    substituteInPlace data/CMakeLists.txt \
+      --replace "\''${SYSTEMD_USER_UNIT_DIR}" "\''${CMAKE_INSTALL_LIBDIR}/systemd/user"
+
+    substituteInPlace tests/url_dispatcher_testability/CMakeLists.txt \
+      --replace "\''${PYTHON_PACKAGE_DIR}" "$out/${python3.sitePackages}"
+
+    # Update URI handler database whenever new url-handler is installed system-wide
+    substituteInPlace data/lomiri-url-dispatcher-update-system-dir.*.in \
+      --replace '@CMAKE_INSTALL_FULL_DATAROOTDIR@' '/run/current-system/sw/share'
+  '' + lib.optionalString finalAttrs.finalPackage.doCheck ''
+    patchShebangs tests/test-sql.sh
+  '';
+
+  strictDeps = true;
+
+  nativeBuildInputs = [
+    cmake
+    glib # for gdbus-codegen
+    intltool
+    makeWrapper
+    pkg-config
+    (python3.withPackages (ps: with ps; [
+      setuptools
+    ] ++ lib.optionals finalAttrs.finalPackage.doCheck [
+      python-dbusmock
+    ]))
+    wrapQtAppsHook
+  ];
+
+  buildInputs = [
+    cmake-extras
+    dbus-test-runner
+    glib
+    gtest
+    json-glib
+    libapparmor
+    lomiri-app-launch
+    lomiri-ui-toolkit
+    qtdeclarative
+    sqlite
+    systemd
+    libxkbcommon
+  ];
+
+  nativeCheckInputs = [
+    dbus
+    sqlite
+  ];
+
+  cmakeFlags = [
+    "-DLOCAL_INSTALL=ON"
+    "-Denable_mirclient=OFF"
+  ];
+
+  doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
+
+  # Tests work with an sqlite db, cannot handle >1 test at the same time
+  enableParallelChecking = false;
+
+  dontWrapQtApps = true;
+
+  preFixup = ''
+    substituteInPlace $out/bin/lomiri-url-dispatcher-dump \
+      --replace '/bin/sh' '${runtimeShell}'
+
+    wrapProgram $out/bin/lomiri-url-dispatcher-dump \
+      --prefix PATH : ${lib.makeBinPath [ sqlite ]}
+
+    # Move from qmlscene call in desktop file to easier-to-wrap script
+    guiScript=$out/bin/lomiri-url-dispatcher-gui
+    guiExec=$(grep 'Exec=' $out/share/applications/lomiri-url-dispatcher-gui.desktop | cut -d'=' -f2-)
+
+    cat <<EOF >$guiScript
+    #!${runtimeShell}
+    $guiExec
+    EOF
+    chmod +x $guiScript
+
+    mkdir -p $out/share/icons/hicolor/scalable/apps
+    ln -s $out/share/lomiri-url-dispatcher/gui/lomiri-url-dispatcher-gui.svg $out/share/icons/hicolor/scalable/apps/
+
+    substituteInPlace $out/share/applications/lomiri-url-dispatcher-gui.desktop \
+      --replace "Exec=$guiExec" "Exec=$(basename $guiScript)" \
+      --replace "Icon=$out/share/lomiri-url-dispatcher/gui/lomiri-url-dispatcher-gui.svg" "Icon=lomiri-url-dispatcher-gui"
+
+    # Calls qmlscene from PATH, needs Qt plugins & QML components
+    qtWrapperArgs+=(
+      --prefix PATH : ${lib.makeBinPath [ qtdeclarative.dev ]}
+    )
+    wrapQtApp $guiScript
+  '';
+
+  passthru = {
+    tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
+    updateScript = gitUpdater { };
+  };
+
+  meta = with lib; {
+    description = "Lomiri operating environment service for requesting URLs to be opened";
+    longDescription = ''
+       Allows applications to request a URL to be opened and handled by another
+       process without seeing the list of other applications on the system or
+       starting them inside its own Application Confinement.
+    '';
+    homepage = "https://gitlab.com/ubports/development/core/lomiri-url-dispatcher";
+    license = with licenses; [ lgpl3Only gpl3Only ];
+    maintainers = teams.lomiri.members;
+    platforms = platforms.linux;
+    pkgConfigModules = [
+      "lomiri-url-dispatcher"
+    ];
+  };
+})
diff --git a/nixpkgs/pkgs/desktops/lomiri/services/mediascanner2/default.nix b/nixpkgs/pkgs/desktops/lomiri/services/mediascanner2/default.nix
new file mode 100644
index 000000000000..d9470668ce1d
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/lomiri/services/mediascanner2/default.nix
@@ -0,0 +1,122 @@
+{ stdenv
+, lib
+, fetchFromGitLab
+, gitUpdater
+, testers
+, boost
+, cmake
+, cmake-extras
+, dbus
+, dbus-cpp
+, gdk-pixbuf
+, glib
+, gst_all_1
+, gtest
+, libapparmor
+, libexif
+, pkg-config
+, properties-cpp
+, qtbase
+, qtdeclarative
+, shared-mime-info
+, sqlite
+, taglib
+, udisks
+, wrapQtAppsHook
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "mediascanner2";
+  version = "0.115";
+
+  src = fetchFromGitLab {
+    owner = "ubports";
+    repo = "development/core/mediascanner2";
+    rev = finalAttrs.version;
+    hash = "sha256-UEwFe65VB2asxQhuWGEAVow/9rEvZxry4dd2/60fXN4=";
+  };
+
+  outputs = [
+    "out"
+    "dev"
+  ];
+
+  postPatch = ''
+    substituteInPlace src/qml/MediaScanner.*/CMakeLists.txt \
+      --replace "\''${CMAKE_INSTALL_LIBDIR}/qt5/qml" "\''${CMAKE_INSTALL_PREFIX}/${qtbase.qtQmlPrefix}"
+
+    # Lomiri desktop doesn't identify itself under Canonical's name anymore
+    substituteInPlace src/daemon/scannerdaemon.cc \
+      --replace 'Unity8' 'Lomiri'
+  '';
+
+  strictDeps = true;
+
+  nativeBuildInputs = [
+    cmake
+    gst_all_1.gstreamer # GST_PLUGIN_SYSTEM_PATH_1_0 setup hook
+    pkg-config
+    wrapQtAppsHook
+  ];
+
+  buildInputs = [
+    boost
+    cmake-extras
+    dbus
+    dbus-cpp
+    gdk-pixbuf
+    glib
+    libapparmor
+    libexif
+    properties-cpp
+    qtbase
+    qtdeclarative
+    shared-mime-info
+    sqlite
+    taglib
+    udisks
+  ] ++ (with gst_all_1; [
+    gstreamer
+    gst-plugins-base
+    gst-plugins-good
+  ]);
+
+  checkInputs = [
+    gtest
+  ];
+
+  cmakeFlags = [
+    "-DENABLE_TESTS=${lib.boolToString finalAttrs.doCheck}"
+  ];
+
+  doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
+
+  preCheck = ''
+    export QT_PLUGIN_PATH=${lib.getBin qtbase}/${qtbase.qtPluginPrefix}
+    export XDG_DATA_DIRS=${shared-mime-info}/share:$XDG_DATA_DIRS
+  '';
+
+  preFixup = ''
+    qtWrapperArgs+=(
+      --prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "$GST_PLUGIN_SYSTEM_PATH_1_0"
+      --prefix XDG_DATA_DIRS : ${shared-mime-info}/share
+    )
+  '';
+
+  passthru = {
+    tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
+    updateScript = gitUpdater { };
+  };
+
+  meta = with lib; {
+    description = "Media scanner service & access library";
+    homepage = "https://gitlab.com/ubports/development/core/mediascanner2";
+    license = licenses.gpl3Only;
+    maintainers = teams.lomiri.members;
+    mainProgram = "mediascanner-service-2.0";
+    platforms = platforms.linux;
+    pkgConfigModules = [
+      "mediascanner-2.0"
+    ];
+  };
+})