Merge pull request #264844 from OPNA2608/init/lomiri/telephony-service

lomiri.telephony-service: init at 0.5.2
This commit is contained in:
Peder Bergebakken Sundt 2024-01-22 23:23:52 +01:00 committed by GitHub
commit 0d308a02a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 248 additions and 0 deletions

View file

@ -31,6 +31,7 @@ in {
ayatana-indicator-messages
] ++ (with pkgs.lomiri; [
lomiri-indicator-network
telephony-service
]);
};
@ -43,6 +44,25 @@ in {
networking.networkmanager.enable = true; # lomiri-network-indicator
# TODO potentially urfkill for lomiri-network-indicator?
services.dbus.packages = with pkgs.lomiri; [
libusermetrics
];
environment.systemPackages = with pkgs.lomiri; [
lomiri-schemas
];
services.telepathy.enable = true;
users.users.usermetrics = {
group = "usermetrics";
home = "/var/lib/usermetrics";
createHome = true;
isSystemUser = true;
};
users.groups.usermetrics = { };
};
# TODO session indicator starts up in a semi-broken state, but works fine after a restart. maybe being started before graphical session is truly up & ready?

View file

@ -45,6 +45,7 @@ let
lomiri-thumbnailer = callPackage ./services/lomiri-thumbnailer { };
lomiri-url-dispatcher = callPackage ./services/lomiri-url-dispatcher { };
mediascanner2 = callPackage ./services/mediascanner2 { };
telephony-service = callPackage ./services/telephony-service { };
};
in
lib.makeScope libsForQt5.newScope packages

View file

