pipewire: move pipewire-media-session to its own output and module
This commit is contained in:
parent
c41cf93b67
commit
0fd29f6ce0
@ -318,7 +318,8 @@
|
|||||||
./services/desktops/gsignond.nix
|
./services/desktops/gsignond.nix
|
||||||
./services/desktops/gvfs.nix
|
./services/desktops/gvfs.nix
|
||||||
./services/desktops/malcontent.nix
|
./services/desktops/malcontent.nix
|
||||||
./services/desktops/pipewire.nix
|
./services/desktops/pipewire/pipewire.nix
|
||||||
|
./services/desktops/pipewire/pipewire-media-session.nix
|
||||||
./services/desktops/gnome3/at-spi2-core.nix
|
./services/desktops/gnome3/at-spi2-core.nix
|
||||||
./services/desktops/gnome3/chrome-gnome-shell.nix
|
./services/desktops/gnome3/chrome-gnome-shell.nix
|
||||||
./services/desktops/gnome3/evolution-data-server.nix
|
./services/desktops/gnome3/evolution-data-server.nix
|
||||||
|
@ -0,0 +1,336 @@
|
|||||||
|
# pipewire example session manager.
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.services.pipewire.pwms;
|
||||||
|
enable32BitAlsaPlugins = cfg.alsa.support32Bit
|
||||||
|
&& pkgs.stdenv.isx86_64
|
||||||
|
&& pkgs.pkgsi686Linux.pipewire != null;
|
||||||
|
|
||||||
|
# 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 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)}")
|
||||||
|
attrs
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
toSPAJSON = attrs: lib.concatStringsSep "\n" (mkSPAKeyValue attrs);
|
||||||
|
in {
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
maintainers = teams.freedesktop.members;
|
||||||
|
};
|
||||||
|
|
||||||
|
###### interface
|
||||||
|
options = {
|
||||||
|
services.pipewire.pwms = {
|
||||||
|
enable = mkEnableOption "Example pipewire session manager";
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
default = pkgs.pipewire.mediaSession;
|
||||||
|
example = literalExample "pkgs.pipewire.mediaSession";
|
||||||
|
description = ''
|
||||||
|
The pipewire-media-session derivation to use.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
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"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
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
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
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
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
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
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
###### implementation
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
environment.systemPackages = [ cfg.package ];
|
||||||
|
services.pipewire.sessionManagerExecutable = "${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/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/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/with-jack" = mkIf config.services.pipewire.jack.enable { text = ""; };
|
||||||
|
};
|
||||||
|
}
|
@ -35,40 +35,6 @@ let
|
|||||||
);
|
);
|
||||||
|
|
||||||
toSPAJSON = attrs: lib.concatStringsSep "\n" (mkSPAKeyValue attrs);
|
toSPAJSON = attrs: lib.concatStringsSep "\n" (mkSPAKeyValue attrs);
|
||||||
originalEtc =
|
|
||||||
let
|
|
||||||
mkEtcFile = n: nameValuePair n { source = "${cfg.package}/etc/${n}"; };
|
|
||||||
in listToAttrs (map mkEtcFile cfg.package.filesInstalledToEtc);
|
|
||||||
|
|
||||||
customEtc = {
|
|
||||||
# If any paths are updated here they must also be updated in the package test.
|
|
||||||
"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 ;"}
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
"alsa/conf.d/50-pipewire.conf" = mkIf cfg.alsa.enable {
|
|
||||||
source = "${cfg.package}/share/alsa/alsa.conf.d/50-pipewire.conf";
|
|
||||||
};
|
|
||||||
"alsa/conf.d/99-pipewire-default.conf" = mkIf cfg.alsa.enable {
|
|
||||||
source = "${cfg.package}/share/alsa/alsa.conf.d/99-pipewire-default.conf";
|
|
||||||
};
|
|
||||||
|
|
||||||
"pipewire/media-session.d/with-alsa" = mkIf cfg.alsa.enable { text = ""; };
|
|
||||||
"pipewire/media-session.d/with-pulseaudio" = mkIf cfg.pulse.enable { text = ""; };
|
|
||||||
"pipewire/media-session.d/with-jack" = mkIf cfg.jack.enable { text = ""; };
|
|
||||||
|
|
||||||
"pipewire/pipewire.conf" = { text = toSPAJSON cfg.config; };
|
|
||||||
};
|
|
||||||
in {
|
in {
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
@ -174,7 +140,7 @@ in {
|
|||||||
libpipewire-module-portal = "null";
|
libpipewire-module-portal = "null";
|
||||||
libpipewire-module-access = {
|
libpipewire-module-access = {
|
||||||
args.access = {
|
args.access = {
|
||||||
allowed = ["${builtins.unsafeDiscardStringContext cfg.sessionManager}"];
|
allowed = ["${builtins.unsafeDiscardStringContext cfg.sessionManagerExecutable}"];
|
||||||
rejected = [];
|
rejected = [];
|
||||||
restricted = [];
|
restricted = [];
|
||||||
force = "flatpak";
|
force = "flatpak";
|
||||||
@ -200,22 +166,22 @@ in {
|
|||||||
# Execute the given program. This is usually used to start the
|
# Execute the given program. This is usually used to start the
|
||||||
# session manager. run the session manager with -h for options
|
# session manager. run the session manager with -h for options
|
||||||
#
|
#
|
||||||
"${builtins.unsafeDiscardStringContext cfg.sessionManager}" = { args = "\"${lib.concatStringsSep " " cfg.sessionManagerArguments}\""; };
|
"${builtins.unsafeDiscardStringContext cfg.sessionManagerExecutable}" = { args = "\"${lib.concatStringsSep " " cfg.sessionManagerArguments}\""; };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
sessionManager = mkOption {
|
sessionManagerExecutable = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "${cfg.package}/bin/pipewire-media-session";
|
default = "";
|
||||||
example = literalExample ''"\$\{pipewire\}/bin/pipewire-media-session"'';
|
example = literalExample ''${pkgs.pipewire.mediaSession}/bin/pipewire-media-session'';
|
||||||
description = ''
|
description = ''
|
||||||
Path to the pipewire session manager executable.
|
Path to the session manager executable.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
sessionManagerArguments = mkOption {
|
sessionManagerArguments = mkOption {
|
||||||
type = types.listOf types.string;
|
type = types.listOf types.str;
|
||||||
default = [];
|
default = [];
|
||||||
example = literalExample ''["-p" "bluez5.msbc-support=true"]'';
|
example = literalExample ''["-p" "bluez5.msbc-support=true"]'';
|
||||||
description = ''
|
description = ''
|
||||||
@ -223,27 +189,6 @@ in {
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
sessionManagerEtcFiles = mkOption {
|
|
||||||
type = types.attrs;
|
|
||||||
default = {};
|
|
||||||
example = literalExample ''
|
|
||||||
"pipewire/pipewire.conf" = {
|
|
||||||
# REPLACES THE FULL CONTENTS OF pipewire.conf, only showing a fragment here.
|
|
||||||
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
|
|
||||||
#
|
|
||||||
"/run/current-system/sw/bin/pipewire-media-session" = { args = "\"\""; };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
'';
|
|
||||||
description = ''
|
|
||||||
Advanced. Replace or add config files to /etc/
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
alsa = {
|
alsa = {
|
||||||
enable = mkEnableOption "ALSA support";
|
enable = mkEnableOption "ALSA support";
|
||||||
support32Bit = mkEnableOption "32-bit ALSA support on 64-bit systems";
|
support32Bit = mkEnableOption "32-bit ALSA support on 64-bit systems";
|
||||||
@ -286,12 +231,35 @@ in {
|
|||||||
systemd.user.services.pipewire.bindsTo = [ "dbus.service" ];
|
systemd.user.services.pipewire.bindsTo = [ "dbus.service" ];
|
||||||
services.udev.packages = [ cfg.package ];
|
services.udev.packages = [ cfg.package ];
|
||||||
|
|
||||||
|
# If any paths are updated here they must also be updated in the package test.
|
||||||
|
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 = "${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 =
|
environment.sessionVariables.LD_LIBRARY_PATH =
|
||||||
lib.optional cfg.jack.enable "/run/current-system/sw/lib/pipewire";
|
lib.optional cfg.jack.enable "/run/current-system/sw/lib/pipewire";
|
||||||
|
|
||||||
# https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/464#note_723554
|
# https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/464#note_723554
|
||||||
systemd.user.services.pipewire.environment."PIPEWIRE_LINK_PASSIVE" = "1";
|
systemd.user.services.pipewire.environment = {
|
||||||
|
"PIPEWIRE_LINK_PASSIVE" = "1";
|
||||||
environment.etc = originalEtc // customEtc // cfg.sessionManagerEtcFiles;
|
"PIPEWIRE_CONFIG_FILE" = pkgs.writeText "pipewire.conf" (toSPAJSON cfg.config);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -23,8 +23,6 @@
|
|||||||
, makeFontsConf
|
, makeFontsConf
|
||||||
, callPackage
|
, callPackage
|
||||||
, nixosTests
|
, nixosTests
|
||||||
, python3
|
|
||||||
, runCommand
|
|
||||||
, withMediaSession ? true
|
, withMediaSession ? true
|
||||||
, gstreamerSupport ? true, gst_all_1 ? null
|
, gstreamerSupport ? true, gst_all_1 ? null
|
||||||
, ffmpegSupport ? true, ffmpeg ? null
|
, ffmpegSupport ? true, ffmpeg ? null
|
||||||
@ -40,13 +38,6 @@ let
|
|||||||
fontDirectories = [];
|
fontDirectories = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
runPythonCommand = name: buildCommandPython: runCommand name {
|
|
||||||
nativeBuildInputs = [ python3 ];
|
|
||||||
inherit buildCommandPython;
|
|
||||||
} ''
|
|
||||||
exec python3 -c "$buildCommandPython"
|
|
||||||
'';
|
|
||||||
|
|
||||||
mesonBool = b: if b then "true" else "false";
|
mesonBool = b: if b then "true" else "false";
|
||||||
|
|
||||||
self = stdenv.mkDerivation rec {
|
self = stdenv.mkDerivation rec {
|
||||||
@ -60,6 +51,7 @@ let
|
|||||||
"jack"
|
"jack"
|
||||||
"dev"
|
"dev"
|
||||||
"doc"
|
"doc"
|
||||||
|
"mediaSession"
|
||||||
"installedTests"
|
"installedTests"
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -133,21 +125,10 @@ let
|
|||||||
moveToOutput "share/systemd/user/pipewire-pulse.*" "$pulse"
|
moveToOutput "share/systemd/user/pipewire-pulse.*" "$pulse"
|
||||||
moveToOutput "lib/systemd/user/pipewire-pulse.*" "$pulse"
|
moveToOutput "lib/systemd/user/pipewire-pulse.*" "$pulse"
|
||||||
moveToOutput "bin/pipewire-pulse" "$pulse"
|
moveToOutput "bin/pipewire-pulse" "$pulse"
|
||||||
|
moveToOutput "bin/pipewire-media-session" "$mediaSession"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
filesInstalledToEtc = [
|
|
||||||
"pipewire/pipewire.conf"
|
|
||||||
] ++ lib.optionals withMediaSession [
|
|
||||||
"pipewire/media-session.d/alsa-monitor.conf"
|
|
||||||
"pipewire/media-session.d/bluez-monitor.conf"
|
|
||||||
"pipewire/media-session.d/media-session.conf"
|
|
||||||
"pipewire/media-session.d/v4l2-monitor.conf"
|
|
||||||
];
|
|
||||||
|
|
||||||
tests = let
|
|
||||||
listToPy = list: "[${lib.concatMapStringsSep ", " (f: "'${f}'") list}]";
|
|
||||||
in {
|
|
||||||
installedTests = nixosTests.installed-tests.pipewire;
|
installedTests = nixosTests.installed-tests.pipewire;
|
||||||
|
|
||||||
# This ensures that all the paths used by the NixOS module are found.
|
# This ensures that all the paths used by the NixOS module are found.
|
||||||
@ -160,22 +141,6 @@ let
|
|||||||
"share/alsa-card-profile/mixer"
|
"share/alsa-card-profile/mixer"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
passthruMatches = runPythonCommand "fwupd-test-passthru-matches" ''
|
|
||||||
import itertools
|
|
||||||
import configparser
|
|
||||||
import os
|
|
||||||
import pathlib
|
|
||||||
etc = '${self}/etc'
|
|
||||||
package_etc = set(itertools.chain.from_iterable([[os.path.relpath(os.path.join(prefix, file), etc) for file in files] for (prefix, dirs, files) in os.walk(etc)]))
|
|
||||||
passthru_etc = set(${listToPy passthru.filesInstalledToEtc})
|
|
||||||
assert len(package_etc - passthru_etc) == 0, f'pipewire package contains the following paths in /etc that are not listed in passthru.filesInstalledToEtc: {package_etc - passthru_etc}'
|
|
||||||
assert len(passthru_etc - package_etc) == 0, f'pipewire package lists the following paths in passthru.filesInstalledToEtc that are not contained in /etc: {passthru_etc - package_etc}'
|
|
||||||
config = configparser.RawConfigParser()
|
|
||||||
config.read('${self}/etc/fwupd/daemon.conf')
|
|
||||||
pathlib.Path(os.getenv('out')).touch()
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user