From a7440c78739f6d379c580e61b02fed4fa7f3586c Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Thu, 18 Apr 2024 20:38:43 +0200 Subject: [PATCH 1/2] ayatana-indicator-sound: init at 24.4.0 --- nixos/tests/ayatana-indicators.nix | 3 + .../ay/ayatana-indicator-sound/package.nix | 125 ++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 pkgs/by-name/ay/ayatana-indicator-sound/package.nix diff --git a/nixos/tests/ayatana-indicators.nix b/nixos/tests/ayatana-indicators.nix index 13a0982a142bb..1ca3e1dda3d34 100644 --- a/nixos/tests/ayatana-indicators.nix +++ b/nixos/tests/ayatana-indicators.nix @@ -31,6 +31,7 @@ in { ayatana-indicator-messages ayatana-indicator-power ayatana-indicator-session + ayatana-indicator-sound ] ++ (with pkgs.lomiri; [ lomiri-indicator-network telephony-service @@ -41,6 +42,8 @@ in { services.accounts-daemon.enable = true; # messages + hardware.pulseaudio.enable = true; # sound + # Lomiri-ish setup for Lomiri indicators # TODO move into a Lomiri module, once the package set is far enough for the DE to start diff --git a/pkgs/by-name/ay/ayatana-indicator-sound/package.nix b/pkgs/by-name/ay/ayatana-indicator-sound/package.nix new file mode 100644 index 0000000000000..84d2d8c3bfc97 --- /dev/null +++ b/pkgs/by-name/ay/ayatana-indicator-sound/package.nix @@ -0,0 +1,125 @@ +{ stdenv +, lib +, gitUpdater +, fetchFromGitHub +, nixosTests +, accountsservice +, cmake +, dbus +, dbus-test-runner +, glib +, gobject-introspection +, gtest +, intltool +, libayatana-common +, libgee +, libnotify +, libpulseaudio +, libqtdbusmock +, libqtdbustest +, libsForQt5 +, libxml2 +, lomiri +, pkg-config +, python3 +, systemd +, vala +, wrapGAppsHook3 +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "ayatana-indicator-sound"; + version = "24.4.0"; + + src = fetchFromGitHub { + owner = "AyatanaIndicators"; + repo = "ayatana-indicator-sound"; + rev = "refs/tags/${finalAttrs.version}"; + hash = "sha256-2B2CFUjDvBpZ8R4fnGDViS3pXO1L0kP1tnJCtqKeLaQ="; + }; + + 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}' + + # Build-time Vala codegen + substituteInPlace src/CMakeLists.txt \ + --replace-fail '/usr/share/gir-1.0/AccountsService-1.0.gir' '${lib.getDev accountsservice}/share/gir-1.0/AccountsService-1.0.gir' + ''; + + strictDeps = true; + + nativeBuildInputs = [ + cmake + gobject-introspection + intltool + libpulseaudio # vala files(?) + pkg-config + vala + wrapGAppsHook3 + ]; + + buildInputs = [ + accountsservice + glib + gobject-introspection + libayatana-common + libgee + libnotify + libpulseaudio + libxml2 + systemd + ] ++ (with lomiri; [ + cmake-extras + lomiri-api + lomiri-schemas + ]); + + nativeCheckInputs = [ + dbus + (python3.withPackages (ps: with ps; [ + python-dbusmock + ])) + ]; + + checkInputs = [ + dbus-test-runner + gtest + libsForQt5.qtbase + libqtdbusmock + libqtdbustest + lomiri.gmenuharness + ]; + + cmakeFlags = [ + (lib.cmakeBool "ENABLE_TESTS" finalAttrs.finalPackage.doCheck) + (lib.cmakeBool "ENABLE_LOMIRI_FEATURES" true) + (lib.cmakeBool "GSETTINGS_LOCALINSTALL" true) + (lib.cmakeBool "GSETTINGS_COMPILE" true) + ]; + + dontWrapQtApps = true; + + doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; + + passthru = { + ayatana-indicators = [ "ayatana-indicator-sound" ]; + tests.vm = nixosTests.ayatana-indicators; + updateScript = gitUpdater { }; + }; + + meta = with lib; { + description = "Ayatana Indicator for managing system sound"; + longDescription = '' + Ayatana Indicator Sound that provides easy control of the PulseAudio + sound daemon. + ''; + homepage = "https://github.com/AyatanaIndicators/ayatana-indicator-sound"; + changelog = "https://github.com/AyatanaIndicators/ayatana-indicator-sound/blob/${finalAttrs.version}/ChangeLog"; + license = licenses.gpl3Only; + maintainers = with maintainers; [ OPNA2608 ]; + platforms = platforms.linux; + }; +}) From af545969b68d0140ea6f68fb89d76e2e550d5e60 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Tue, 21 May 2024 16:15:23 +0200 Subject: [PATCH 2/2] nixos/lomiri: Add sound indicator --- nixos/modules/services/desktop-managers/lomiri.nix | 3 +++ nixos/tests/lomiri.nix | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/desktop-managers/lomiri.nix b/nixos/modules/services/desktop-managers/lomiri.nix index 0a1b86096e765..d16c3c750da63 100644 --- a/nixos/modules/services/desktop-managers/lomiri.nix +++ b/nixos/modules/services/desktop-managers/lomiri.nix @@ -38,6 +38,7 @@ in { ]); }; + hardware.pulseaudio.enable = lib.mkDefault true; networking.networkmanager.enable = lib.mkDefault true; systemd.packages = with pkgs.lomiri; [ @@ -74,6 +75,8 @@ in { ayatana-indicator-messages ayatana-indicator-power ayatana-indicator-session + ] ++ lib.optionals (config.hardware.pulseaudio.enable || config.services.pipewire.pulse.enable) [ + ayatana-indicator-sound ]) ++ (with pkgs.lomiri; [ telephony-service ] ++ lib.optionals config.networking.networkmanager.enable [ diff --git a/nixos/tests/lomiri.nix b/nixos/tests/lomiri.nix index 3f20aae441351..b0be3baa20fbc 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|Time|Date|System)") + machine.wait_for_text(r"(Notifications|Battery|Sound|Time|Date|System)") machine.screenshot("indicators_open") # Indicator order within the menus *should* be fixed based on per-indicator order setting @@ -298,6 +298,7 @@ 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"): @@ -305,6 +306,11 @@ in { machine.wait_for_text(r"(Flight|Wi-Fi)") machine.screenshot("indicators_network") + with subtest("lomiri indicator sound works"): + machine.send_key("right") + machine.wait_for_text(r"(Silent|Volume)") + machine.screenshot("indicators_sound") + with subtest("ayatana indicator power works"): machine.send_key("right") machine.wait_for_text(r"(Charge|Battery settings)")