@ -0,0 +1,227 @@
{ stdenv
, lib
, fetchFromGitLab
, fetchpatch
, fetchpatch2
, gitUpdater
, nixosTests
, ayatana-indicator-messages
, bash
, cmake
, dbus
, dbus-glib
, dbus-test-runner
, dconf
, gettext
, glib
, gnome
, history-service
, libnotify
, libphonenumber
, libpulseaudio
, libusermetrics
, lomiri-ui-toolkit
, lomiri-url-dispatcher
, makeWrapper
, pkg-config
, protobuf
, python3
, qtbase
, qtdeclarative
, qtfeedback
, qtmultimedia
, qtpim
, telepathy
, telepathy-glib
, telepathy-mission-control
, xvfb-run
}:
let
replaceDbusService = pkg: name: "--replace \"\\\${DBUS_SERVICES_DIR}/${name}\" \"${pkg}/share/dbus-1/services/${name}\"";
in
stdenv.mkDerivation (finalAttrs: {
pname = "telephony-service";
version = "0.5.2";
src = fetchFromGitLab {
owner = "ubports";
repo = "development/core/telephony-service";
rev = finalAttrs.version;
hash = "sha256-9KxM8UWTIBpMMPosar2ZV9W35WmCLIWXD1ulWtqCKxM=";
};
patches = [
# Remove when version > 0.5.2
(fetchpatch {
name = "0001-telephony-service-CMakeLists-Fix-Cross-conditional-for-QT_INSTALL_QML-determining.patch";
url = "https://gitlab.com/ubports/development/core/telephony-service/-/commit/c19463444af257c263f35127284d9787f3522f1f.patch";
hash = "sha256-Dr/uev/z4pEiV4/QRmQ15+6wrD8rh+8vRcfWIi8FBCU=";
})
# Remove when version > 0.5.2
(fetchpatch {
name = "0002-telephony-service-tests-libtelephonyservice-CMakeLists-Fix-ProtocolTest-build.patch";
url = "https://gitlab.com/ubports/development/core/telephony-service/-/commit/d8f0f38f8b723569c03d601ac803b079ed51d09e.patch";
hash = "sha256-asDEzh8Yg6LXl6fdwan6IhwLEuzmDfmHI+pjpxJRbeE=";
})
# Remove when https://gitlab.com/ubports/development/core/telephony-service/-/merge_requests/89 merged & in release
(fetchpatch2 {
name = "0003-telephony-service-Add-more-better-GNUInstallDirs-variables-usage.patch";
url = "https://gitlab.com/ubports/development/core/telephony-service/-/commit/9a35a50c587ebfdfb1e08b54ffec0d2e6fef1950.patch";
hash = "sha256-jGeJlwbyVr0WkyGKY7Lw5dY/V9yN43DpZmuli6oRho0=";
})
# Remove when https://gitlab.com/ubports/development/core/telephony-service/-/merge_requests/90 merged & in release
(fetchpatch {
name = "0004-telephony-service-CMakeLists-Make-tests-optional.patch";
url = "https://gitlab.com/ubports/development/core/telephony-service/-/commit/9a8297bcf9b34d77ffdae3dfe4ad2636022976fb.patch";
hash = "sha256-Za4ZGKnw9iz2RP1LzLhKrEJ1vLUufWk8J07LmWDW40E=";
})
# libphonenumber -> protobuf -> abseil-cpp demands C++14
# But uses std::string_view which is C++17?
# Remove when version > 0.5.2
(fetchpatch {
name = "0005-telephony-service-Upgrade-C++-standard-to-C++17.patch";
url = "https://gitlab.com/ubports/development/core/telephony-service/-/commit/b77349acb4ab3f857a55481eeaf2af1dcecfb775.patch";
hash = "sha256-vNtelYu/I9lv8EkNn8gB6zNgLJ24Znp9HYmLG9olFe8=";
})
];
postPatch = ''
# 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 ''
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
makeWrapper
];
buildInputs = [
ayatana-indicator-messages
bash
dbus-glib
dbus
dconf
gettext
glib
history-service
libnotify
libphonenumber
libpulseaudio
libusermetrics
lomiri-url-dispatcher
protobuf
(python3.withPackages (ps: with ps; [
dbus-python
pygobject3
]))
qtbase
qtdeclarative
qtfeedback
qtmultimedia
qtpim
telepathy
telepathy-glib
telepathy-mission-control
];
nativeCheckInputs = [
dbus-test-runner
dconf
gnome.gnome-keyring
telepathy-mission-control
xvfb-run
];
dontWrapQtApps = true;
cmakeFlags = [
# These rely on libphonenumber reformatting inputs to certain results
# Seem to be broken for a small amount of numbers, maybe libphonenumber version change?
(lib.cmakeBool "SKIP_QML_TESTS" true)
(lib.cmakeFeature "CMAKE_CTEST_ARGUMENTS" (lib.concatStringsSep ";" [
# Exclude tests
"-E" (lib.strings.escapeShellArg "(${lib.concatStringsSep "|" [
# Flaky, randomly failing to launch properly & stuck until test timeout
"^HandlerTest"
"^OfonoAccountEntryTest"
"^TelepathyHelperSetupTest"
"^AuthHandlerTest"
"^ChatManagerTest"
]})")
]))
];
env.NIX_CFLAGS_COMPILE = toString ([
"-I${lib.getDev telepathy-glib}/include/telepathy-1.0" # it's in telepathy-farstream's Requires.private, so it & its dependencies don't get pulled in
"-I${lib.getDev dbus-glib}/include/dbus-1.0" # telepathy-glib dependency
"-I${lib.getDev dbus}/include/dbus-1.0" # telepathy-glib dependency
]);
doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
# Starts & talks to D-Bus services, breaks with parallelism
enableParallelChecking = false;
preCheck = ''
export QT_QPA_PLATFORM=minimal
export QT_PLUGIN_PATH=${lib.makeSearchPathOutput "bin" qtbase.qtPluginPrefix [ qtbase qtpim ]}
'';
postInstall = ''
patchShebangs $out/bin/{ofono-setup,phone-gsettings-migration.py}
# Still missing getprop from libhybris, we don't have it packaged (yet?)
wrapProgram $out/bin/ofono-setup \
--prefix PATH : ${lib.makeBinPath [ dbus dconf gettext glib telepathy-mission-control ]}
# These SystemD services are referenced by the installed D-Bus services, but not part of the installation. Why?
for service in telephony-service-{approver,indicator}; do
install -Dm644 ../debian/telephony-service."$service".user.service $out/lib/systemd/user/"$service".service
# ofono-setup.service would be rovided by ubuntu-touch-session, we don't plan to package it
substituteInPlace $out/lib/systemd/user/"$service".service \
--replace '/usr' "$out" \
--replace 'Requires=ofono-setup.service' "" \
--replace 'After=ofono-setup.service' "" \
sed -i $out/lib/systemd/user/"$service".service \
-e '/ofono-setup.service/d'
done
'';
passthru = {
ayatana-indicators = [
"telephony-service-indicator"
];
tests.vm = nixosTests.ayatana-indicators;
updateScript = gitUpdater { };
};
meta = with lib; {
description = "Backend dispatcher service for various mobile phone related operations";
homepage = "https://gitlab.com/ubports/development/core/telephony-service";
changelog = "https://gitlab.com/ubports/development/core/telephony-service/-/blob/${finalAttrs.version}/ChangeLog";
license = licenses.gpl3Only;
maintainers = teams.lomiri.members;
platforms = platforms.linux;
};
})