From 0919fd6c61467ff60b8c1b441f298493204619e7 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Thu, 30 Apr 2026 07:06:36 +0200 Subject: [PATCH] {libsForQt5,qt6Packages}.accounts-qt: Adopt, modernise - Add OPNA2608 as maintainer - Add outputs - Run tests - Fix doc graphics - Add test for pkg-config modules - Don't install test binary - Set homepage to Accounts SSO website - Clarify license --- .../libraries/accounts-qt/default.nix | 99 +++++++++++++++---- 1 file changed, 82 insertions(+), 17 deletions(-) diff --git a/pkgs/development/libraries/accounts-qt/default.nix b/pkgs/development/libraries/accounts-qt/default.nix index 6e98ed629910..6674b7da7ae0 100644 --- a/pkgs/development/libraries/accounts-qt/default.nix +++ b/pkgs/development/libraries/accounts-qt/default.nix @@ -2,21 +2,27 @@ stdenv, lib, fetchFromGitLab, + testers, gitUpdater, + dbus-test-runner, doxygen, glib, + graphviz, libaccounts-glib, pkg-config, qmake, qtbase, - wrapQtAppsHook, + qttools, + writableTmpDirAsHomeHook, }: +let + withQt6 = lib.strings.versionAtLeast qtbase.version "6"; +in stdenv.mkDerivation (finalAttrs: { pname = "accounts-qt"; version = "1.17"; - # pinned to fork with Qt6 support src = fetchFromGitLab { owner = "accounts-sso"; repo = "libaccounts-qt"; @@ -24,32 +30,91 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-mPZgD4r7vlUP6wklvZVknGqTXZBckSOtNzK7p6e2qSA="; }; + outputs = [ + "out" + "dev" + "doc" + ]; + + postPatch = + # Don't install test binary. Not useful, and it has ref to /build. + '' + substituteInPlace tests/tst_libaccounts.pro \ + --replace-fail 'include( ../common-installs-config.pri )' '# include( ../common-installs-config.pri )' + '' + # Let Nix do the timeout. + + '' + substituteInPlace tests/accountstest.sh \ + --replace-fail 'dbus-test-runner -m 180' 'dbus-test-runner -m 0' + '' + # We're installing headers to dev output + + '' + substituteInPlace Accounts/AccountsQt*Config.cmake.in \ + --replace-fail 'set(ACCOUNTSQT_INCLUDE_DIRS $${INSTALL_PREFIX}' 'set(ACCOUNTSQT_INCLUDE_DIRS $${NIX_OUTPUT_DEV}' + '' + # qhelpgenerator isn't on PATH w/ Qt6 + + '' + substituteInPlace doc/doxy.conf \ + --replace-fail \ + '= qhelpgenerator' \ + '= ${if withQt6 then "${qttools}/libexec" else "${lib.getDev qttools}/bin"}/qhelpgenerator' + ''; + + # QMake + strictDeps = false; + + nativeBuildInputs = [ + doxygen + graphviz + pkg-config + qmake + writableTmpDirAsHomeHook # to stop doxygen from complaining + ]; + propagatedBuildInputs = [ glib libaccounts-glib ]; - buildInputs = [ qtbase ]; - nativeBuildInputs = [ - doxygen - pkg-config - qmake - wrapQtAppsHook + + nativeCheckInputs = [ + dbus-test-runner ]; - # remove forbidden references to /build - preFixup = '' - patchelf --shrink-rpath --allowed-rpath-prefixes "$NIX_STORE" "$out"/bin/* + # Library + dontWrapQtApps = true; + + # Configure *now* + postConfigure = '' + make qmake_all ''; - passthru.updateScript = gitUpdater { - rev-prefix = "VERSION_"; + postBuild = '' + make docs + ''; + + doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; + + # For qhelpgenerator to find minimal plugin + env.QT_PLUGIN_PATH = "${lib.getBin qtbase}/${qtbase.qtPluginPrefix}"; + + passthru = { + tests.pkg-config = testers.hasPkgConfigModules { + package = finalAttrs.finalPackage; + versionCheck = true; + }; + updateScript = gitUpdater { + rev-prefix = "VERSION_"; + }; }; meta = { - description = "Qt library for accessing the online accounts database"; - mainProgram = "accountstest"; - homepage = "https://gitlab.com/accounts-sso/libaccounts-qt"; - license = lib.licenses.lgpl21; + description = "Qt-based client library for the accounts database"; + homepage = "https://accounts-sso.gitlab.io/"; + license = lib.licenses.lgpl21Only; + maintainers = [ lib.maintainers.OPNA2608 ]; platforms = lib.platforms.linux; + pkgConfigModules = [ + "accounts-qt${lib.versions.major qtbase.version}" + ]; }; })