pipewire: 0.3.21 -> 0.3.22

This commit is contained in:
Jan Solanti 2021-02-25 16:22:40 +02:00 committed by Jan Solanti
parent 96e9a7c30b
commit 78bfbdd77a
14 changed files with 577 additions and 372 deletions

View File

@ -0,0 +1,48 @@
{
"properties": {},
"rules": [
{
"actions": {
"update-props": {
"api": {
"acp": {
"auto-port": false,
"auto-profile": false
},
"alsa": {
"use-acp": true
}
}
}
},
"matches": [
{
"device": {
"name": "~alsa_card.*"
}
}
]
},
{
"actions": {
"update-props": {
"node": {
"pause-on-idle": false
}
}
},
"matches": [
{
"node": {
"name": "~alsa_input.*"
}
},
{
"node": {
"name": "~alsa_output.*"
}
}
]
}
]
}

View File

@ -0,0 +1,38 @@
{
"properties": {},
"rules": [
{
"actions": {
"update-props": {}
},
"matches": [
{
"device": {
"name": "~bluez_card.*"
}
}
]
},
{
"actions": {
"update-props": {
"node": {
"pause-on-idle": false
}
}
},
"matches": [
{
"node": {
"name": "~bluez_input.*"
}
},
{
"node": {
"name": "~bluez_output.*"
}
}
]
}
]
}

View File

@ -0,0 +1,22 @@
{
"context.properties": {},
"context.spa-libs": {
"audio.convert.*": "audioconvert/libspa-audioconvert",
"support.*": "support/libspa-support"
},
"context.modules": {
"libpipewire-module-rtkit": {
"args": {},
"flags": [
"ifexists",
"nofail"
]
},
"libpipewire-module-protocol-native": null,
"libpipewire-module-client-node": null,
"libpipewire-module-client-device": null,
"libpipewire-module-adapter": null,
"libpipewire-module-metadata": null,
"libpipewire-module-session-manager": null
}
}

View File

@ -0,0 +1,15 @@
{
"context.properties": {},
"context.spa-libs": {
"audio.convert.*": "audioconvert/libspa-audioconvert",
"support.*": "support/libspa-support"
},
"context.modules": {
"libpipewire-module-protocol-native": null,
"libpipewire-module-client-node": null,
"libpipewire-module-client-device": null,
"libpipewire-module-adapter": null,
"libpipewire-module-metadata": null,
"libpipewire-module-session-manager": null
}
}

View File

@ -0,0 +1,19 @@
{
"context.properties": {},
"context.spa-libs": {
"support.*": "support/libspa-support"
},
"context.modules": {
"libpipewire-module-rtkit": {
"args": {},
"flags": [
"ifexists",
"nofail"
]
},
"libpipewire-module-protocol-native": null,
"libpipewire-module-client-node": null,
"libpipewire-module-metadata": null
},
"jack.properties": {}
}

View File

@ -0,0 +1,53 @@
{
"context.modules": {
"libpipewire-module-protocol-native": null,
"libpipewire-module-adapter": null,
"libpipewire-module-client-device": null,
"libpipewire-module-client-node": null,
"libpipewire-module-metadata": null,
"libpipewire-module-rtkit": {
"args": {},
"flags": [
"ifexists",
"nofail"
]
},
"libpipewire-module-session-manager": null
},
"context.properties": {},
"context.spa-libs": {
"api.alsa.*": "alsa/libspa-alsa",
"api.bluez5.*": "bluez5/libspa-bluez5",
"api.libcamera.*": "libcamera/libspa-libcamera",
"api.v4l2.*": "v4l2/libspa-v4l2"
},
"session.modules": {
"default": [
"flatpak",
"portal",
"v4l2",
"suspend-node",
"policy-node"
],
"with-alsa": [
"with-audio"
],
"with-audio": [
"metadata",
"default-nodes",
"default-profile",
"default-routes",
"alsa-seq",
"alsa-monitor"
],
"with-jack": [
"with-audio"
],
"with-pulseaudio": [
"with-audio",
"bluez5",
"restore-stream",
"streams-follow-default"
]
}
}

View File

