Merge pull request #105362 from gebner/pipewire0137

pipewire: 0.3.16 -> 0.3.17
This commit is contained in:
Gabriel Ebner 2020-12-03 17:15:05 +01:00 committed by GitHub
commit 6e8007341e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 137 additions and 23 deletions

View file

@ -15,7 +15,7 @@ let
# This doesn't work in general because of missing development information.
jack-libs = pkgs.runCommand "jack-libs" {} ''
mkdir -p "$out/lib"
ln -s "${pkgs.pipewire.jack}/lib" "$out/lib/pipewire"
ln -s "${cfg.package.jack}/lib" "$out/lib/pipewire"
'';
in {
@ -28,6 +28,16 @@ in {
services.pipewire = {
enable = mkEnableOption "pipewire service";
package = mkOption {
type = types.package;
default = pkgs.pipewire;
defaultText = "pkgs.pipewire";
example = literalExample "pkgs.pipewire";
description = ''
The pipewire derivation to use.
'';
};
socketActivation = mkOption {
default = true;
type = types.bool;
@ -36,6 +46,32 @@ in {
'';
};
extraConfig = mkOption {
type = types.lines;
default = "";
description = ''
Literal string to append to /etc/pipewire/pipewire.conf.
'';
};
sessionManager = mkOption {
type = types.nullOr types.string;
default = null;
example = literalExample ''"''${pipewire}/bin/pipewire-media-session"'';
description = ''
Path to the pipewire session manager executable.
'';
};
sessionManagerArguments = mkOption {
type = types.listOf types.string;
default = [];
example = literalExample ''[ "-p" "bluez5.msbc-support=true" ]'';
description = ''
Arguments passed to the pipewire session manager.
'';
};
alsa = {
enable = mkEnableOption "ALSA support";
support32Bit = mkEnableOption "32-bit ALSA support on 64-bit systems";
@ -65,38 +101,83 @@ in {
}
];
environment.systemPackages = [ pkgs.pipewire ]
services.pipewire.sessionManager = mkDefault "${cfg.package}/bin/pipewire-media-session";
environment.systemPackages = [ cfg.package ]
++ lib.optional cfg.jack.enable jack-libs;
systemd.packages = [ pkgs.pipewire ]
++ lib.optional cfg.pulse.enable pkgs.pipewire.pulse;
systemd.packages = [ cfg.package ]
++ lib.optional cfg.pulse.enable cfg.package.pulse;
# PipeWire depends on DBUS but doesn't list it. Without this booting
# into a terminal results in the service crashing with an error.
systemd.user.sockets.pipewire.wantedBy = lib.mkIf cfg.socketActivation [ "sockets.target" ];
systemd.user.sockets.pipewire-pulse.wantedBy = lib.mkIf (cfg.socketActivation && cfg.pulse.enable) ["sockets.target"];
systemd.user.services.pipewire.bindsTo = [ "dbus.service" ];
services.udev.packages = [ pkgs.pipewire ];
services.udev.packages = [ cfg.package ];
# If any paths are updated here they must also be updated in the package test.
sound.extraConfig = mkIf cfg.alsa.enable ''
pcm_type.pipewire {
libs.native = ${pkgs.pipewire.lib}/lib/alsa-lib/libasound_module_pcm_pipewire.so ;
${optionalString enable32BitAlsaPlugins
"libs.32Bit = ${pkgs.pkgsi686Linux.pipewire.lib}/lib/alsa-lib/libasound_module_pcm_pipewire.so ;"}
}
pcm.!default {
@func getenv
vars [ PCM ]
default "plug:pipewire"
playback_mode "-1"
capture_mode "-1"
}
'';
environment.etc."alsa/conf.d/49-pipewire-modules.conf" = mkIf cfg.alsa.enable {
text = ''
pcm_type.pipewire {
libs.native = ${cfg.package.lib}/lib/alsa-lib/libasound_module_pcm_pipewire.so ;
${optionalString enable32BitAlsaPlugins
"libs.32Bit = ${pkgs.pkgsi686Linux.pipewire.lib}/lib/alsa-lib/libasound_module_pcm_pipewire.so ;"}
}
ctl_type.pipewire {
libs.native = ${cfg.package.lib}/lib/alsa-lib/libasound_module_ctl_pipewire.so ;
${optionalString enable32BitAlsaPlugins
"libs.32Bit = ${pkgs.pkgsi686Linux.pipewire.lib}/lib/alsa-lib/libasound_module_ctl_pipewire.so ;"}
}
'';
};
environment.etc."alsa/conf.d/50-pipewire.conf" = mkIf cfg.alsa.enable {
source = "${pkgs.pipewire}/share/alsa/alsa.conf.d/50-pipewire.conf";
source = "${cfg.package}/share/alsa/alsa.conf.d/50-pipewire.conf";
};
environment.etc."alsa/conf.d/99-pipewire-default.conf" = mkIf cfg.alsa.enable {
source = "${cfg.package}/share/alsa/alsa.conf.d/99-pipewire-default.conf";
};
environment.sessionVariables.LD_LIBRARY_PATH =
lib.optional cfg.jack.enable "/run/current-system/sw/lib/pipewire";
environment.etc."pipewire/pipewire.conf" = {
# Adapted from src/daemon/pipewire.conf.in
text = ''
set-prop link.max-buffers 16 # version < 3 clients can't handle more
add-spa-lib audio.convert* audioconvert/libspa-audioconvert
add-spa-lib api.alsa.* alsa/libspa-alsa
add-spa-lib api.v4l2.* v4l2/libspa-v4l2
add-spa-lib api.libcamera.* libcamera/libspa-libcamera
add-spa-lib api.bluez5.* bluez5/libspa-bluez5
add-spa-lib api.vulkan.* vulkan/libspa-vulkan
add-spa-lib api.jack.* jack/libspa-jack
add-spa-lib support.* support/libspa-support
load-module libpipewire-module-rtkit # rt.prio=20 rt.time.soft=200000 rt.time.hard=200000
load-module libpipewire-module-protocol-native
load-module libpipewire-module-profiler
load-module libpipewire-module-metadata
load-module libpipewire-module-spa-device-factory
load-module libpipewire-module-spa-node-factory
load-module libpipewire-module-client-node
load-module libpipewire-module-client-device
load-module libpipewire-module-portal
load-module libpipewire-module-access
load-module libpipewire-module-adapter
load-module libpipewire-module-link-factory
load-module libpipewire-module-session-manager
create-object spa-node-factory factory.name=support.node.driver node.name=Dummy priority.driver=8000
exec ${cfg.sessionManager} ${lib.concatStringsSep " " cfg.sessionManagerArguments}
${cfg.extraConfig}
'';
};
environment.etc."pipewire/media-session.d/with-alsa" = mkIf cfg.alsa.enable { text = ""; };
environment.etc."pipewire/media-session.d/with-pulseaudio" = mkIf cfg.pulse.enable { text = ""; };
environment.etc."pipewire/media-session.d/with-jack" = mkIf cfg.jack.enable { text = ""; };
};
}

View file

@ -27,7 +27,7 @@
, bluezSupport ? true, bluez ? null, sbc ? null
, nativeHspSupport ? true
, ofonoSupport ? true
, hsphfpdSupport ? false
, hsphfpdSupport ? true
}:
let
@ -39,7 +39,7 @@ let
in
stdenv.mkDerivation rec {
pname = "pipewire";
version = "0.3.16";
version = "0.3.17";
outputs = [
"out"
@ -56,7 +56,7 @@ stdenv.mkDerivation rec {
owner = "pipewire";
repo = "pipewire";
rev = version;
sha256 = "0ivfx3rbg2iwjdh412zjpk9y5mzw7zh6asv4sji8lq0dzhwbz1qc";
sha256 = "1gzdahji23fsgjycc08h7zzv8filmzdrkyvpkljc881l4cb5l58n";
};
patches = [
@ -66,6 +66,8 @@ stdenv.mkDerivation rec {
./installed-tests-path.patch
# Change the path of the pipewire-pulse binary in the service definition.
./pipewire-pulse-path.patch
# Add flag to specify configuration directory (different from the installation directory).
./pipewire-config-dir.patch
];
nativeBuildInputs = [
@ -106,6 +108,7 @@ stdenv.mkDerivation rec {
"-Dbluez5-backend-native=${mesonBool nativeHspSupport}"
"-Dbluez5-backend-ofono=${mesonBool ofonoSupport}"
"-Dbluez5-backend-hsphfpd=${mesonBool hsphfpdSupport}"
"-Dpipewire_config_dir=/etc/pipewire"
];
FONTCONFIG_FILE = fontsConf; # Fontconfig error: Cannot load default config file

View file

@ -0,0 +1,30 @@
diff --git a/meson.build b/meson.build
index 0073eb13..0ffc6863 100644
--- a/meson.build
+++ b/meson.build
@@ -34,7 +34,10 @@ pipewire_libexecdir = join_paths(prefix, get_option('libexecdir'))
pipewire_localedir = join_paths(prefix, get_option('localedir'))
pipewire_sysconfdir = join_paths(prefix, get_option('sysconfdir'))
-pipewire_configdir = join_paths(pipewire_sysconfdir, 'pipewire')
+pipewire_configdir = get_option('pipewire_config_dir')
+if pipewire_configdir == ''
+ pipewire_configdir = join_paths(pipewire_sysconfdir, 'pipewire')
+endif
modules_install_dir = join_paths(pipewire_libdir, pipewire_name)
if host_machine.system() == 'linux'
diff --git a/meson_options.txt b/meson_options.txt
index 4b9e46b8..8c301459 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -56,6 +56,9 @@ option('pipewire-pulseaudio',
option('libpulse-path',
description: 'Where to install the libpulse.so library',
type: 'string')
+option('pipewire_config_dir',
+ type : 'string',
+ description : 'Directory for pipewire configuration (defaults to /etc/pipewire)')
option('spa-plugins',
description: 'Enable spa plugins integration',
type: 'boolean',