2022-02-04 04:54:00 +00:00
|
|
|
{ lib, stdenv, fetchurl, fetchpatch, pkg-config
|
2019-09-13 17:20:36 +01:00
|
|
|
, libsndfile, libtool, makeWrapper, perlPackages
|
2021-06-10 03:57:09 +01:00
|
|
|
, xorg, libcap, alsa-lib, glib, dconf
|
2015-06-04 11:57:12 +01:00
|
|
|
, avahi, libjack2, libasyncns, lirc, dbus
|
|
|
|
, sbc, bluez5, udev, openssl, fftwFloat
|
2020-05-15 13:37:59 +01:00
|
|
|
, soxr, speexdsp, systemd, webrtc-audio-processing
|
2022-04-09 11:39:09 +01:00
|
|
|
, gst_all_1
|
|
|
|
, check, meson, ninja, m4, wrapGAppsHook
|
2008-12-19 14:56:37 +00:00
|
|
|
|
2015-06-04 11:57:12 +01:00
|
|
|
, x11Support ? false
|
|
|
|
|
|
|
|
, useSystemd ? true
|
|
|
|
|
|
|
|
, # Whether to support the JACK sound system as a backend.
|
|
|
|
jackaudioSupport ? false
|
|
|
|
|
|
|
|
, # Whether to build the OSS wrapper ("padsp").
|
|
|
|
ossWrapper ? true
|
|
|
|
|
|
|
|
, airtunesSupport ? false
|
|
|
|
|
2020-03-30 13:58:30 +01:00
|
|
|
, bluetoothSupport ? true
|
2022-04-19 17:40:03 +01:00
|
|
|
, advancedBluetoothCodecs ? false
|
2015-06-04 11:57:12 +01:00
|
|
|
|
|
|
|
, remoteControlSupport ? false
|
|
|
|
|
|
|
|
, zeroconfSupport ? false
|
|
|
|
|
|
|
|
, # Whether to build only the library.
|
|
|
|
libOnly ? false
|
2017-01-04 19:21:48 +00:00
|
|
|
|
2021-12-27 18:32:48 +00:00
|
|
|
, AudioUnit, Cocoa, CoreServices
|
2015-04-26 05:27:41 +01:00
|
|
|
}:
|
|
|
|
|
2008-12-19 14:56:37 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2021-12-03 18:02:52 +00:00
|
|
|
pname = "${if libOnly then "lib" else ""}pulseaudio";
|
2022-02-04 04:54:00 +00:00
|
|
|
version = "15.0";
|
2008-12-19 14:56:37 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2015-04-26 05:27:41 +01:00
|
|
|
url = "http://freedesktop.org/software/pulseaudio/releases/pulseaudio-${version}.tar.xz";
|
2022-02-04 04:54:00 +00:00
|
|
|
sha256 = "pAuIejupjMJpdusRvbZhOYjxRbGQJNG2VVxqA8nLoaA=";
|
2008-12-19 14:56:37 +00:00
|
|
|
};
|
|
|
|
|
2022-02-04 04:54:00 +00:00
|
|
|
patches = [
|
|
|
|
# Install sysconfdir files inside of the nix store,
|
|
|
|
# but use a conventional runtime sysconfdir outside the store
|
|
|
|
./add-option-for-installation-sysconfdir.patch
|
|
|
|
];
|
|
|
|
|
2016-08-29 01:30:01 +01:00
|
|
|
outputs = [ "out" "dev" ];
|
2015-10-08 10:51:10 +01:00
|
|
|
|
2022-02-04 04:54:00 +00:00
|
|
|
nativeBuildInputs = [ pkg-config meson ninja makeWrapper perlPackages.perl perlPackages.XMLParser m4 ]
|
2022-04-09 11:39:09 +01:00
|
|
|
++ lib.optionals stdenv.isLinux [ glib ]
|
|
|
|
# gstreamer plugin discovery requires wrapping
|
2022-04-19 17:40:03 +01:00
|
|
|
++ lib.optional (bluetoothSupport && advancedBluetoothCodecs) wrapGAppsHook;
|
2015-06-04 11:57:12 +01:00
|
|
|
|
2015-06-07 12:06:54 +01:00
|
|
|
propagatedBuildInputs =
|
|
|
|
lib.optionals stdenv.isLinux [ libcap ];
|
|
|
|
|
2015-06-04 11:57:12 +01:00
|
|
|
buildInputs =
|
2022-02-04 04:54:00 +00:00
|
|
|
[ libtool libsndfile soxr speexdsp fftwFloat check ]
|
2015-10-13 13:33:08 +01:00
|
|
|
++ lib.optionals stdenv.isLinux [ glib dbus ]
|
2021-12-27 18:32:48 +00:00
|
|
|
++ lib.optionals stdenv.isDarwin [ AudioUnit Cocoa CoreServices ]
|
2015-06-04 11:57:12 +01:00
|
|
|
++ lib.optionals (!libOnly) (
|
|
|
|
[ libasyncns webrtc-audio-processing ]
|
|
|
|
++ lib.optional jackaudioSupport libjack2
|
2015-09-15 10:26:18 +01:00
|
|
|
++ lib.optionals x11Support [ xorg.xlibsWrapper xorg.libXtst xorg.libXi ]
|
2015-06-04 11:57:12 +01:00
|
|
|
++ lib.optional useSystemd systemd
|
2021-06-10 03:57:09 +01:00
|
|
|
++ lib.optionals stdenv.isLinux [ alsa-lib udev ]
|
2015-06-04 11:57:12 +01:00
|
|
|
++ lib.optional airtunesSupport openssl
|
2022-04-19 17:40:03 +01:00
|
|
|
++ lib.optionals bluetoothSupport [ bluez5 sbc ]
|
2022-04-09 11:39:09 +01:00
|
|
|
# aptX and LDAC codecs are in gst-plugins-bad so far, rtpldacpay is in -good
|
2022-04-19 17:40:03 +01:00
|
|
|
++ lib.optionals (bluetoothSupport && advancedBluetoothCodecs) (builtins.attrValues { inherit (gst_all_1) gst-plugins-bad gst-plugins-good gst-plugins-base gstreamer; })
|
2015-06-04 11:57:12 +01:00
|
|
|
++ lib.optional remoteControlSupport lirc
|
|
|
|
++ lib.optional zeroconfSupport avahi
|
2019-06-10 10:15:40 +01:00
|
|
|
);
|
|
|
|
|
2022-02-04 04:54:00 +00:00
|
|
|
mesonFlags = [
|
|
|
|
"-Dalsa=${if !libOnly then "enabled" else "disabled"}"
|
|
|
|
"-Dasyncns=${if !libOnly then "enabled" else "disabled"}"
|
|
|
|
"-Davahi=${if zeroconfSupport then "enabled" else "disabled"}"
|
|
|
|
"-Dbluez5=${if !libOnly then "enabled" else "disabled"}"
|
2022-04-09 11:39:09 +01:00
|
|
|
# advanced bluetooth audio codecs are provided by gstreamer
|
2022-04-19 17:40:03 +01:00
|
|
|
"-Dbluez5-gstreamer=${if (!libOnly && bluetoothSupport && advancedBluetoothCodecs) then "enabled" else "disabled"}"
|
2022-02-04 04:54:00 +00:00
|
|
|
"-Ddatabase=simple"
|
|
|
|
"-Ddoxygen=false"
|
|
|
|
"-Delogind=disabled"
|
|
|
|
# gsettings does not support cross-compilation
|
|
|
|
"-Dgsettings=${if stdenv.buildPlatform == stdenv.hostPlatform then "enabled" else "disabled"}"
|
|
|
|
"-Dgstreamer=disabled"
|
|
|
|
"-Dgtk=disabled"
|
|
|
|
"-Djack=${if jackaudioSupport && !libOnly then "enabled" else "disabled"}"
|
|
|
|
"-Dlirc=${if remoteControlSupport then "enabled" else "disabled"}"
|
|
|
|
"-Dopenssl=${if airtunesSupport then "enabled" else "disabled"}"
|
|
|
|
"-Dorc=disabled"
|
|
|
|
"-Dsystemd=${if useSystemd && !libOnly then "enabled" else "disabled"}"
|
|
|
|
"-Dtcpwrap=disabled"
|
|
|
|
"-Dudev=${if !libOnly then "enabled" else "disabled"}"
|
|
|
|
"-Dvalgrind=disabled"
|
|
|
|
"-Dwebrtc-aec=${if !libOnly then "enabled" else "disabled"}"
|
|
|
|
"-Dx11=${if x11Support then "enabled" else "disabled"}"
|
|
|
|
|
|
|
|
"-Dlocalstatedir=/var"
|
|
|
|
"-Dsysconfdir=/etc"
|
|
|
|
"-Dsysconfdir_install=${placeholder "out"}/etc"
|
|
|
|
"-Dudevrulesdir=${placeholder "out"}/lib/udev/rules.d"
|
|
|
|
]
|
|
|
|
++ lib.optional (stdenv.isLinux && useSystemd) "-Dsystemduserunitdir=${placeholder "out"}/lib/systemd/user"
|
|
|
|
;
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
preCheck = ''
|
|
|
|
export HOME=$(mktemp -d)
|
2009-01-19 20:22:54 +00:00
|
|
|
'';
|
|
|
|
|
2015-06-04 11:57:12 +01:00
|
|
|
postInstall = lib.optionalString libOnly ''
|
2021-05-30 01:05:22 +01:00
|
|
|
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,etc,lib/pulse-*}
|
2015-10-08 10:51:10 +01:00
|
|
|
''
|
2019-12-27 03:51:28 +00:00
|
|
|
+ ''
|
|
|
|
moveToOutput lib/cmake "$dev"
|
|
|
|
rm -f $out/bin/qpaeq # this is packaged by the "qpaeq" package now, because of missing deps
|
|
|
|
'';
|
2013-09-06 02:47:49 +01:00
|
|
|
|
2021-01-01 21:11:29 +00:00
|
|
|
preFixup = lib.optionalString (stdenv.isLinux && (stdenv.hostPlatform == stdenv.buildPlatform)) ''
|
2018-05-09 19:21:55 +01:00
|
|
|
wrapProgram $out/libexec/pulse/gsettings-helper \
|
2021-12-03 18:02:52 +00:00
|
|
|
--prefix XDG_DATA_DIRS : "$out/share/gsettings-schemas/${pname}-${version}" \
|
2019-11-30 23:11:47 +00:00
|
|
|
--prefix GIO_EXTRA_MODULES : "${lib.getLib dconf}/lib/gio/modules"
|
2018-05-09 19:21:55 +01:00
|
|
|
'';
|
|
|
|
|
2020-10-26 01:18:26 +00:00
|
|
|
passthru = {
|
|
|
|
pulseDir = "lib/pulse-" + lib.versions.majorMinor version;
|
|
|
|
};
|
|
|
|
|
2015-06-04 11:57:12 +01:00
|
|
|
meta = {
|
2014-08-24 15:21:08 +01:00
|
|
|
description = "Sound server for POSIX and Win32 systems";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "http://www.pulseaudio.org/";
|
2017-04-29 05:24:34 +01:00
|
|
|
license = lib.licenses.lgpl2Plus;
|
2019-01-26 10:01:09 +00:00
|
|
|
maintainers = with lib.maintainers; [ lovek323 ];
|
2015-06-04 11:57:12 +01:00
|
|
|
platforms = lib.platforms.unix;
|
2008-12-19 14:56:37 +00:00
|
|
|
|
|
|
|
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.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|