@ -9,18 +9,36 @@ let
&& pkgs.stdenv.isx86_64
&& pkgs.pkgsi686Linux.pipewire != null;
prioritizeNativeProtocol = {
"context.modules" = {
"libpipewire-module-protocol-native" = {
_priority = -100;
_content = null;
};
};
};
# 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 = recursiveUpdate (builtins.fromJSON (builtins.readFile ./media-session.conf.json)) prioritizeNativeProtocol;
v4l2-monitor = (builtins.fromJSON (builtins.readFile ./v4l2-monitor.conf.json));
};
# Helpers for generating the pipewire JSON config file
mkSPAValueString = v:
if builtins.isList v then "[${lib.concatMapStringsSep " " mkSPAValueString v}]"
else if lib.types.attrs.check v then
"{${lib.concatStringsSep " " (mkSPAKeyValue v)}}"
else if builtins.isString v then "\"${lib.generators.mkValueStringDefault { } v}\""
else lib.generators.mkValueStringDefault { } v;
mkSPAKeyValue = attrs: map (def: def.content) (
lib.sortProperties
(
lib.mapAttrsToList
(k: v: lib.mkOrder (v._priority or 1000) "${lib.escape [ "=" ] k} = ${mkSPAValueString (v._content or v)}")
(k: v: lib.mkOrder (v._priority or 1000) "${lib.escape [ "=" ":" ] k} = ${mkSPAValueString (v._content or v)}")
attrs
)
);
@ -51,272 +69,41 @@ in {
'';
};
config = mkOption {
type = types.attrs;
description = ''
Configuration for the media session core.
'';
default = {
# media-session config file
properties = {
# Properties to configure the session and some
# modules
#mem.mlock-all = false;
#context.profile.modules = "default,rtkit";
};
spa-libs = {
# Mapping from factory name to library.
"api.bluez5.*" = "bluez5/libspa-bluez5";
"api.alsa.*" = "alsa/libspa-alsa";
"api.v4l2.*" = "v4l2/libspa-v4l2";
"api.libcamera.*" = "libcamera/libspa-libcamera";
};
modules = {
# These are the modules that are enabled when a file with
# the key name is found in the media-session.d config directory.
# the default bundle is always enabled.
default = [
"flatpak" # manages flatpak access
"portal" # manage portal permissions
"v4l2" # video for linux udev detection
#"libcamera" # libcamera udev detection
"suspend-node" # suspend inactive nodes
"policy-node" # configure and link nodes
#"metadata" # export metadata API
#"default-nodes" # restore default nodes
#"default-profile" # restore default profiles
#"default-routes" # restore default route
#"streams-follow-default" # move streams when default changes
#"alsa-seq" # alsa seq midi support
#"alsa-monitor" # alsa udev detection
#"bluez5" # bluetooth support
#"restore-stream" # restore stream settings
];
"with-audio" = [
"metadata"
"default-nodes"
"default-profile"
"default-routes"
"alsa-seq"
"alsa-monitor"
];
"with-alsa" = [
"with-audio"
];
"with-jack" = [
"with-audio"
];
"with-pulseaudio" = [
"with-audio"
"bluez5"
"restore-stream"
"streams-follow-default"
];
};
config = {
media-session = mkOption {
type = types.attrs;
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
'';
default = {};
};
};
alsaMonitorConfig = mkOption {
type = types.attrs;
description = ''
Configuration for the alsa monitor.
'';
default = {
# alsa-monitor config file
properties = {
#alsa.jack-device = true
};
rules = [
# an array of matches/actions to evaluate
{
# rules for matching a device or node. It is an array of
# properties that all need to match the regexp. If any of the
# matches work, the actions are executed for the object.
matches = [
{
# this matches all cards
device.name = "~alsa_card.*";
}
];
actions = {
# actions can update properties on the matched object.
update-props = {
api.alsa.use-acp = true;
#api.alsa.use-ucm = true;
#api.alsa.soft-mixer = false;
#api.alsa.ignore-dB = false;
#device.profile-set = "profileset-name";
#device.profile = "default profile name";
api.acp.auto-profile = false;
api.acp.auto-port = false;
#device.nick = "My Device";
};
};
}
{
matches = [
{
# matches all sinks
node.name = "~alsa_input.*";
}
{
# matches all sources
node.name = "~alsa_output.*";
}
];
actions = {
update-props = {
#node.nick = "My Node";
#node.nick = null;
#priority.driver = 100;
#priority.session = 100;
#node.pause-on-idle = false;
#resample.quality = 4;
#channelmix.normalize = false;
#channelmix.mix-lfe = false;
#audio.channels = 2;
#audio.format = "S16LE";
#audio.rate = 44100;
#audio.position = "FL,FR";
#api.alsa.period-size = 1024;
#api.alsa.headroom = 0;
#api.alsa.disable-mmap = false;
#api.alsa.disable-batch = false;
};
};
}
];
alsa-monitor = mkOption {
type = types.attrs;
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
'';
default = {};
};
};
bluezMonitorConfig = mkOption {
type = types.attrs;
description = ''
Configuration for the bluez5 monitor.
'';
default = {
# bluez-monitor config file
properties = {
# msbc is not expected to work on all headset + adapter combinations.
#bluez5.msbc-support = true;
#bluez5.sbc-xq-support = true;
# Enabled headset roles (default: [ hsp_hs hfp_ag ]), this
# property only applies to native backend. Currently some headsets
# (Sony WH-1000XM3) are not working with both hsp_ag and hfp_ag
# enabled, disable either hsp_ag or hfp_ag to work around it.
#
# Supported headset roles: hsp_hs (HSP Headset),
# hsp_ag (HSP Audio Gateway),
# hfp_ag (HFP Audio Gateway)
#bluez5.headset-roles = [ "hsp_hs" "hsp_ag" "hfp_ag" ];
# Enabled A2DP codecs (default: all)
#bluez5.codecs = [ "sbc" "aac" "ldac" "aptx" "aptx_hd" ];
};
rules = [
# an array of matches/actions to evaluate
{
# rules for matching a device or node. It is an array of
# properties that all need to match the regexp. If any of the
# matches work, the actions are executed for the object.
matches = [
{
# this matches all cards
device.name = "~bluez_card.*";
}
];
actions = {
# actions can update properties on the matched object.
update-props = {
#device.nick = "My Device";
};
};
}
{
matches = [
{
# matches all sinks
node.name = "~bluez_input.*";
}
{
# matches all sources
node.name = "~bluez_output.*";
}
];
actions = {
update-props = {
#node.nick = "My Node"
#node.nick = null;
#priority.driver = 100;
#priority.session = 100;
#node.pause-on-idle = false;
#resample.quality = 4;
#channelmix.normalize = false;
#channelmix.mix-lfe = false;
};
};
}
];
bluez-monitor = mkOption {
type = types.attrs;
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
'';
default = {};
};
};
v4l2MonitorConfig = mkOption {
type = types.attrs;
description = ''
Configuration for the V4L2 monitor.
'';
default = {
# v4l2-monitor config file
properties = {
};
rules = [
# an array of matches/actions to evaluate
{
# rules for matching a device or node. It is an array of
# properties that all need to match the regexp. If any of the
# matches work, the actions are executed for the object.
matches = [
{
# this matches all devices
device.name = "~v4l2_device.*";
}
];
actions = {
# actions can update properties on the matched object.
update-props = {
#device.nick = "My Device";
};
};
}
{
matches = [
{
# matches all sinks
node.name = "~v4l2_input.*";
}
{
# matches all sources
node.name = "~v4l2_output.*";
}
];
actions = {
update-props = {
#node.nick = "My Node";
#node.nick = null;
#priority.driver = 100;
#priority.session = 100;
#node.pause-on-idle = true;
};
};
}
];
v4l2-monitor = mkOption {
type = types.attrs;
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
'';
default = {};
};
};
};
@ -325,16 +112,16 @@ in {
###### implementation
config = mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
services.pipewire.sessionManagerExecutable = "${cfg.package}/bin/pipewire-media-session";
services.pipewire.sessionManagerExecutable = builtins.unsafeDiscardStringContext "${cfg.package}/bin/pipewire-media-session";
environment.etc."pipewire/media-session.d/media-session.conf" = { text = toSPAJSON cfg.config; };
environment.etc."pipewire/media-session.d/v4l2-monitor.conf" = { text = toSPAJSON cfg.v4l2MonitorConfig; };
environment.etc."pipewire/media-session.d/media-session.conf" = { text = toSPAJSON (recursiveUpdate defaults.media-session cfg.config.media-session); };
environment.etc."pipewire/media-session.d/v4l2-monitor.conf" = { text = toSPAJSON (recursiveUpdate defaults.v4l2-monitor cfg.config.v4l2-monitor); };
environment.etc."pipewire/media-session.d/with-alsa" = mkIf config.services.pipewire.alsa.enable { text = ""; };
environment.etc."pipewire/media-session.d/alsa-monitor.conf" = mkIf config.services.pipewire.alsa.enable { text = toSPAJSON cfg.alsaMonitorConfig; };
environment.etc."pipewire/media-session.d/alsa-monitor.conf" = mkIf config.services.pipewire.alsa.enable { text = toSPAJSON (recursiveUpdate defaults.alsa-monitor cfg.config.alsa-monitor); };
environment.etc."pipewire/media-session.d/with-pulseaudio" = mkIf config.services.pipewire.pulse.enable { text = ""; };
environment.etc."pipewire/media-session.d/bluez-monitor.conf" = mkIf config.services.pipewire.pulse.enable { text = toSPAJSON cfg.bluezMonitorConfig; };
environment.etc."pipewire/media-session.d/bluez-monitor.conf" = mkIf config.services.pipewire.pulse.enable { text = toSPAJSON (recursiveUpdate defaults.bluez-monitor cfg.config.bluez-monitor); };
environment.etc."pipewire/media-session.d/with-jack" = mkIf config.services.pipewire.jack.enable { text = ""; };
};

View File

@ -0,0 +1,27 @@
{
"context.properties": {},
"context.spa-libs": {
"audio.convert.*": "audioconvert/libspa-audioconvert",
"support.*": "support/libspa-support"
},
"context.modules": {
"libpipewire-module-rtkit": {
"args": {},
"flags": [
"ifexists",
"nofail"
]
},
"libpipewire-module-protocol-native": null,
"libpipewire-module-client-node": null,
"libpipewire-module-adapter": null,
"libpipewire-module-metadata": null,
"libpipewire-module-protocol-pulse": {
"args": {
"server.address": [
"unix:native"
]
}
}
}
}

View File

@ -0,0 +1,54 @@
{
"context.properties": {
"link.max-buffers": 16,
"core.daemon": true,
"core.name": "pipewire-0"
},
"context.spa-libs": {
"audio.convert.*": "audioconvert/libspa-audioconvert",
"api.alsa.*": "alsa/libspa-alsa",
"api.v4l2.*": "v4l2/libspa-v4l2",
"api.libcamera.*": "libcamera/libspa-libcamera",
"api.bluez5.*": "bluez5/libspa-bluez5",
"api.vulkan.*": "vulkan/libspa-vulkan",
"api.jack.*": "jack/libspa-jack",
"support.*": "support/libspa-support"
},
"context.modules": {
"libpipewire-module-rtkit": {
"args": {},
"flags": [
"ifexists",
"nofail"
]
},
"libpipewire-module-protocol-native": null,
"libpipewire-module-profiler": null,
"libpipewire-module-metadata": null,
"libpipewire-module-spa-device-factory": null,
"libpipewire-module-spa-node-factory": null,
"libpipewire-module-client-node": null,
"libpipewire-module-client-device": null,
"libpipewire-module-portal": null,
"libpipewire-module-access": {
"args": {}
},
"libpipewire-module-adapter": null,
"libpipewire-module-link-factory": null,
"libpipewire-module-session-manager": null
},
"context.objects": {
"spa-node-factory": {
"args": {
"factory.name": "support.node.driver",
"node.name": "Dummy-Driver",
"priority.driver": 8000
}
}
},
"context.exec": {
"/nix/store/1q65a09arb7r4sdfz657p473kn3lqknk-pipewire-0.3.22/bin/pipewire-media-session": {
"args": ""
}
}
}

View File

@ -18,11 +18,40 @@ let
ln -s "${cfg.package.jack}/lib" "$out/lib/pipewire"
'';
prioritizeNativeProtocol = {
"context.modules" = {
"libpipewire-module-protocol-native" = {
_priority = -100;
_content = null;
};
};
};
sessionManagerInvocation = {
"context.exec" = {
"${cfg.sessionManagerExecutable}" = {
args = "${lib.concatStringsSep " " cfg.sessionManagerArguments}";
};
};
};
# Use upstream config files passed through spa-json-dump as the base
# Patched here as necessary for them to work with this module
defaults = {
client = recursiveUpdate (builtins.fromJSON (builtins.readFile ./client.conf.json)) prioritizeNativeProtocol;
client-rt = recursiveUpdate (builtins.fromJSON (builtins.readFile ./client-rt.conf.json)) prioritizeNativeProtocol;
jack = recursiveUpdate (builtins.fromJSON (builtins.readFile ./jack.conf.json)) prioritizeNativeProtocol;
# Remove session manager invocation from the upstream generated file, it points to the wrong path
pipewire = recursiveUpdate ((removeAttrs (builtins.fromJSON (builtins.readFile ./pipewire.conf.json)) ["context.exec"]) // sessionManagerInvocation) prioritizeNativeProtocol;
pipewire-pulse = recursiveUpdate (builtins.fromJSON (builtins.readFile ./pipewire-pulse.conf.json)) prioritizeNativeProtocol;
};
# Helpers for generating the pipewire JSON config file
mkSPAValueString = v:
if builtins.isList v then "[${lib.concatMapStringsSep " " mkSPAValueString v}]"
else if lib.types.attrs.check v then
"{${lib.concatStringsSep " " (mkSPAKeyValue v)}}"
else if builtins.isString v then "\"${lib.generators.mkValueStringDefault { } v}\""
else lib.generators.mkValueStringDefault { } v;
mkSPAKeyValue = attrs: map (def: def.content) (
@ -64,110 +93,50 @@ in {
'';
};
config = mkOption {
type = types.attrs;
description = ''
Configuration for the pipewire daemon.
'';
default = {
properties = {
## set-prop is used to configure properties in the system
#
# "library.name.system" = "support/libspa-support";
# "context.data-loop.library.name.system" = "support/libspa-support";
"link.max-buffers" = 16; # version < 3 clients can't handle more than 16
#"mem.allow-mlock" = false;
#"mem.mlock-all" = true;
## https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/src/pipewire/pipewire.h#L93
#"log.level" = 2; # 5 is trace, which is verbose as hell, default is 2 which is warnings, 4 is debug output, 3 is info
config = {
client = mkOption {
type = types.attrs;
default = {};
description = ''
Configuration for pipewire clients. For details see
https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/${cfg.package.version}/src/daemon/client.conf.in
'';
};
## Properties for the DSP configuration
#
#"default.clock.rate" = 48000;
#"default.clock.quantum" = 1024;
#"default.clock.min-quantum" = 32;
#"default.clock.max-quantum" = 8192;
#"default.video.width" = 640;
#"default.video.height" = 480;
#"default.video.rate.num" = 25;
#"default.video.rate.denom" = 1;
};
client-rt = mkOption {
type = types.attrs;
default = {};
description = ''
Configuration for realtime pipewire clients. For details see
https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/${cfg.package.version}/src/daemon/client-rt.conf.in
'';
};
spa-libs = {
## add-spa-lib <factory-name regex> <library-name>
#
# used to find spa factory names. It maps an spa factory name
# regular expression to a library name that should contain
# that factory.
#
"audio.convert*" = "audioconvert/libspa-audioconvert";
"api.alsa.*" = "alsa/libspa-alsa";
"api.v4l2.*" = "v4l2/libspa-v4l2";
"api.libcamera.*" = "libcamera/libspa-libcamera";
"api.bluez5.*" = "bluez5/libspa-bluez5";
"api.vulkan.*" = "vulkan/libspa-vulkan";
"api.jack.*" = "jack/libspa-jack";
"support.*" = "support/libspa-support";
# "videotestsrc" = "videotestsrc/libspa-videotestsrc";
# "audiotestsrc" = "audiotestsrc/libspa-audiotestsrc";
};
jack = mkOption {
type = types.attrs;
default = {};
description = ''
Configuration for the pipewire daemon's jack module. For details see
https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/${cfg.package.version}/src/daemon/jack.conf.in
'';
};
modules = {
## <module-name> = { [args = "<key>=<value> ..."]
# [flags = ifexists] }
# [flags = [ifexists]|[nofail]}
#
# Loads a module with the given parameters.
# If ifexists is given, the module is ignoed when it is not found.
# If nofail is given, module initialization failures are ignored.
#
libpipewire-module-rtkit = {
args = {
#rt.prio = 20;
#rt.time.soft = 200000;
#rt.time.hard = 200000;
#nice.level = -11;
};
flags = "ifexists|nofail";
};
libpipewire-module-protocol-native = { _priority = -100; _content = "null"; };
libpipewire-module-profiler = "null";
libpipewire-module-metadata = "null";
libpipewire-module-spa-device-factory = "null";
libpipewire-module-spa-node-factory = "null";
libpipewire-module-client-node = "null";
libpipewire-module-client-device = "null";
libpipewire-module-portal = "null";
libpipewire-module-access = {
args.access = {
allowed = ["${builtins.unsafeDiscardStringContext cfg.sessionManagerExecutable}"];
rejected = [];
restricted = [];
force = "flatpak";
};
};
libpipewire-module-adapter = "null";
libpipewire-module-link-factory = "null";
libpipewire-module-session-manager = "null";
};
pipewire = mkOption {
type = types.attrs;
default = {};
description = ''
Configuration for the pipewire daemon. For details see
https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/${cfg.package.version}/src/daemon/pipewire.conf.in
'';
};
objects = {
## create-object [-nofail] <factory-name> [<key>=<value> ...]
#
# Creates an object from a PipeWire factory with the given parameters.
# If -nofail is given, errors are ignored (and no object is created)
#
};
exec = {
## exec <program-name>
#
# Execute the given program. This is usually used to start the
# session manager. run the session manager with -h for options
#
"${builtins.unsafeDiscardStringContext cfg.sessionManagerExecutable}" = { args = "\"${lib.concatStringsSep " " cfg.sessionManagerArguments}\""; };
};
pipewire-pulse = mkOption {
type = types.attrs;
default = {};
description = ''
Configuration for the pipewire-pulse daemon. For details see
https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/${cfg.package.version}/src/daemon/pipewire-pulse.conf.in
'';
};
};
@ -253,13 +222,16 @@ in {
source = "${cfg.package}/share/alsa/alsa.conf.d/99-pipewire-default.conf";
};
environment.etc."pipewire/client.conf" = { text = toSPAJSON (recursiveUpdate defaults.client cfg.config.client); };
environment.etc."pipewire/client-rt.conf" = { text = toSPAJSON (recursiveUpdate defaults.client-rt cfg.config.client-rt); };
environment.etc."pipewire/jack.conf" = { text = toSPAJSON (recursiveUpdate defaults.jack cfg.config.jack); };
environment.etc."pipewire/pipewire.conf" = { text = toSPAJSON (recursiveUpdate defaults.pipewire cfg.config.pipewire); };
environment.etc."pipewire/pipewire-pulse.conf" = { text = toSPAJSON (recursiveUpdate defaults.pipewire-pulse cfg.config.pipewire-pulse); };
environment.sessionVariables.LD_LIBRARY_PATH =
lib.optional cfg.jack.enable "/run/current-system/sw/lib/pipewire";
# https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/464#note_723554
systemd.user.services.pipewire.environment = {
"PIPEWIRE_LINK_PASSIVE" = "1";
"PIPEWIRE_CONFIG_FILE" = pkgs.writeText "pipewire.conf" (toSPAJSON cfg.config);
};
systemd.user.services.pipewire.environment."PIPEWIRE_LINK_PASSIVE" = "1";
};
}

View File

@ -0,0 +1,38 @@
{
"properties": {},
"rules": [
{
"actions": {
"update-props": {}
},
"matches": [
{
"device": {
"name": "~v4l2_device.*"
}
}
]
},
{
"actions": {
"update-props": {
"node": {
"pause-on-idle": false
}
}
},
"matches": [
{
"node": {
"name": "~v4l2_input.*"
}
},
{
"node": {
"name": "~v4l2_output.*"
}
}
]
}
]
}

View File

@ -17,6 +17,7 @@
, udev
, libva
, libsndfile
, SDL2
, vulkan-headers
, vulkan-loader
, ncurses
@ -42,7 +43,7 @@ let
self = stdenv.mkDerivation rec {
pname = "pipewire";
version = "0.3.21";
version = "0.3.22";
outputs = [
"out"
@ -60,7 +61,7 @@ let
owner = "pipewire";
repo = "pipewire";
rev = version;
hash = "sha256:2YJzPTMPIoQQeNja3F53SD4gtpdSlbD/i77hBWiQfuQ=";
hash = "sha256:6SEOUivyehccVR5zt79Qw2rjN2KcO5x3TEejXVxRlvs=";
};
patches = [
@ -72,6 +73,94 @@ let
./pipewire-pulse-path.patch
# Add flag to specify configuration directory (different from the installation directory).
./pipewire-config-dir.patch
# Various quality of life improvements that didn't make it into 0.3.22
(fetchpatch {
name = "0001-bluez5-include-a2dp-codec-profiles-in-route-profiles.patch";
url = "https://gitlab.freedesktop.org/pipewire/pipewire/commit/df1dbee687c819095a6fddce3b24943f9ac47dbc.patch";
sha256 = "sha256-MesteaIcfKMr53TdObEfqRyKEgalB1GEWpsTexawPgg=";
})
(fetchpatch {
name = "0001-pulse-server-don-t-use-the-pending_sample-after-free.patch";
url = "https://gitlab.freedesktop.org/pipewire/pipewire/commit/72acd752f68a35c40641262be1c69014170d0734.patch";
sha256 = "sha256-F3+aVfOYH4SLTwWhdIKuNUo85NBoS+67vkUrcsaldSs=";
})
./patches-0.3.22/0005-fix-some-warnings.patch
(fetchpatch {
name = "0006-spa-escape-double-quotes.patch";
url = "https://gitlab.freedesktop.org/pipewire/pipewire/commit/6a219092818a7a7e357441256d8070ae77ac2d3a.patch";
sha256 = "sha256-NUjxOSthe3Jw2LUrO11QnTWTx0PQNBJkQSv3ux58jZw=";
})
(fetchpatch {
name = "0009-bluez5-volumes-need-to-be-distributed-to-all-channel.patch";
url = "https://gitlab.freedesktop.org/pipewire/pipewire/commit/8c5ca000ef7fddd9be9cd2211d880736e97b956d.patch";
sha256 = "sha256-9NhbYSXlNOYmoPg8tj561QHisaD216fBG7ccNIfoZ64=";
})
(fetchpatch {
name = "0010-bluez5-set-the-right-volumes-on-the-node.patch";
url = "https://gitlab.freedesktop.org/pipewire/pipewire/commit/930b411075a5c1b0d9ddcfe7dd2dbfdc27baab90.patch";
sha256 = "sha256-xsL92H8wSrBzoxLtraCVxPZdXWTwj+j+O2XlfhcJ7IQ=";
})
(fetchpatch {
name = "0011-bluez5-backend-native-Check-volume-values.patch";
url = "https://gitlab.freedesktop.org/pipewire/pipewire/commit/7a5a94470453e0cbd3a087b1be2aa8960ff43c07.patch";
sha256 = "sha256-HKWcfkwMmmlEB7l+SETJDsUZ2eLggcodtbNOpqY/wWY=";
})
(fetchpatch {
name = "0012-media-session-don-t-switch-to-pro-audio-by-default.patch";
url = "https://gitlab.freedesktop.org/pipewire/pipewire/commit/84fc63e60168e2c2f43875423899b4ae3bd89a7b.patch";
sha256 = "sha256-tZwgBMZS+HJd0lrRji3aevbP/yJfvWYK60KMpfiFrOY=";
})
(fetchpatch {
name = "0013-audioconvert-keep-better-track-of-param-changes.patch";
url = "https://gitlab.freedesktop.org/pipewire/pipewire/commit/44919c83fc51aa5e1a22c903e841897c1b4d274c.patch";
sha256 = "sha256-DIZUfEjUCaK4yY3k7/KLHv1igTKz6Ek4QbWECs1sr9E=";
})
(fetchpatch {
name = "0018-pulse-server-print-encoding-name-in-format_info.patch";
url = "https://gitlab.freedesktop.org/pipewire/pipewire/commit/4b591df145afa316e8e047764f9b98fc10cbacd9.patch";
sha256 = "sha256-Dr6w6tI4R+6wrl0rVk9Eifw3YleuisVmXzsv+H2jtXc=";
})
(fetchpatch {
name = "0019-pulse-server-handle-unsupported-formats.patch";
url = "https://gitlab.freedesktop.org/pipewire/pipewire/commit/fcf00b3d352d931446a384a768b999520662b599.patch";
sha256 = "sha256-kQ3vRoojLVTOJi8V4eODkZC8agsla2PjKf6sJnm/1C4=";
})
(fetchpatch {
name = "0021-jack-handle-client-init-error-with-EIO.patch";
url = "https://gitlab.freedesktop.org/pipewire/pipewire/commit/715a3a642a4f1c1f624e0a9dc0394b1819b69f93.patch";
sha256 = "sha256-DglHcH9pHSWuVxZuLt8J+gDmxOaQSoiThVE2wePfH1I=";
})
(fetchpatch {
name = "0022-pw-cli-always-output-to-stdout.patch";
url = "https://gitlab.freedesktop.org/pipewire/pipewire/commit/91875c1fd8ece6b1b94130c50304b715654f8681.patch";
sha256 = "sha256-3Sf/Tr39bdBihq/CFborm7GcBWtSvqO3KtRtFBcHcmc=";
})
(fetchpatch {
name = "0024-policy-node-don-t-crash-without-metadata.patch";
url = "https://gitlab.freedesktop.org/pipewire/pipewire/commit/3673265ae20d7b59e89cad6c5238c232796731b2.patch";
sha256 = "sha256-YRdh1gqBYqa+sbSfHuJZ+Xc6w4QTOOpt/fppFNxsj+8=";
})
(fetchpatch {
name = "0025-bluez5-route-shouldn-t-list-a2dp-profiles-when-not-c.patch";
url = "https://gitlab.freedesktop.org/pipewire/pipewire/commit/a5dc2493dfccfc168cef01162f38f90e986b8af4.patch";
sha256 = "sha256-zu7zqHIMOcxLAhvelKNWDB+804x+ocCo5FAMUSSOnVo=";
})
(fetchpatch {
name = "0027-jack-apply-PIPEWIRE_PROPS-after-reading-config.patch";
url = "https://gitlab.freedesktop.org/pipewire/pipewire/commit/149319819aa5d4e39770c35a0c00f6c2963e2bf3.patch";
sha256 = "sha256-SwKQJkg8NIL9D0GAL6hnEgi8kvuToo1bpDm52adtKxA=";
})
(fetchpatch {
name = "0038-jack-add-config-option-to-shorten-and-filter-names.patch";
url = "https://gitlab.freedesktop.org/pipewire/pipewire/commit/d54da879bf5f9fa9009e1ab27e8d52eae3141764.patch";
sha256 = "sha256-iYOmZTWNODHYWpYGfRTQhBLV1HeFOUvHN3Ta0f1ZS8M=";
})
(fetchpatch {
name = "0046-jack-fix-names-of-our-ports.patch";
url = "https://gitlab.freedesktop.org/pipewire/pipewire/commit/e340a44a357e4550e169bc8825c6aa8b4ceb76db.patch";
sha256 = "sha256-rfv2IzgYyNB1s51eRFhJzZCyso6PIEj2qg9fpPpOZ5Q=";
})
];
nativeBuildInputs = [
@ -93,6 +182,7 @@ let
vulkan-headers
vulkan-loader
valgrind
SDL2
systemd
] ++ lib.optionals gstreamerSupport [ gst_all_1.gst-plugins-base gst_all_1.gstreamer ]
++ lib.optional ffmpegSupport ffmpeg
@ -122,10 +212,17 @@ let
doCheck = true;
postInstall = ''
mkdir -p $out/nix-support/etc/pipewire/media-session.
for f in etc/pipewire/*.conf; do $out/bin/spa-json-dump "$f" > "$out/nix-support/$f.json"; done
moveToOutput "share/systemd/user/pipewire-pulse.*" "$pulse"
moveToOutput "lib/systemd/user/pipewire-pulse.*" "$pulse"
moveToOutput "bin/pipewire-pulse" "$pulse"
mkdir -p $mediaSession/nix-support/etc/pipewire/media-session.d
for f in etc/pipewire/media-session.d/*.conf; do $out/bin/spa-json-dump "$f" > "$mediaSession/nix-support/$f.json"; done
moveToOutput "bin/pipewire-media-session" "$mediaSession"
moveToOutput "etc/pipewire/media-session.d/*.conf" "$mediaSession"
'';
passthru.tests = {
@ -135,6 +232,17 @@ let
test-paths = callPackage ./test-paths.nix {
paths-out = [
"share/alsa/alsa.conf.d/50-pipewire.conf"
"nix-support/etc/pipewire/client.conf.json"
"nix-support/etc/pipewire/client-rt.conf.json"
"nix-support/etc/pipewire/jack.conf.json"
"nix-support/etc/pipewire/pipewire.conf.json"
"nix-support/etc/pipewire/pipewire-pulse.conf.json"
];
paths-out-media-session = [
"nix-support/etc/pipewire/media-session.d/alsa-monitor.conf.json"
"nix-support/etc/pipewire/media-session.d/bluez-monitor.conf.json"
"nix-support/etc/pipewire/media-session.d/media-session.conf.json"
"nix-support/etc/pipewire/media-session.d/v4l2-monitor.conf.json"
];
paths-lib = [
"lib/alsa-lib/libasound_module_pcm_pipewire.so"

View File

@ -0,0 +1,23 @@
From 63a3811aa76802e9585e04cf12bf8de617442105 Mon Sep 17 00:00:00 2001
From: Wim Taymans <wtaymans@redhat.com>
Date: Thu, 18 Feb 2021 12:42:06 +0100
Subject: [PATCH 05/30] fix some warnings
---
spa/plugins/bluez5/backend-native.c | 2 +-
src/examples/media-session/default-routes.c | 18 +++++++++++++-----
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/spa/plugins/bluez5/backend-native.c b/spa/plugins/bluez5/backend-native.c
index 4df714088..b4d4e5edf 100644
--- a/spa/plugins/bluez5/backend-native.c
+++ b/spa/plugins/bluez5/backend-native.c
@@ -437,7 +437,7 @@ static bool rfcomm_hfp_hf(struct spa_source *source, char* buf)
struct rfcomm *rfcomm = source->data;
struct spa_bt_backend *backend = rfcomm->backend;
unsigned int features;
- unsigned int gain;
+ unsigned int SPA_UNUSED gain;
unsigned int selected_codec;
char* token;
char separators[] = "\r\n:";

View File

@ -14,6 +14,7 @@ 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}