From d4a518318044dbb3c842905ca4ab42f6ed544c5b Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Fri, 19 Apr 2024 19:26:47 +0200 Subject: [PATCH 1/3] ayatana-indicator-display: init at 24.5.0 --- nixos/tests/ayatana-indicators.nix | 3 +- .../ay/ayatana-indicator-display/package.nix | 124 ++++++++++++++++++ 2 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 pkgs/by-name/ay/ayatana-indicator-display/package.nix diff --git a/nixos/tests/ayatana-indicators.nix b/nixos/tests/ayatana-indicators.nix index 1ca3e1dda3d3..cfd4d8099d11 100644 --- a/nixos/tests/ayatana-indicators.nix +++ b/nixos/tests/ayatana-indicators.nix @@ -28,6 +28,7 @@ in { enable = true; packages = with pkgs; [ ayatana-indicator-datetime + ayatana-indicator-display ayatana-indicator-messages ayatana-indicator-power ayatana-indicator-session @@ -95,7 +96,7 @@ in { # Now check if all indicators were brought up successfully, and kill them for later '' + (runCommandOverAyatanaIndicators (service: let serviceExec = builtins.replaceStrings [ "." ] [ "-" ] service; in '' - machine.succeed("pgrep -u ${user} -f ${serviceExec}") + machine.wait_until_succeeds("pgrep -u ${user} -f ${serviceExec}") machine.succeed("pkill -f ${serviceExec}") '')) + '' diff --git a/pkgs/by-name/ay/ayatana-indicator-display/package.nix b/pkgs/by-name/ay/ayatana-indicator-display/package.nix new file mode 100644 index 000000000000..8c5e5c9e5160 --- /dev/null +++ b/pkgs/by-name/ay/ayatana-indicator-display/package.nix @@ -0,0 +1,124 @@ +{ stdenv +, lib +, gitUpdater +, fetchFromGitHub +, nixosTests +, accountsservice +, cmake +, cppcheck +, dbus +, geoclue2 +, glib +, gsettings-desktop-schemas +, gtest +, intltool +, libayatana-common +, libgudev +, libqtdbusmock +, libqtdbustest +, libsForQt5 +, lomiri +, mate +, pkg-config +, properties-cpp +, python3 +, systemd +, wrapGAppsHook3 +, xsct +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "ayatana-indicator-display"; + version = "24.5.0"; + + src = fetchFromGitHub { + owner = "AyatanaIndicators"; + repo = "ayatana-indicator-display"; + rev = "refs/tags/${finalAttrs.version}"; + hash = "sha256-ZEmJJtVK1dHIrY0C6pqVu1N5PmQtYqX0K5v5LvzNfFA="; + }; + + postPatch = '' + # Replace systemd prefix in pkg-config query, use GNUInstallDirs location for /etc + substituteInPlace data/CMakeLists.txt \ + --replace-fail 'pkg_get_variable(SYSTEMD_USER_DIR systemd systemduserunitdir)' 'pkg_get_variable(SYSTEMD_USER_DIR systemd systemduserunitdir DEFINE_VARIABLES prefix=''${CMAKE_INSTALL_PREFIX})' \ + --replace-fail 'DESTINATION "/etc' 'DESTINATION "''${CMAKE_INSTALL_FULL_SYSCONFDIR}' + + # Hardcode xsct path + substituteInPlace src/service.cpp \ + --replace-fail 'sCommand = g_strdup_printf ("xsct' 'sCommand = g_strdup_printf ("${lib.getExe xsct}' + ''; + + strictDeps = true; + + nativeBuildInputs = [ + cmake + glib # for schema discovery + intltool + pkg-config + wrapGAppsHook3 + ]; + + # TODO Can we get around requiring every desktop's schemas just to avoid segfaulting on some systems? + buildInputs = [ + accountsservice + geoclue2 + gsettings-desktop-schemas # gnome schemas + glib + libayatana-common + libgudev + libsForQt5.qtbase + systemd + ] ++ (with lomiri; [ + cmake-extras + lomiri-schemas # lomiri schema + ]) ++ (with mate; [ + mate.marco # marco schema + mate.mate-settings-daemon # mate mouse schema + ]); + + nativeCheckInputs = [ + cppcheck + dbus + (python3.withPackages (ps: with ps; [ + python-dbusmock + ])) + ]; + + checkInputs = [ + gtest + libqtdbusmock + libqtdbustest + properties-cpp + ]; + + dontWrapQtApps = true; + + cmakeFlags = [ + (lib.cmakeBool "ENABLE_TESTS" finalAttrs.finalPackage.doCheck) + (lib.cmakeBool "ENABLE_COLOR_TEMP" true) + (lib.cmakeBool "GSETTINGS_LOCALINSTALL" true) + (lib.cmakeBool "GSETTINGS_COMPILE" true) + ]; + + doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; + + passthru = { + ayatana-indicators = [ "ayatana-indicator-display" ]; + tests.vm = nixosTests.ayatana-indicators; + updateScript = gitUpdater { }; + }; + + meta = with lib; { + description = "Ayatana Indicator for Display configuration"; + longDescription = '' + This Ayatana Indicator is designed to be placed on the right side of a + panel and give the user easy control for changing their display settings. + ''; + homepage = "https://github.com/AyatanaIndicators/ayatana-indicator-display"; + changelog = "https://github.com/AyatanaIndicators/ayatana-indicator-display/blob/${finalAttrs.version}/ChangeLog"; + license = licenses.gpl3Only; + maintainers = with maintainers; [ OPNA2608 ]; + platforms = platforms.linux; + }; +}) From d29e469f2a129a40b232760d0cd282f36a0cdaf9 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Sat, 20 Apr 2024 10:58:17 +0200 Subject: [PATCH 2/3] nixos/lomiri: Add display indicator --- nixos/modules/services/desktop-managers/lomiri.nix | 1 + nixos/tests/lomiri.nix | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/desktop-managers/lomiri.nix b/nixos/modules/services/desktop-managers/lomiri.nix index d16c3c750da6..06930b15a008 100644 --- a/nixos/modules/services/desktop-managers/lomiri.nix +++ b/nixos/modules/services/desktop-managers/lomiri.nix @@ -72,6 +72,7 @@ in { enable = true; packages = (with pkgs; [ ayatana-indicator-datetime + ayatana-indicator-display ayatana-indicator-messages ayatana-indicator-power ayatana-indicator-session diff --git a/nixos/tests/lomiri.nix b/nixos/tests/lomiri.nix index b0be3baa20fb..6ae1e1c666d9 100644 --- a/nixos/tests/lomiri.nix +++ b/nixos/tests/lomiri.nix @@ -290,7 +290,7 @@ in { # There's a test app we could use that also displays their contents, but it's abit inconsistent. with subtest("ayatana indicators work"): mouse_click(735, 0) # the cog in the top-right, for the session indicator - machine.wait_for_text(r"(Notifications|Battery|Sound|Time|Date|System)") + machine.wait_for_text(r"(Notifications|Rotation|Battery|Sound|Time|Date|System)") machine.screenshot("indicators_open") # Indicator order within the menus *should* be fixed based on per-indicator order setting @@ -299,10 +299,16 @@ in { machine.send_key("left") machine.send_key("left") machine.send_key("left") + machine.send_key("left") # Notifications are usually empty, nothing to check there - with subtest("lomiri indicator network works"): + with subtest("ayatana indicator display works"): # We start on this, don't go right + machine.wait_for_text("Lock") + machine.screenshot("indicators_display") + + with subtest("lomiri indicator network works"): + machine.send_key("right") machine.wait_for_text(r"(Flight|Wi-Fi)") machine.screenshot("indicators_network") From 01152519d6cde79a4077d0cf98cf80e2acf8ebdc Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Thu, 23 May 2024 20:40:15 +0200 Subject: [PATCH 3/3] nixos/tests/lomiri: Fix sound indicator subtest name It's an ayatana one, not a lomiri one. --- nixos/tests/lomiri.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/tests/lomiri.nix b/nixos/tests/lomiri.nix index 6ae1e1c666d9..99f04a303be3 100644 --- a/nixos/tests/lomiri.nix +++ b/nixos/tests/lomiri.nix @@ -312,7 +312,7 @@ in { machine.wait_for_text(r"(Flight|Wi-Fi)") machine.screenshot("indicators_network") - with subtest("lomiri indicator sound works"): + with subtest("ayatana indicator sound works"): machine.send_key("right") machine.wait_for_text(r"(Silent|Volume)") machine.screenshot("indicators_sound")