From 41d60c4c9fc583953ea6b1638188748016e61e38 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Thu, 3 Oct 2024 22:37:34 -0300 Subject: [PATCH 1/8] pulseaudio: internalize darwin dependencies Further, rename patch. --- ...h => 0000-add-option-for-installation-sysconfdir.patch} | 0 pkgs/servers/pulseaudio/default.nix | 7 +++++-- pkgs/top-level/all-packages.nix | 4 +--- 3 files changed, 6 insertions(+), 5 deletions(-) rename pkgs/servers/pulseaudio/{add-option-for-installation-sysconfdir.patch => 0000-add-option-for-installation-sysconfdir.patch} (100%) diff --git a/pkgs/servers/pulseaudio/add-option-for-installation-sysconfdir.patch b/pkgs/servers/pulseaudio/0000-add-option-for-installation-sysconfdir.patch similarity index 100% rename from pkgs/servers/pulseaudio/add-option-for-installation-sysconfdir.patch rename to pkgs/servers/pulseaudio/0000-add-option-for-installation-sysconfdir.patch diff --git a/pkgs/servers/pulseaudio/default.nix b/pkgs/servers/pulseaudio/default.nix index 44f89234ec6d906..0df2e1630620ec8 100644 --- a/pkgs/servers/pulseaudio/default.nix +++ b/pkgs/servers/pulseaudio/default.nix @@ -34,9 +34,12 @@ , # Whether to build only the library. libOnly ? false -, AudioUnit, Cocoa, CoreServices, CoreAudio +, darwin }: +let + inherit (darwin.apple_sdk.frameworks) CoreServices AudioUnit Cocoa CoreAudio; +in stdenv.mkDerivation rec { pname = "${lib.optionalString libOnly "lib"}pulseaudio"; version = "17.0"; @@ -49,7 +52,7 @@ stdenv.mkDerivation rec { patches = [ # Install sysconfdir files inside of the nix store, # but use a conventional runtime sysconfdir outside the store - ./add-option-for-installation-sysconfdir.patch + ./0000-add-option-for-installation-sysconfdir.patch # Fix crashes with some UCM devices # See https://gitlab.archlinux.org/archlinux/packaging/packages/pulseaudio/-/issues/4 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 8198b782e9a92b1..ef8cec3812bc2af 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24766,9 +24766,7 @@ with pkgs; hsphfpd = callPackage ../servers/pulseaudio/hsphfpd.nix { }; - pulseaudio = callPackage ../servers/pulseaudio { - inherit (darwin.apple_sdk.frameworks) CoreServices AudioUnit Cocoa CoreAudio; - }; + pulseaudio = callPackage ../servers/pulseaudio { }; qpaeq = libsForQt5.callPackage ../servers/pulseaudio/qpaeq.nix { }; From 3368ddb27639baa92cd18475b74a243eb03e6aa5 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Thu, 3 Oct 2024 22:40:08 -0300 Subject: [PATCH 2/8] pulseaudio: migrate to by-name --- .../0000-add-option-for-installation-sysconfdir.patch | 0 .../default.nix => by-name/pu/pulseaudio/package.nix} | 0 pkgs/top-level/all-packages.nix | 2 -- 3 files changed, 2 deletions(-) rename pkgs/{servers => by-name/pu}/pulseaudio/0000-add-option-for-installation-sysconfdir.patch (100%) rename pkgs/{servers/pulseaudio/default.nix => by-name/pu/pulseaudio/package.nix} (100%) diff --git a/pkgs/servers/pulseaudio/0000-add-option-for-installation-sysconfdir.patch b/pkgs/by-name/pu/pulseaudio/0000-add-option-for-installation-sysconfdir.patch similarity index 100% rename from pkgs/servers/pulseaudio/0000-add-option-for-installation-sysconfdir.patch rename to pkgs/by-name/pu/pulseaudio/0000-add-option-for-installation-sysconfdir.patch diff --git a/pkgs/servers/pulseaudio/default.nix b/pkgs/by-name/pu/pulseaudio/package.nix similarity index 100% rename from pkgs/servers/pulseaudio/default.nix rename to pkgs/by-name/pu/pulseaudio/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ef8cec3812bc2af..0e4587a36510eb3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24766,8 +24766,6 @@ with pkgs; hsphfpd = callPackage ../servers/pulseaudio/hsphfpd.nix { }; - pulseaudio = callPackage ../servers/pulseaudio { }; - qpaeq = libsForQt5.callPackage ../servers/pulseaudio/qpaeq.nix { }; pulseaudioFull = pulseaudio.override { From fb70fd710d86b5413c9f634237346500c4aafbac Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Thu, 3 Oct 2024 23:08:21 -0300 Subject: [PATCH 3/8] pulseaudio: nixfmt-rfc-style --- pkgs/by-name/pu/pulseaudio/package.nix | 340 ++++++++++++++++--------- 1 file changed, 215 insertions(+), 125 deletions(-) diff --git a/pkgs/by-name/pu/pulseaudio/package.nix b/pkgs/by-name/pu/pulseaudio/package.nix index 0df2e1630620ec8..2aac83429826e2a 100644 --- a/pkgs/by-name/pu/pulseaudio/package.nix +++ b/pkgs/by-name/pu/pulseaudio/package.nix @@ -1,44 +1,76 @@ -{ lib, stdenv, fetchurl, pkg-config -, libsndfile, libtool, makeWrapper, perlPackages -, xorg, libcap, alsa-lib, glib, dconf -, avahi, libjack2, libasyncns, lirc, dbus -, sbc, bluez5, udev, openssl, fftwFloat -, soxr, speexdsp, systemd, webrtc-audio-processing_1 -, gst_all_1 -, check, libintl, meson, ninja, m4, wrapGAppsHook3 -, fetchpatch2 -, nixosTests +{ + lib, + stdenv, + fetchurl, + pkg-config, + libsndfile, + libtool, + makeWrapper, + perlPackages, + xorg, + libcap, + alsa-lib, + glib, + dconf, + avahi, + libjack2, + libasyncns, + lirc, + dbus, + sbc, + bluez5, + udev, + openssl, + fftwFloat, + soxr, + speexdsp, + systemd, + webrtc-audio-processing_1, + gst_all_1, + check, + libintl, + meson, + ninja, + m4, + wrapGAppsHook3, + fetchpatch2, + nixosTests, -, x11Support ? false + x11Support ? false, -, useSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd + useSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, -, # Whether to support the JACK sound system as a backend. - jackaudioSupport ? false + # Whether to support the JACK sound system as a backend. + jackaudioSupport ? false, -, # Whether to build the OSS wrapper ("padsp"). - ossWrapper ? true + # Whether to build the OSS wrapper ("padsp"). + ossWrapper ? true, -, airtunesSupport ? false + airtunesSupport ? false, -, bluetoothSupport ? stdenv.hostPlatform.isLinux -, advancedBluetoothCodecs ? false + bluetoothSupport ? stdenv.hostPlatform.isLinux, + advancedBluetoothCodecs ? false, -, remoteControlSupport ? false + remoteControlSupport ? false, -, zeroconfSupport ? false + zeroconfSupport ? false, -, alsaSupport ? stdenv.hostPlatform.isLinux -, udevSupport ? stdenv.hostPlatform.isLinux + alsaSupport ? stdenv.hostPlatform.isLinux, + udevSupport ? stdenv.hostPlatform.isLinux, -, # Whether to build only the library. - libOnly ? false + # Whether to build only the library. + libOnly ? false, -, darwin + darwin, }: let - inherit (darwin.apple_sdk.frameworks) CoreServices AudioUnit Cocoa CoreAudio; + inherit (darwin.apple_sdk.frameworks) + CoreServices + AudioUnit + Cocoa + CoreAudio + ; in stdenv.mkDerivation rec { pname = "${lib.optionalString libOnly "lib"}pulseaudio"; @@ -68,78 +100,132 @@ stdenv.mkDerivation rec { }) ]; - outputs = [ "out" "dev" ]; + outputs = [ + "out" + "dev" + ]; - nativeBuildInputs = [ pkg-config meson ninja makeWrapper perlPackages.perl perlPackages.XMLParser m4 ] + nativeBuildInputs = + [ + pkg-config + meson + ninja + makeWrapper + perlPackages.perl + perlPackages.XMLParser + m4 + ] ++ lib.optionals stdenv.hostPlatform.isLinux [ glib ] # gstreamer plugin discovery requires wrapping ++ lib.optional (bluetoothSupport && advancedBluetoothCodecs) wrapGAppsHook3; - propagatedBuildInputs = - lib.optionals stdenv.hostPlatform.isLinux [ libcap ]; + propagatedBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ libcap ]; buildInputs = - [ libtool libsndfile soxr speexdsp fftwFloat check ] - ++ lib.optionals stdenv.hostPlatform.isLinux [ glib dbus ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ AudioUnit Cocoa CoreServices CoreAudio libintl ] + [ + libtool + libsndfile + soxr + speexdsp + fftwFloat + check + ] + ++ lib.optionals stdenv.hostPlatform.isLinux [ + glib + dbus + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + AudioUnit + Cocoa + CoreServices + CoreAudio + libintl + ] ++ lib.optionals (!libOnly) ( - [ libasyncns webrtc-audio-processing_1 ] + [ + libasyncns + webrtc-audio-processing_1 + ] ++ lib.optional jackaudioSupport libjack2 - ++ lib.optionals x11Support [ xorg.libICE xorg.libSM xorg.libX11 xorg.libXi xorg.libXtst ] + ++ lib.optionals x11Support [ + xorg.libICE + xorg.libSM + xorg.libX11 + xorg.libXi + xorg.libXtst + ] ++ lib.optional useSystemd systemd - ++ lib.optionals stdenv.hostPlatform.isLinux [ alsa-lib udev ] + ++ lib.optionals stdenv.hostPlatform.isLinux [ + alsa-lib + udev + ] ++ lib.optional airtunesSupport openssl - ++ lib.optionals bluetoothSupport [ bluez5 sbc ] + ++ lib.optionals bluetoothSupport [ + bluez5 + sbc + ] # aptX and LDAC codecs are in gst-plugins-bad so far, rtpldacpay is in -good - ++ lib.optionals (bluetoothSupport && advancedBluetoothCodecs) (builtins.attrValues { inherit (gst_all_1) gst-plugins-bad gst-plugins-good gst-plugins-base gstreamer; }) + ++ lib.optionals (bluetoothSupport && advancedBluetoothCodecs) ( + builtins.attrValues { + inherit (gst_all_1) + gst-plugins-bad + gst-plugins-good + gst-plugins-base + gstreamer + ; + } + ) ++ lib.optional remoteControlSupport lirc - ++ lib.optional zeroconfSupport avahi - ); - - mesonFlags = [ - (lib.mesonEnable "alsa" (!libOnly && alsaSupport)) - (lib.mesonEnable "asyncns" (!libOnly)) - (lib.mesonEnable "avahi" zeroconfSupport) - (lib.mesonEnable "bluez5" (!libOnly && bluetoothSupport)) - # advanced bluetooth audio codecs are provided by gstreamer - (lib.mesonEnable "bluez5-gstreamer" (!libOnly && bluetoothSupport && advancedBluetoothCodecs)) - (lib.mesonOption "database" "simple") - (lib.mesonBool "doxygen" false) - (lib.mesonEnable "elogind" false) - # gsettings does not support cross-compilation - (lib.mesonEnable "gsettings" (stdenv.hostPlatform.isLinux && (stdenv.buildPlatform == stdenv.hostPlatform))) - (lib.mesonEnable "gstreamer" false) - (lib.mesonEnable "gtk" false) - (lib.mesonEnable "jack" (jackaudioSupport && !libOnly)) - (lib.mesonEnable "lirc" remoteControlSupport) - (lib.mesonEnable "openssl" airtunesSupport) - (lib.mesonEnable "orc" false) - (lib.mesonEnable "systemd" (useSystemd && !libOnly)) - (lib.mesonEnable "tcpwrap" false) - (lib.mesonEnable "udev" (!libOnly && udevSupport)) - (lib.mesonEnable "valgrind" false) - (lib.mesonEnable "webrtc-aec" (!libOnly)) - (lib.mesonEnable "x11" x11Support) - - (lib.mesonOption "localstatedir" "/var") - (lib.mesonOption "sysconfdir" "/etc") - (lib.mesonOption "sysconfdir_install" "${placeholder "out"}/etc") - (lib.mesonOption "udevrulesdir" "${placeholder "out"}/lib/udev/rules.d") - - # pulseaudio complains if its binary is moved after installation; - # this is needed so that wrapGApp can operate *without* - # renaming the unwrapped binaries (see below) - "--bindir=${placeholder "out"}/.bin-unwrapped" - ] - ++ lib.optionals (stdenv.hostPlatform.isLinux && useSystemd) [ - (lib.mesonOption "systemduserunitdir" "${placeholder "out"}/lib/systemd/user") - ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ - (lib.mesonEnable "consolekit" false) - (lib.mesonEnable "dbus" false) - (lib.mesonEnable "glib" false) - (lib.mesonEnable "oss-output" false) - ]; + ++ lib.optional zeroconfSupport avahi + ); + + mesonFlags = + [ + (lib.mesonEnable "alsa" (!libOnly && alsaSupport)) + (lib.mesonEnable "asyncns" (!libOnly)) + (lib.mesonEnable "avahi" zeroconfSupport) + (lib.mesonEnable "bluez5" (!libOnly && bluetoothSupport)) + # advanced bluetooth audio codecs are provided by gstreamer + (lib.mesonEnable "bluez5-gstreamer" (!libOnly && bluetoothSupport && advancedBluetoothCodecs)) + (lib.mesonOption "database" "simple") + (lib.mesonBool "doxygen" false) + (lib.mesonEnable "elogind" false) + # gsettings does not support cross-compilation + (lib.mesonEnable "gsettings" ( + stdenv.hostPlatform.isLinux && (stdenv.buildPlatform == stdenv.hostPlatform) + )) + (lib.mesonEnable "gstreamer" false) + (lib.mesonEnable "gtk" false) + (lib.mesonEnable "jack" (jackaudioSupport && !libOnly)) + (lib.mesonEnable "lirc" remoteControlSupport) + (lib.mesonEnable "openssl" airtunesSupport) + (lib.mesonEnable "orc" false) + (lib.mesonEnable "systemd" (useSystemd && !libOnly)) + (lib.mesonEnable "tcpwrap" false) + (lib.mesonEnable "udev" (!libOnly && udevSupport)) + (lib.mesonEnable "valgrind" false) + (lib.mesonEnable "webrtc-aec" (!libOnly)) + (lib.mesonEnable "x11" x11Support) + + (lib.mesonOption "localstatedir" "/var") + (lib.mesonOption "sysconfdir" "/etc") + (lib.mesonOption "sysconfdir_install" "${placeholder "out"}/etc") + (lib.mesonOption "udevrulesdir" "${placeholder "out"}/lib/udev/rules.d") + + # pulseaudio complains if its binary is moved after installation; + # this is needed so that wrapGApp can operate *without* + # renaming the unwrapped binaries (see below) + "--bindir=${placeholder "out"}/.bin-unwrapped" + ] + ++ lib.optionals (stdenv.hostPlatform.isLinux && useSystemd) [ + (lib.mesonOption "systemduserunitdir" "${placeholder "out"}/lib/systemd/user") + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + (lib.mesonEnable "consolekit" false) + (lib.mesonEnable "dbus" false) + (lib.mesonEnable "glib" false) + (lib.mesonEnable "oss-output" false) + ]; # tests fail on Darwin because of timeouts doCheck = !stdenv.hostPlatform.isDarwin; @@ -147,53 +233,57 @@ stdenv.mkDerivation rec { export HOME=$(mktemp -d) ''; - postInstall = lib.optionalString libOnly '' - find $out/share -maxdepth 1 -mindepth 1 ! -name "vala" -prune -exec rm -r {} \; - find $out/share/vala -maxdepth 1 -mindepth 1 ! -name "vapi" -prune -exec rm -r {} \; - rm -r $out/{.bin-unwrapped,etc,lib/pulse-*} - '' + postInstall = + lib.optionalString libOnly '' + find $out/share -maxdepth 1 -mindepth 1 ! -name "vala" -prune -exec rm -r {} \; + find $out/share/vala -maxdepth 1 -mindepth 1 ! -name "vapi" -prune -exec rm -r {} \; + rm -r $out/{.bin-unwrapped,etc,lib/pulse-*} + '' + '' - moveToOutput lib/cmake "$dev" - rm -f $out/.bin-unwrapped/qpaeq # this is packaged by the "qpaeq" package now, because of missing deps + moveToOutput lib/cmake "$dev" + rm -f $out/.bin-unwrapped/qpaeq # this is packaged by the "qpaeq" package now, because of missing deps - cp config.h $dev/include/pulse - ''; + cp config.h $dev/include/pulse + ''; - preFixup = lib.optionalString (stdenv.hostPlatform.isLinux && (stdenv.hostPlatform == stdenv.buildPlatform)) '' - wrapProgram $out/libexec/pulse/gsettings-helper \ - --prefix XDG_DATA_DIRS : "$out/share/gsettings-schemas/${pname}-${version}" \ - --prefix GIO_EXTRA_MODULES : "${lib.getLib dconf}/lib/gio/modules" - '' - # add .so symlinks for modules to be found under macOS - + lib.optionalString stdenv.hostPlatform.isDarwin '' - for file in $out/lib/pulseaudio/modules/*.dylib; do - ln -s "''$file" "''${file%.dylib}.so" - ln -s "''$file" "$out/lib/pulseaudio/''$(basename ''$file .dylib).so" - done - '' - # put symlinks to binaries in `$prefix/bin`; - # then wrapGApp will *rename these symlinks* instead of - # the original binaries in `$prefix/.bin-unwrapped` (see above); - # when pulseaudio is looking for its own binary (it does!), - # it will be happy to find it in its original installation location - + lib.optionalString (!libOnly) '' - mkdir -p $out/bin - ln -st $out/bin $out/.bin-unwrapped/* - - # Ensure that service files use the wrapped binaries. - find "$out" -name "*.service" | while read f; do - substituteInPlace "$f" --replace "$out/.bin-unwrapped/" "$out/bin/" - done - ''; + preFixup = + lib.optionalString (stdenv.hostPlatform.isLinux && (stdenv.hostPlatform == stdenv.buildPlatform)) '' + wrapProgram $out/libexec/pulse/gsettings-helper \ + --prefix XDG_DATA_DIRS : "$out/share/gsettings-schemas/${pname}-${version}" \ + --prefix GIO_EXTRA_MODULES : "${lib.getLib dconf}/lib/gio/modules" + '' + # add .so symlinks for modules to be found under macOS + + lib.optionalString stdenv.hostPlatform.isDarwin '' + for file in $out/lib/pulseaudio/modules/*.dylib; do + ln -s "''$file" "''${file%.dylib}.so" + ln -s "''$file" "$out/lib/pulseaudio/''$(basename ''$file .dylib).so" + done + '' + # put symlinks to binaries in `$prefix/bin`; + # then wrapGApp will *rename these symlinks* instead of + # the original binaries in `$prefix/.bin-unwrapped` (see above); + # when pulseaudio is looking for its own binary (it does!), + # it will be happy to find it in its original installation location + + lib.optionalString (!libOnly) '' + mkdir -p $out/bin + ln -st $out/bin $out/.bin-unwrapped/* - passthru.tests = { inherit (nixosTests) pulseaudio; }; + # Ensure that service files use the wrapped binaries. + find "$out" -name "*.service" | while read f; do + substituteInPlace "$f" --replace "$out/.bin-unwrapped/" "$out/bin/" + done + ''; + + passthru.tests = { + inherit (nixosTests) pulseaudio; + }; meta = { description = "Sound server for POSIX and Win32 systems"; - homepage = "http://www.pulseaudio.org/"; - license = lib.licenses.lgpl2Plus; + homepage = "http://www.pulseaudio.org/"; + license = lib.licenses.lgpl2Plus; maintainers = with lib.maintainers; [ lovek323 ]; - platforms = lib.platforms.unix; + platforms = lib.platforms.unix; # https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1089 badPlatforms = [ lib.systems.inspect.platformPatterns.isStatic ]; From a4204272b5fdd5d778af11d465d111e82723d11b Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Thu, 3 Oct 2024 23:11:14 -0300 Subject: [PATCH 4/8] pulseaudio: rewrite - finalAttrs - reorder input arg list - reorder meta --- pkgs/by-name/pu/pulseaudio/package.nix | 123 +++++++++++-------------- 1 file changed, 54 insertions(+), 69 deletions(-) diff --git a/pkgs/by-name/pu/pulseaudio/package.nix b/pkgs/by-name/pu/pulseaudio/package.nix index 2aac83429826e2a..6dc15daa06e4185 100644 --- a/pkgs/by-name/pu/pulseaudio/package.nix +++ b/pkgs/by-name/pu/pulseaudio/package.nix @@ -1,67 +1,54 @@ { lib, - stdenv, + alsa-lib, + avahi, + bluez5, + check, + darwin, + dbus, + dconf, + fetchpatch2, fetchurl, - pkg-config, + fftwFloat, + glib, + gst_all_1, + libasyncns, + libcap, + libintl, + libjack2, libsndfile, libtool, + lirc, + m4, makeWrapper, + meson, + ninja, + nixosTests, + openssl, perlPackages, - xorg, - libcap, - alsa-lib, - glib, - dconf, - avahi, - libjack2, - libasyncns, - lirc, - dbus, + pkg-config, sbc, - bluez5, - udev, - openssl, - fftwFloat, soxr, speexdsp, + stdenv, systemd, + udev, webrtc-audio-processing_1, - gst_all_1, - check, - libintl, - meson, - ninja, - m4, wrapGAppsHook3, - fetchpatch2, - nixosTests, - - x11Support ? false, - - useSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, - - # Whether to support the JACK sound system as a backend. - jackaudioSupport ? false, - - # Whether to build the OSS wrapper ("padsp"). - ossWrapper ? true, - + xorg, + # Boolean flags + advancedBluetoothCodecs ? false, airtunesSupport ? false, - + alsaSupport ? stdenv.hostPlatform.isLinux, bluetoothSupport ? stdenv.hostPlatform.isLinux, - advancedBluetoothCodecs ? false, - + jackaudioSupport ? false, # Whether to support the JACK sound system as a backend + libOnly ? false, # Whether to build only the library + ossWrapper ? true, # Whether to build the OSS wrapper ("padsp") remoteControlSupport ? false, - - zeroconfSupport ? false, - - alsaSupport ? stdenv.hostPlatform.isLinux, udevSupport ? stdenv.hostPlatform.isLinux, - - # Whether to build only the library. - libOnly ? false, - - darwin, + useSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd, + x11Support ? false, + zeroconfSupport ? false, }: let @@ -72,12 +59,12 @@ let CoreAudio ; in -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "${lib.optionalString libOnly "lib"}pulseaudio"; version = "17.0"; src = fetchurl { - url = "http://freedesktop.org/software/pulseaudio/releases/pulseaudio-${version}.tar.xz"; + url = "http://freedesktop.org/software/pulseaudio/releases/pulseaudio-${finalAttrs.version}.tar.xz"; hash = "sha256-BTeU1mcaPjl9hJ5HioC4KmPLnYyilr01tzMXu1zrh7U="; }; @@ -117,7 +104,7 @@ stdenv.mkDerivation rec { ] ++ lib.optionals stdenv.hostPlatform.isLinux [ glib ] # gstreamer plugin discovery requires wrapping - ++ lib.optional (bluetoothSupport && advancedBluetoothCodecs) wrapGAppsHook3; + ++ lib.optionals (bluetoothSupport && advancedBluetoothCodecs) [ wrapGAppsHook3 ]; propagatedBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ libcap ]; @@ -146,7 +133,7 @@ stdenv.mkDerivation rec { libasyncns webrtc-audio-processing_1 ] - ++ lib.optional jackaudioSupport libjack2 + ++ lib.optionals jackaudioSupport [ libjack2 ] ++ lib.optionals x11Support [ xorg.libICE xorg.libSM @@ -154,12 +141,12 @@ stdenv.mkDerivation rec { xorg.libXi xorg.libXtst ] - ++ lib.optional useSystemd systemd + ++ lib.optionals useSystemd [ systemd ] ++ lib.optionals stdenv.hostPlatform.isLinux [ alsa-lib udev ] - ++ lib.optional airtunesSupport openssl + ++ lib.optionals airtunesSupport [ openssl ] ++ lib.optionals bluetoothSupport [ bluez5 sbc @@ -175,8 +162,8 @@ stdenv.mkDerivation rec { ; } ) - ++ lib.optional remoteControlSupport lirc - ++ lib.optional zeroconfSupport avahi + ++ lib.optionals remoteControlSupport [ lirc ] + ++ lib.optionals zeroconfSupport [ avahi ] ); mesonFlags = @@ -229,6 +216,7 @@ stdenv.mkDerivation rec { # tests fail on Darwin because of timeouts doCheck = !stdenv.hostPlatform.isDarwin; + preCheck = '' export HOME=$(mktemp -d) ''; @@ -249,7 +237,7 @@ stdenv.mkDerivation rec { preFixup = lib.optionalString (stdenv.hostPlatform.isLinux && (stdenv.hostPlatform == stdenv.buildPlatform)) '' wrapProgram $out/libexec/pulse/gsettings-helper \ - --prefix XDG_DATA_DIRS : "$out/share/gsettings-schemas/${pname}-${version}" \ + --prefix XDG_DATA_DIRS : "$out/share/gsettings-schemas/${finalAttrs.pname}-${finalAttrs.version}" \ --prefix GIO_EXTRA_MODULES : "${lib.getLib dconf}/lib/gio/modules" '' # add .so symlinks for modules to be found under macOS @@ -279,23 +267,20 @@ stdenv.mkDerivation rec { }; meta = { - description = "Sound server for POSIX and Win32 systems"; homepage = "http://www.pulseaudio.org/"; + description = "Sound server for POSIX and Win32 systems"; + longDescription = '' + PulseAudio is a sound server for POSIX and Win32 systems. A sound server + is basically a proxy for your sound applications. It allows you to do + advanced operations on your sound data as it passes between your + application and your hardware. Things like transferring the audio to a + different machine, changing the sample format or channel count and mixing + several sounds into one are easily achieved using a sound server. + ''; license = lib.licenses.lgpl2Plus; maintainers = with lib.maintainers; [ lovek323 ]; platforms = lib.platforms.unix; - # https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1089 badPlatforms = [ lib.systems.inspect.platformPatterns.isStatic ]; - - longDescription = '' - PulseAudio is a sound server for POSIX and Win32 systems. A - sound server is basically a proxy for your sound applications. - It allows you to do advanced operations on your sound data as it - passes between your application and your hardware. Things like - transferring the audio to a different machine, changing the - sample format or channel count and mixing several sounds into - one are easily achieved using a sound server. - ''; }; -} +}) From 3fdada38d2c42692b4573a2e458ae54d98618b48 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Fri, 4 Oct 2024 08:29:15 -0300 Subject: [PATCH 5/8] pulseaudio: remove comments from Bash code --- pkgs/by-name/pu/pulseaudio/package.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/pu/pulseaudio/package.nix b/pkgs/by-name/pu/pulseaudio/package.nix index 6dc15daa06e4185..2396b21a4936018 100644 --- a/pkgs/by-name/pu/pulseaudio/package.nix +++ b/pkgs/by-name/pu/pulseaudio/package.nix @@ -229,7 +229,10 @@ stdenv.mkDerivation (finalAttrs: { '' + '' moveToOutput lib/cmake "$dev" - rm -f $out/.bin-unwrapped/qpaeq # this is packaged by the "qpaeq" package now, because of missing deps + '' + # qpaeq is a separated package, because of specific dependencies + + '' + rm -f $out/.bin-unwrapped/qpaeq cp config.h $dev/include/pulse ''; From b80f11598df7692ba6e3ffc79124e438a20d2c8b Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Thu, 3 Oct 2024 22:42:02 -0300 Subject: [PATCH 6/8] hsphfpd: migrate to by-name --- .../pulseaudio/hsphfpd.nix => by-name/hs/hsphfpd/package.nix} | 0 pkgs/top-level/all-packages.nix | 2 -- 2 files changed, 2 deletions(-) rename pkgs/{servers/pulseaudio/hsphfpd.nix => by-name/hs/hsphfpd/package.nix} (100%) diff --git a/pkgs/servers/pulseaudio/hsphfpd.nix b/pkgs/by-name/hs/hsphfpd/package.nix similarity index 100% rename from pkgs/servers/pulseaudio/hsphfpd.nix rename to pkgs/by-name/hs/hsphfpd/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 0e4587a36510eb3..bc43e4fd3a47799 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24764,8 +24764,6 @@ with pkgs; # PulseAudio daemons - hsphfpd = callPackage ../servers/pulseaudio/hsphfpd.nix { }; - qpaeq = libsForQt5.callPackage ../servers/pulseaudio/qpaeq.nix { }; pulseaudioFull = pulseaudio.override { From e7c16bade5400d60a0f081a27e912978c0f04018 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Thu, 3 Oct 2024 22:44:35 -0300 Subject: [PATCH 7/8] qpaeq: get rid of libsForQt5 --- pkgs/servers/pulseaudio/qpaeq.nix | 7 +++++-- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pkgs/servers/pulseaudio/qpaeq.nix b/pkgs/servers/pulseaudio/qpaeq.nix index 8e899b024b4945f..d4dafbb858f3909 100644 --- a/pkgs/servers/pulseaudio/qpaeq.nix +++ b/pkgs/servers/pulseaudio/qpaeq.nix @@ -1,8 +1,9 @@ -{ mkDerivation +{ stdenv , makeDesktopItem , python3 , lib , pulseaudio +, qt5 }: let @@ -16,10 +17,12 @@ let startupNotify = false; }; in -mkDerivation rec { +stdenv.mkDerivation rec { pname = "qpaeq"; inherit (pulseaudio) version src; + nativeBuildInputs = [ qt5.wrapQtAppsHook ]; + buildInputs = [ ((python3.withPackages (ps: with ps; [ pyqt5 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index bc43e4fd3a47799..6dcea1f74b46f44 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24764,7 +24764,7 @@ with pkgs; # PulseAudio daemons - qpaeq = libsForQt5.callPackage ../servers/pulseaudio/qpaeq.nix { }; + qpaeq = callPackage ../servers/pulseaudio/qpaeq.nix { }; pulseaudioFull = pulseaudio.override { x11Support = true; From ed3aab735aca9c0feefcbf9bb7442e5f6068f1d0 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Thu, 3 Oct 2024 22:46:04 -0300 Subject: [PATCH 8/8] qpaeq: migrate to by-name --- .../pulseaudio/qpaeq.nix => by-name/qp/qpaeq/package.nix} | 0 pkgs/top-level/all-packages.nix | 2 -- 2 files changed, 2 deletions(-) rename pkgs/{servers/pulseaudio/qpaeq.nix => by-name/qp/qpaeq/package.nix} (100%) diff --git a/pkgs/servers/pulseaudio/qpaeq.nix b/pkgs/by-name/qp/qpaeq/package.nix similarity index 100% rename from pkgs/servers/pulseaudio/qpaeq.nix rename to pkgs/by-name/qp/qpaeq/package.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6dcea1f74b46f44..8968960fd965752 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24764,8 +24764,6 @@ with pkgs; # PulseAudio daemons - qpaeq = callPackage ../servers/pulseaudio/qpaeq.nix { }; - pulseaudioFull = pulseaudio.override { x11Support = true; jackaudioSupport = true;