pipewire-media-session: init at 0.4.0

This commit is contained in:
Jan Solanti 2021-10-25 16:45:52 +03:00
parent c750019f9d
commit b65f74fd98
9 changed files with 124 additions and 18 deletions

View file

@ -13,10 +13,10 @@ let
# Use upstream config files passed through spa-json-dump as the base
# Patched here as necessary for them to work with this module
defaults = {
alsa-monitor = (builtins.fromJSON (builtins.readFile ./alsa-monitor.conf.json));
bluez-monitor = (builtins.fromJSON (builtins.readFile ./bluez-monitor.conf.json));
media-session = (builtins.fromJSON (builtins.readFile ./media-session.conf.json));
v4l2-monitor = (builtins.fromJSON (builtins.readFile ./v4l2-monitor.conf.json));
alsa-monitor = (builtins.fromJSON (builtins.readFile ./media-session/alsa-monitor.conf.json));
bluez-monitor = (builtins.fromJSON (builtins.readFile ./media-session/bluez-monitor.conf.json));
media-session = (builtins.fromJSON (builtins.readFile ./media-session/media-session.conf.json));
v4l2-monitor = (builtins.fromJSON (builtins.readFile ./media-session/v4l2-monitor.conf.json));
};
configs = {
@ -43,8 +43,8 @@ in {
package = mkOption {
type = types.package;
default = pkgs.pipewire.mediaSession;
defaultText = literalExpression "pkgs.pipewire.mediaSession";
default = pkgs.pipewire-media-session;
defaultText = literalExpression "pkgs.pipewire-media-session";
description = ''
The pipewire-media-session derivation to use.
'';
@ -55,7 +55,7 @@ in {
type = json.type;
description = ''
Configuration for the media session core. For details see
https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/${cfg.package.version}/src/daemon/media-session.d/media-session.conf
https://gitlab.freedesktop.org/pipewire/media-session/-/blob/${cfg.package.version}/src/daemon/media-session.d/media-session.conf
'';
default = {};
};
@ -64,7 +64,7 @@ in {
type = json.type;
description = ''
Configuration for the alsa monitor. For details see
https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/${cfg.package.version}/src/daemon/media-session.d/alsa-monitor.conf
https://gitlab.freedesktop.org/pipewire/media-session/-/blob/${cfg.package.version}/src/daemon/media-session.d/alsa-monitor.conf
'';
default = {};
};
@ -73,7 +73,7 @@ in {
type = json.type;
description = ''
Configuration for the bluez5 monitor. For details see
https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/${cfg.package.version}/src/daemon/media-session.d/bluez-monitor.conf
https://gitlab.freedesktop.org/pipewire/media-session/-/blob/${cfg.package.version}/src/daemon/media-session.d/bluez-monitor.conf
'';
default = {};
};
@ -82,7 +82,7 @@ in {
type = json.type;
description = ''
Configuration for the V4L2 monitor. For details see
https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/${cfg.package.version}/src/daemon/media-session.d/v4l2-monitor.conf
https://gitlab.freedesktop.org/pipewire/media-session/-/blob/${cfg.package.version}/src/daemon/media-session.d/v4l2-monitor.conf
'';
default = {};
};

View file

@ -0,0 +1,93 @@
{ stdenv
, lib
, fetchFromGitLab
, meson
, ninja
, pkg-config
, doxygen
, graphviz
, systemd
, pipewire
, glib
, dbus
, alsa-lib
, callPackage
}:
let
mesonEnable = b: if b then "enabled" else "disabled";
mesonList = l: "[" + lib.concatStringsSep "," l + "]";
self = stdenv.mkDerivation rec {
pname = "pipewire-media-session";
version = "0.4.0";
src = fetchFromGitLab {
domain = "gitlab.freedesktop.org";
owner = "pipewire";
repo = "media-session";
rev = version;
sha256 = "sha256-zhOvBlG7DuQkJ+ZZBhBhfKwk+bbLljpt3w4JlK3cJLk=";
};
nativeBuildInputs = [
doxygen
graphviz
meson
ninja
pkg-config
];
buildInputs = [
alsa-lib
dbus
glib
pipewire
systemd
];
mesonFlags = [
"-Ddocs=enabled"
# We generate these empty files from the nixos module, don't bother installing them
"-Dwith-module-sets=[]"
];
postUnpack = ''
patchShebangs source/doc/input-filter-h.sh
patchShebangs source/doc/input-filter.sh
'';
postInstall = ''
mkdir $out/nix-support
cd $out/share/pipewire/media-session.d
for f in *.conf; do
echo "Generating JSON from $f"
${pipewire}/bin/spa-json-dump "$f" > "$out/nix-support/$f.json"
done
'';
passthru = {
tests = {
test-paths = callPackage ./test-paths.nix { package = self; } {
paths-out = [
"nix-support/alsa-monitor.conf.json"
"nix-support/bluez-monitor.conf.json"
"nix-support/media-session.conf.json"
"nix-support/v4l2-monitor.conf.json"
];
paths-lib = [];
};
};
};
meta = with lib; {
description = "Example session manager for PipeWire";
homepage = "https://pipewire.org";
license = licenses.mit;
platforms = platforms.linux;
maintainers = with maintainers; [ jtojnar kranzes ];
};
};
in
self

View file

@ -1,4 +1,4 @@
{ lib, runCommand, pipewire, paths-out, paths-lib, paths-out-media-session }:
{ lib, runCommand, package, paths-out, paths-lib }:
let
check-path = output: path: ''
@ -14,9 +14,8 @@ let
in runCommand "pipewire-test-paths" { } ''
touch $out
${check-output pipewire.mediaSession paths-out-media-session}
${check-output pipewire.lib paths-lib}
${check-output pipewire paths-out}
${check-output package.lib paths-lib}
${check-output package paths-out}
if [[ -n "$error" ]]; then
exit 1

View file

@ -11,14 +11,27 @@ NIXPKGS_ROOT="$(git rev-parse --show-toplevel)"
cd "$NIXPKGS_ROOT"
nix-update pipewire
outputs=$(nix-build . -A pipewire -A pipewire.mediaSession)
outputs=$(nix-build . -A pipewire)
for p in $outputs; do
conf_files=$(find "$p/nix-support/etc/pipewire/" -name '*.conf.json')
conf_files=$(find "$p/nix-support/" -name '*.conf.json')
for c in $conf_files; do
file_name=$(basename "$c")
if [[ ! -e "nixos/modules/services/desktops/pipewire/$file_name" ]]; then
if [[ ! -e "nixos/modules/services/desktops/pipewire/daemon/$file_name" ]]; then
echo "New file $file_name found! Add it to the module config and passthru tests!"
fi
install -m 0644 "$c" "nixos/modules/services/desktops/pipewire/"
install -m 0644 "$c" "nixos/modules/services/desktops/pipewire/daemon/"
done
done
nix-update pipewire-media-session
outputs=$(nix-build . -A pipewire-media-session)
for p in $outputs; do
conf_files=$(find "$p/nix-support/" -name '*.conf.json')
for c in $conf_files; do
file_name=$(basename "$c")
if [[ ! -e "nixos/modules/services/desktops/pipewire/media-session/$file_name" ]]; then
echo "New file $file_name found! Add it to the module config and passthru tests!"
fi
install -m 0644 "$c" "nixos/modules/services/desktops/pipewire/media-session/"
done
done

View file

@ -13464,6 +13464,7 @@ with pkgs;
pipenv = callPackage ../development/tools/pipenv {};
pipewire = callPackage ../development/libraries/pipewire {};
pipewire-media-session = callPackage ../development/libraries/pipewire/media-session.nix {};
pipewire_0_2 = callPackage ../development/libraries/pipewire/0.2.nix {};
pyradio = callPackage ../applications/audio/pyradio {};