Merge pull request #93725 from nglen/pipewire
This commit is contained in:
commit
3a73543401
@ -5,8 +5,22 @@ with lib;
|
|||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.services.pipewire;
|
cfg = config.services.pipewire;
|
||||||
packages = with pkgs; [ pipewire ];
|
enable32BitAlsaPlugins = cfg.alsa.support32Bit
|
||||||
|
&& pkgs.stdenv.isx86_64
|
||||||
|
&& pkgs.pkgsi686Linux.pipewire != null;
|
||||||
|
|
||||||
|
# The package doesn't output to $out/lib/pipewire directly so that the
|
||||||
|
# overlays can use the outputs to replace the originals in FHS environments.
|
||||||
|
#
|
||||||
|
# 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"
|
||||||
|
'';
|
||||||
|
pulse-libs = pkgs.runCommand "pulse-libs" {} ''
|
||||||
|
mkdir -p "$out/lib"
|
||||||
|
ln -s "${pkgs.pipewire.pulse}/lib" "$out/lib/pipewire"
|
||||||
|
'';
|
||||||
in {
|
in {
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
@ -25,17 +39,67 @@ in {
|
|||||||
Automatically run pipewire when connections are made to the pipewire socket.
|
Automatically run pipewire when connections are made to the pipewire socket.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
alsa = {
|
||||||
|
enable = mkEnableOption "ALSA support";
|
||||||
|
support32Bit = mkEnableOption "32-bit ALSA support on 64-bit systems";
|
||||||
|
};
|
||||||
|
|
||||||
|
jack = {
|
||||||
|
enable = mkEnableOption "JACK audio emulation";
|
||||||
|
};
|
||||||
|
|
||||||
|
pulse = {
|
||||||
|
enable = mkEnableOption "PulseAudio emulation";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
###### implementation
|
###### implementation
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
environment.systemPackages = packages;
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion = cfg.pulse.enable -> !config.hardware.pulseaudio.enable;
|
||||||
|
message = "PipeWire based PulseAudio emulation doesn't use the PulseAudio service";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
assertion = cfg.jack.enable -> !config.services.jack.jackd.enable;
|
||||||
|
message = "PIpeWire based JACK emulation doesn't use the JACK service";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
systemd.packages = packages;
|
environment.systemPackages = [ pkgs.pipewire ]
|
||||||
|
++ lib.optional cfg.jack.enable jack-libs
|
||||||
|
++ lib.optional cfg.pulse.enable pulse-libs;
|
||||||
|
|
||||||
|
systemd.packages = [ pkgs.pipewire ];
|
||||||
|
|
||||||
|
# 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.wantedBy = lib.mkIf cfg.socketActivation [ "sockets.target" ];
|
||||||
};
|
systemd.user.services.pipewire.bindsTo = [ "dbus.service" ];
|
||||||
|
services.udev.packages = [ pkgs.pipewire ];
|
||||||
|
|
||||||
|
# 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/50-pipewire.conf" = mkIf cfg.alsa.enable {
|
||||||
|
source = "${pkgs.pipewire}/share/alsa/alsa.conf.d/50-pipewire.conf";
|
||||||
|
};
|
||||||
|
environment.sessionVariables.LD_LIBRARY_PATH =
|
||||||
|
lib.optional (cfg.jack.enable || cfg.pulse.enable) "/run/current-system/sw/lib/pipewire";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -101,5 +101,6 @@ in
|
|||||||
libxmlb = callInstalledTest ./libxmlb.nix {};
|
libxmlb = callInstalledTest ./libxmlb.nix {};
|
||||||
malcontent = callInstalledTest ./malcontent.nix {};
|
malcontent = callInstalledTest ./malcontent.nix {};
|
||||||
ostree = callInstalledTest ./ostree.nix {};
|
ostree = callInstalledTest ./ostree.nix {};
|
||||||
|
pipewire = callInstalledTest ./pipewire.nix {};
|
||||||
xdg-desktop-portal = callInstalledTest ./xdg-desktop-portal.nix {};
|
xdg-desktop-portal = callInstalledTest ./xdg-desktop-portal.nix {};
|
||||||
}
|
}
|
||||||
|
5
nixos/tests/installed-tests/pipewire.nix
Normal file
5
nixos/tests/installed-tests/pipewire.nix
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{ pkgs, lib, makeInstalledTest, ... }:
|
||||||
|
|
||||||
|
makeInstalledTest {
|
||||||
|
tested = pkgs.pipewire;
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
diff --git a/meson.build b/meson.build
|
||||||
|
index ffee41b4..f3e4ec74 100644
|
||||||
|
--- a/meson.build
|
||||||
|
+++ b/meson.build
|
||||||
|
@@ -53,7 +53,7 @@ endif
|
||||||
|
|
||||||
|
spa_plugindir = join_paths(pipewire_libdir, spa_name)
|
||||||
|
|
||||||
|
-alsadatadir = join_paths(pipewire_datadir, 'alsa-card-profile', 'mixer')
|
||||||
|
+alsadatadir = join_paths(pipewire_libdir, '..', 'share', 'alsa-card-profile', 'mixer')
|
||||||
|
|
||||||
|
pipewire_headers_dir = join_paths(pipewire_name, 'pipewire')
|
||||||
|
|
@ -1,89 +1,146 @@
|
|||||||
{ stdenv
|
{ stdenv
|
||||||
|
, lib
|
||||||
, fetchFromGitLab
|
, fetchFromGitLab
|
||||||
, fetchpatch
|
, fetchpatch
|
||||||
|
, removeReferencesTo
|
||||||
, meson
|
, meson
|
||||||
, ninja
|
, ninja
|
||||||
|
, systemd
|
||||||
, pkgconfig
|
, pkgconfig
|
||||||
, doxygen
|
, doxygen
|
||||||
, graphviz
|
, graphviz
|
||||||
, valgrind
|
, valgrind
|
||||||
, glib
|
, glib
|
||||||
, dbus
|
, dbus
|
||||||
, gst_all_1
|
|
||||||
, alsaLib
|
, alsaLib
|
||||||
, ffmpeg_3
|
|
||||||
, libjack2
|
, libjack2
|
||||||
, udev
|
, udev
|
||||||
, libva
|
, libva
|
||||||
, xorg
|
|
||||||
, sbc
|
|
||||||
, SDL2
|
|
||||||
, libsndfile
|
, libsndfile
|
||||||
, bluez
|
|
||||||
, vulkan-headers
|
, vulkan-headers
|
||||||
, vulkan-loader
|
, vulkan-loader
|
||||||
, libpulseaudio
|
, libpulseaudio
|
||||||
, makeFontsConf
|
, makeFontsConf
|
||||||
|
, callPackage
|
||||||
|
, nixosTests
|
||||||
|
, gstreamerSupport ? true, gst_all_1 ? null
|
||||||
|
, ffmpegSupport ? true, ffmpeg ? null
|
||||||
|
, bluezSupport ? true, bluez ? null, sbc ? null
|
||||||
|
, nativeHspSupport ? true
|
||||||
|
, ofonoSupport ? true
|
||||||
|
, hsphfpdSupport ? false
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
fontsConf = makeFontsConf {
|
fontsConf = makeFontsConf {
|
||||||
fontDirectories = [];
|
fontDirectories = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mesonBool = b: if b then "true" else "false";
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "pipewire";
|
pname = "pipewire";
|
||||||
version = "0.3.7";
|
version = "0.3.13";
|
||||||
|
|
||||||
outputs = [ "out" "lib" "dev" "doc" ];
|
outputs = [
|
||||||
|
"out"
|
||||||
|
"lib"
|
||||||
|
"pulse"
|
||||||
|
"jack"
|
||||||
|
"dev"
|
||||||
|
"doc"
|
||||||
|
"installedTests"
|
||||||
|
];
|
||||||
|
|
||||||
src = fetchFromGitLab {
|
src = fetchFromGitLab {
|
||||||
domain = "gitlab.freedesktop.org";
|
domain = "gitlab.freedesktop.org";
|
||||||
owner = "pipewire";
|
owner = "pipewire";
|
||||||
repo = "pipewire";
|
repo = "pipewire";
|
||||||
rev = version;
|
rev = version;
|
||||||
sha256 = "04l66p0wj553gp2zf3vwwh6jbr1vkf6wrq4za9zlm9dn144am4j2";
|
sha256 = "19j5kmb7iaivkq2agfzncfm2qms41ckqi0ddxvhpc91ihwprdc5w";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
# Break up a dependency cycle between outputs.
|
||||||
|
./alsa-profiles-use-libdir.patch
|
||||||
|
# Move installed tests into their own output.
|
||||||
|
./installed-tests-path.patch
|
||||||
|
|
||||||
|
# TODO Remove this on next update
|
||||||
|
# Fixes rpath referencecs.
|
||||||
|
(fetchpatch {
|
||||||
|
url = "https://gitlab.freedesktop.org/pipewire/pipewire/commit/2e3556fa128b778be62a7ffad5fbe78393035825.diff";
|
||||||
|
sha256 = "039yysb8j1aiqml54rxnaqfmzqz1b6m8sv5w3vz52grvav3kyr1l";
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
doxygen
|
doxygen
|
||||||
graphviz
|
graphviz
|
||||||
meson
|
meson
|
||||||
ninja
|
ninja
|
||||||
pkgconfig
|
pkgconfig
|
||||||
valgrind
|
removeReferencesTo
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
SDL2
|
|
||||||
alsaLib
|
alsaLib
|
||||||
bluez
|
|
||||||
dbus
|
dbus
|
||||||
ffmpeg_3
|
|
||||||
glib
|
glib
|
||||||
gst_all_1.gst-plugins-base
|
|
||||||
gst_all_1.gstreamer
|
|
||||||
libjack2
|
libjack2
|
||||||
libpulseaudio
|
libpulseaudio
|
||||||
libsndfile
|
libsndfile
|
||||||
libva
|
|
||||||
sbc
|
|
||||||
udev
|
udev
|
||||||
vulkan-headers
|
vulkan-headers
|
||||||
vulkan-loader
|
vulkan-loader
|
||||||
xorg.libX11
|
valgrind
|
||||||
];
|
systemd
|
||||||
|
] ++ lib.optionals gstreamerSupport [ gst_all_1.gst-plugins-base gst_all_1.gstreamer ]
|
||||||
|
++ lib.optional ffmpegSupport ffmpeg
|
||||||
|
++ lib.optionals bluezSupport [ bluez sbc ];
|
||||||
|
|
||||||
mesonFlags = [
|
mesonFlags = [
|
||||||
"-Ddocs=true"
|
"-Ddocs=true"
|
||||||
"-Dman=false" # we don't have xmltoman
|
"-Dman=false" # we don't have xmltoman
|
||||||
"-Dgstreamer=true"
|
"-Dexamples=true" # only needed for `pipewire-media-session`
|
||||||
|
"-Dudevrulesdir=lib/udev/rules.d"
|
||||||
|
"-Dinstalled_tests=true"
|
||||||
|
"-Dinstalled_test_prefix=${placeholder "installedTests"}"
|
||||||
|
"-Dlibpulse-path=${placeholder "pulse"}/lib"
|
||||||
|
"-Dlibjack-path=${placeholder "jack"}/lib"
|
||||||
|
"-Dgstreamer=${mesonBool gstreamerSupport}"
|
||||||
|
"-Dffmpeg=${mesonBool ffmpegSupport}"
|
||||||
|
"-Dbluez5=${mesonBool bluezSupport}"
|
||||||
|
"-Dbluez5-backend-native=${mesonBool nativeHspSupport}"
|
||||||
|
"-Dbluez5-backend-ofono=${mesonBool ofonoSupport}"
|
||||||
|
"-Dbluez5-backend-hsphfpd=${mesonBool hsphfpdSupport}"
|
||||||
];
|
];
|
||||||
|
|
||||||
FONTCONFIG_FILE = fontsConf; # Fontconfig error: Cannot load default config file
|
FONTCONFIG_FILE = fontsConf; # Fontconfig error: Cannot load default config file
|
||||||
|
|
||||||
doCheck = true;
|
doCheck = true;
|
||||||
|
|
||||||
|
# Pulseaudio asserts lead to dev references.
|
||||||
|
# TODO This should be fixed in the pulseaudio sources instead.
|
||||||
|
preFixup = ''
|
||||||
|
remove-references-to -t ${libpulseaudio.dev} "$(readlink -f $pulse/lib/libpulse.so)"
|
||||||
|
'';
|
||||||
|
|
||||||
|
passthru.tests = {
|
||||||
|
installedTests = nixosTests.installed-tests.pipewire;
|
||||||
|
|
||||||
|
# This ensures that all the paths used by the NixOS module are found.
|
||||||
|
test-paths = callPackage ./test-paths.nix {
|
||||||
|
paths-out = [
|
||||||
|
"share/alsa/alsa.conf.d/50-pipewire.conf"
|
||||||
|
];
|
||||||
|
paths-lib = [
|
||||||
|
"lib/alsa-lib/libasound_module_pcm_pipewire.so"
|
||||||
|
"share/alsa-card-profile/mixer"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
description = "Server and user space API to deal with multimedia pipelines";
|
description = "Server and user space API to deal with multimedia pipelines";
|
||||||
homepage = "https://pipewire.org/";
|
homepage = "https://pipewire.org/";
|
||||||
|
@ -0,0 +1,29 @@
|
|||||||
|
diff --git a/meson.build b/meson.build
|
||||||
|
index ffee41b4..bab6f019 100644
|
||||||
|
--- a/meson.build
|
||||||
|
+++ b/meson.build
|
||||||
|
@@ -318,8 +318,8 @@ alsa_dep = (get_option('pipewire-alsa')
|
||||||
|
? dependency('alsa', version : '>=1.1.7')
|
||||||
|
: dependency('', required: false))
|
||||||
|
|
||||||
|
-installed_tests_metadir = join_paths(pipewire_datadir, 'installed-tests', pipewire_name)
|
||||||
|
-installed_tests_execdir = join_paths(pipewire_libexecdir, 'installed-tests', pipewire_name)
|
||||||
|
+installed_tests_metadir = join_paths(get_option('installed_test_prefix'), 'share', 'installed-tests', pipewire_name)
|
||||||
|
+installed_tests_execdir = join_paths(get_option('installed_test_prefix'), 'libexec', 'installed-tests', pipewire_name)
|
||||||
|
installed_tests_enabled = get_option('installed_tests')
|
||||||
|
installed_tests_template = files('template.test.in')
|
||||||
|
|
||||||
|
diff --git a/meson_options.txt b/meson_options.txt
|
||||||
|
index f03033c3..32df6c53 100644
|
||||||
|
--- a/meson_options.txt
|
||||||
|
+++ b/meson_options.txt
|
||||||
|
@@ -18,6 +18,9 @@ option('installed_tests',
|
||||||
|
description: 'Install manual and automated test executables',
|
||||||
|
type: 'boolean',
|
||||||
|
value: false)
|
||||||
|
+option('installed_test_prefix',
|
||||||
|
+ description: 'Prefix for installed tests',
|
||||||
|
+ type: 'string')
|
||||||
|
option('gstreamer',
|
||||||
|
description: 'Build GStreamer plugins',
|
||||||
|
type: 'boolean',
|
23
pkgs/development/libraries/pipewire/test-paths.nix
Normal file
23
pkgs/development/libraries/pipewire/test-paths.nix
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{ lib, runCommand, pipewire, paths-out, paths-lib }:
|
||||||
|
|
||||||
|
let
|
||||||
|
check-path = output: path: ''
|
||||||
|
if [[ ! -f "${output}/${path}" && ! -d "${output}/${path}" ]]; then
|
||||||
|
printf "Missing: %s\n" "${output}/${path}" | tee -a $out
|
||||||
|
error=error
|
||||||
|
else
|
||||||
|
printf "Found: %s\n" "${output}/${path}" | tee -a $out
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
|
||||||
|
check-output = output: lib.concatMapStringsSep "\n" (check-path output);
|
||||||
|
in runCommand "pipewire-test-paths" { } ''
|
||||||
|
touch $out
|
||||||
|
|
||||||
|
${check-output pipewire.lib paths-lib}
|
||||||
|
${check-output pipewire paths-out}
|
||||||
|
|
||||||
|
if [[ -n "$error" ]]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
''
|
Loading…
x
Reference in New Issue
Block a user