uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
|
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"context.properties": {
|
||||
"log.level": 0
|
||||
},
|
||||
"context.spa-libs": {
|
||||
"audio.convert.*": "audioconvert/libspa-audioconvert",
|
||||
"support.*": "support/libspa-support"
|
||||
},
|
||||
"context.modules": [
|
||||
{
|
||||
"name": "libpipewire-module-rt",
|
||||
"args": {},
|
||||
"flags": [
|
||||
"ifexists",
|
||||
"nofail"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-protocol-native"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-client-node"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-client-device"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-adapter"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-metadata"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-session-manager"
|
||||
}
|
||||
],
|
||||
"filter.properties": {},
|
||||
"stream.properties": {}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"context.properties": {
|
||||
"log.level": 0
|
||||
},
|
||||
"context.spa-libs": {
|
||||
"audio.convert.*": "audioconvert/libspa-audioconvert",
|
||||
"support.*": "support/libspa-support"
|
||||
},
|
||||
"context.modules": [
|
||||
{
|
||||
"name": "libpipewire-module-protocol-native"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-client-node"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-client-device"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-adapter"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-metadata"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-session-manager"
|
||||
}
|
||||
],
|
||||
"filter.properties": {},
|
||||
"stream.properties": {}
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"context.properties": {
|
||||
"log.level": 0
|
||||
},
|
||||
"context.spa-libs": {
|
||||
"support.*": "support/libspa-support"
|
||||
},
|
||||
"context.modules": [
|
||||
{
|
||||
"name": "libpipewire-module-rt",
|
||||
"args": {},
|
||||
"flags": [
|
||||
"ifexists",
|
||||
"nofail"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-protocol-native"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-client-node"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-metadata"
|
||||
}
|
||||
],
|
||||
"jack.properties": {},
|
||||
"jack.rules": [
|
||||
{
|
||||
"matches": [
|
||||
{}
|
||||
],
|
||||
"actions": {
|
||||
"update-props": {}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
{
|
||||
"context.properties": {
|
||||
"link.max-buffers": 16,
|
||||
"core.daemon": true,
|
||||
"core.name": "pipewire-0",
|
||||
"settings.check-quantum": true,
|
||||
"settings.check-rate": true,
|
||||
"vm.overrides": {
|
||||
"default.clock.min-quantum": 1024
|
||||
}
|
||||
},
|
||||
"context.spa-libs": {
|
||||
"audio.convert.*": "audioconvert/libspa-audioconvert",
|
||||
"api.alsa.*": "alsa/libspa-alsa",
|
||||
"support.*": "support/libspa-support"
|
||||
},
|
||||
"context.modules": [
|
||||
{
|
||||
"name": "libpipewire-module-rt",
|
||||
"args": {
|
||||
"nice.level": -11
|
||||
},
|
||||
"flags": [
|
||||
"ifexists",
|
||||
"nofail"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-protocol-native"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-profiler"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-metadata"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-spa-node-factory"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-client-node"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-access",
|
||||
"args": {}
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-adapter"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-link-factory"
|
||||
}
|
||||
],
|
||||
"context.objects": [
|
||||
{
|
||||
"factory": "metadata",
|
||||
"args": {
|
||||
"metadata.name": "default"
|
||||
}
|
||||
},
|
||||
{
|
||||
"factory": "spa-node-factory",
|
||||
"args": {
|
||||
"factory.name": "support.node.driver",
|
||||
"node.name": "Dummy-Driver",
|
||||
"node.group": "pipewire.dummy",
|
||||
"priority.driver": 20000
|
||||
}
|
||||
},
|
||||
{
|
||||
"factory": "spa-node-factory",
|
||||
"args": {
|
||||
"factory.name": "support.node.driver",
|
||||
"node.name": "Freewheel-Driver",
|
||||
"priority.driver": 19000,
|
||||
"node.group": "pipewire.freewheel",
|
||||
"node.freewheel": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"factory": "adapter",
|
||||
"args": {
|
||||
"factory.name": "api.alsa.pcm.source",
|
||||
"node.name": "system",
|
||||
"node.description": "system",
|
||||
"media.class": "Audio/Source",
|
||||
"api.alsa.path": "hw:0",
|
||||
"node.suspend-on-idle": true,
|
||||
"resample.disable": true,
|
||||
"channelmix.disable": true,
|
||||
"adapter.auto-port-config": {
|
||||
"mode": "dsp",
|
||||
"monitor": false,
|
||||
"position": "unknown"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"factory": "adapter",
|
||||
"args": {
|
||||
"factory.name": "api.alsa.pcm.sink",
|
||||
"node.name": "system",
|
||||
"node.description": "system",
|
||||
"media.class": "Audio/Sink",
|
||||
"api.alsa.path": "hw:0",
|
||||
"node.suspend-on-idle": true,
|
||||
"resample.disable": true,
|
||||
"channelmix.disable": true,
|
||||
"adapter.auto-port-config": {
|
||||
"mode": "dsp",
|
||||
"monitor": false,
|
||||
"position": "unknown"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"context.exec": []
|
||||
}
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
{
|
||||
"context.properties": {},
|
||||
"context.spa-libs": {
|
||||
"audio.convert.*": "audioconvert/libspa-audioconvert",
|
||||
"support.*": "support/libspa-support"
|
||||
},
|
||||
"context.modules": [
|
||||
{
|
||||
"name": "libpipewire-module-rt",
|
||||
"args": {
|
||||
"nice.level": -11
|
||||
},
|
||||
"flags": [
|
||||
"ifexists",
|
||||
"nofail"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-protocol-native"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-client-node"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-adapter"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-metadata"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-protocol-pulse",
|
||||
"args": {}
|
||||
}
|
||||
],
|
||||
"context.exec": [
|
||||
{
|
||||
"path": "pactl",
|
||||
"args": "load-module module-always-sink"
|
||||
}
|
||||
],
|
||||
"stream.properties": {},
|
||||
"pulse.properties": {
|
||||
"server.address": [
|
||||
"unix:native"
|
||||
],
|
||||
"vm.overrides": {
|
||||
"pulse.min.quantum": "1024/48000"
|
||||
}
|
||||
},
|
||||
"pulse.rules": [
|
||||
{
|
||||
"matches": [
|
||||
{}
|
||||
],
|
||||
"actions": {
|
||||
"update-props": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"matches": [
|
||||
{
|
||||
"application.process.binary": "teams"
|
||||
},
|
||||
{
|
||||
"application.process.binary": "teams-insiders"
|
||||
},
|
||||
{
|
||||
"application.process.binary": "skypeforlinux"
|
||||
}
|
||||
],
|
||||
"actions": {
|
||||
"quirks": [
|
||||
"force-s16-info"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"matches": [
|
||||
{
|
||||
"application.process.binary": "firefox"
|
||||
}
|
||||
],
|
||||
"actions": {
|
||||
"quirks": [
|
||||
"remove-capture-dont-move"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"matches": [
|
||||
{
|
||||
"application.name": "~speech-dispatcher*"
|
||||
}
|
||||
],
|
||||
"actions": {
|
||||
"update-props": {
|
||||
"pulse.min.req": "1024/48000",
|
||||
"pulse.min.quantum": "1024/48000"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
{
|
||||
"context.properties": {
|
||||
"link.max-buffers": 16,
|
||||
"core.daemon": true,
|
||||
"core.name": "pipewire-0",
|
||||
"default.clock.min-quantum": 16,
|
||||
"vm.overrides": {
|
||||
"default.clock.min-quantum": 1024
|
||||
}
|
||||
},
|
||||
"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": [
|
||||
{
|
||||
"name": "libpipewire-module-rt",
|
||||
"args": {
|
||||
"nice.level": -11
|
||||
},
|
||||
"flags": [
|
||||
"ifexists",
|
||||
"nofail"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-protocol-native"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-profiler"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-metadata"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-spa-device-factory"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-spa-node-factory"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-client-node"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-client-device"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-portal",
|
||||
"flags": [
|
||||
"ifexists",
|
||||
"nofail"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-access",
|
||||
"args": {}
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-adapter"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-link-factory"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-session-manager"
|
||||
}
|
||||
],
|
||||
"context.objects": [
|
||||
{
|
||||
"factory": "spa-node-factory",
|
||||
"args": {
|
||||
"factory.name": "support.node.driver",
|
||||
"node.name": "Dummy-Driver",
|
||||
"node.group": "pipewire.dummy",
|
||||
"priority.driver": 20000
|
||||
}
|
||||
},
|
||||
{
|
||||
"factory": "spa-node-factory",
|
||||
"args": {
|
||||
"factory.name": "support.node.driver",
|
||||
"node.name": "Freewheel-Driver",
|
||||
"priority.driver": 19000,
|
||||
"node.group": "pipewire.freewheel",
|
||||
"node.freewheel": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"context.exec": []
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"properties": {},
|
||||
"rules": [
|
||||
{
|
||||
"matches": [
|
||||
{
|
||||
"device.name": "~alsa_card.*"
|
||||
}
|
||||
],
|
||||
"actions": {
|
||||
"update-props": {
|
||||
"api.alsa.use-acp": true,
|
||||
"api.acp.auto-profile": false,
|
||||
"api.acp.auto-port": false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"matches": [
|
||||
{
|
||||
"node.name": "~alsa_input.*"
|
||||
},
|
||||
{
|
||||
"node.name": "~alsa_output.*"
|
||||
}
|
||||
],
|
||||
"actions": {
|
||||
"update-props": {
|
||||
"node.pause-on-idle": false
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"properties": {},
|
||||
"rules": [
|
||||
{
|
||||
"matches": [
|
||||
{
|
||||
"device.name": "~bluez_card.*"
|
||||
}
|
||||
],
|
||||
"actions": {
|
||||
"update-props": {
|
||||
"bluez5.auto-connect": [
|
||||
"hfp_hf",
|
||||
"hsp_hs",
|
||||
"a2dp_sink"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"matches": [
|
||||
{
|
||||
"node.name": "~bluez_input.*"
|
||||
},
|
||||
{
|
||||
"node.name": "~bluez_output.*"
|
||||
}
|
||||
],
|
||||
"actions": {
|
||||
"update-props": {
|
||||
"node.pause-on-idle": false
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
{
|
||||
"context.properties": {},
|
||||
"context.spa-libs": {
|
||||
"api.bluez5.*": "bluez5/libspa-bluez5",
|
||||
"api.alsa.*": "alsa/libspa-alsa",
|
||||
"api.v4l2.*": "v4l2/libspa-v4l2",
|
||||
"api.libcamera.*": "libcamera/libspa-libcamera"
|
||||
},
|
||||
"context.modules": [
|
||||
{
|
||||
"name": "libpipewire-module-rtkit",
|
||||
"args": {},
|
||||
"flags": [
|
||||
"ifexists",
|
||||
"nofail"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-protocol-native"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-client-node"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-client-device"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-adapter"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-metadata"
|
||||
},
|
||||
{
|
||||
"name": "libpipewire-module-session-manager"
|
||||
}
|
||||
],
|
||||
"session.modules": {
|
||||
"default": [
|
||||
"flatpak",
|
||||
"portal",
|
||||
"v4l2",
|
||||
"suspend-node",
|
||||
"policy-node"
|
||||
],
|
||||
"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",
|
||||
"bluez5-autoswitch",
|
||||
"logind",
|
||||
"restore-stream",
|
||||
"streams-follow-default"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"properties": {},
|
||||
"rules": [
|
||||
{
|
||||
"matches": [
|
||||
{
|
||||
"device.name": "~v4l2_device.*"
|
||||
}
|
||||
],
|
||||
"actions": {
|
||||
"update-props": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"matches": [
|
||||
{
|
||||
"node.name": "~v4l2_input.*"
|
||||
},
|
||||
{
|
||||
"node.name": "~v4l2_output.*"
|
||||
}
|
||||
],
|
||||
"actions": {
|
||||
"update-props": {
|
||||
"node.pause-on-idle": false
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
# pipewire example session manager.
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
json = pkgs.formats.json {};
|
||||
cfg = config.services.pipewire.media-session;
|
||||
enable32BitAlsaPlugins = cfg.alsa.support32Bit
|
||||
&& pkgs.stdenv.isx86_64
|
||||
&& pkgs.pkgsi686Linux.pipewire != 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 = lib.importJSON ./media-session/alsa-monitor.conf.json;
|
||||
bluez-monitor = lib.importJSON ./media-session/bluez-monitor.conf.json;
|
||||
media-session = lib.importJSON ./media-session/media-session.conf.json;
|
||||
v4l2-monitor = lib.importJSON ./media-session/v4l2-monitor.conf.json;
|
||||
};
|
||||
|
||||
configs = {
|
||||
alsa-monitor = recursiveUpdate defaults.alsa-monitor cfg.config.alsa-monitor;
|
||||
bluez-monitor = recursiveUpdate defaults.bluez-monitor cfg.config.bluez-monitor;
|
||||
media-session = recursiveUpdate defaults.media-session cfg.config.media-session;
|
||||
v4l2-monitor = recursiveUpdate defaults.v4l2-monitor cfg.config.v4l2-monitor;
|
||||
};
|
||||
in {
|
||||
|
||||
meta = {
|
||||
maintainers = teams.freedesktop.members;
|
||||
# uses attributes of the linked package
|
||||
buildDocsInSandbox = false;
|
||||
};
|
||||
|
||||
###### interface
|
||||
options = {
|
||||
services.pipewire.media-session = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Whether to enable the deprecated example Pipewire session manager";
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.pipewire-media-session;
|
||||
defaultText = literalExpression "pkgs.pipewire-media-session";
|
||||
description = ''
|
||||
The pipewire-media-session derivation to use.
|
||||
'';
|
||||
};
|
||||
|
||||
config = {
|
||||
media-session = mkOption {
|
||||
type = json.type;
|
||||
description = ''
|
||||
Configuration for the media session core. For details see
|
||||
https://gitlab.freedesktop.org/pipewire/media-session/-/blob/${cfg.package.version}/src/daemon/media-session.d/media-session.conf
|
||||
'';
|
||||
default = defaults.media-session;
|
||||
};
|
||||
|
||||
alsa-monitor = mkOption {
|
||||
type = json.type;
|
||||
description = ''
|
||||
Configuration for the alsa monitor. For details see
|
||||
https://gitlab.freedesktop.org/pipewire/media-session/-/blob/${cfg.package.version}/src/daemon/media-session.d/alsa-monitor.conf
|
||||
'';
|
||||
default = defaults.alsa-monitor;
|
||||
};
|
||||
|
||||
bluez-monitor = mkOption {
|
||||
type = json.type;
|
||||
description = ''
|
||||
Configuration for the bluez5 monitor. For details see
|
||||
https://gitlab.freedesktop.org/pipewire/media-session/-/blob/${cfg.package.version}/src/daemon/media-session.d/bluez-monitor.conf
|
||||
'';
|
||||
default = defaults.bluez-monitor;
|
||||
};
|
||||
|
||||
v4l2-monitor = mkOption {
|
||||
type = json.type;
|
||||
description = ''
|
||||
Configuration for the V4L2 monitor. For details see
|
||||
https://gitlab.freedesktop.org/pipewire/media-session/-/blob/${cfg.package.version}/src/daemon/media-session.d/v4l2-monitor.conf
|
||||
'';
|
||||
default = defaults.v4l2-monitor;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
###### implementation
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
systemd.packages = [ cfg.package ];
|
||||
|
||||
# Enable either system or user units.
|
||||
systemd.services.pipewire-media-session.enable = config.services.pipewire.systemWide;
|
||||
systemd.user.services.pipewire-media-session.enable = !config.services.pipewire.systemWide;
|
||||
|
||||
systemd.services.pipewire-media-session.wantedBy = [ "pipewire.service" ];
|
||||
systemd.user.services.pipewire-media-session.wantedBy = [ "pipewire.service" ];
|
||||
|
||||
environment.etc."pipewire/media-session.d/media-session.conf" = {
|
||||
source = json.generate "media-session.conf" configs.media-session;
|
||||
};
|
||||
environment.etc."pipewire/media-session.d/v4l2-monitor.conf" = {
|
||||
source = json.generate "v4l2-monitor.conf" configs.v4l2-monitor;
|
||||
};
|
||||
|
||||
environment.etc."pipewire/media-session.d/with-audio" =
|
||||
mkIf config.services.pipewire.audio.enable {
|
||||
text = "";
|
||||
};
|
||||
|
||||
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 {
|
||||
source = json.generate "alsa-monitor.conf" configs.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 {
|
||||
source = json.generate "bluez-monitor.conf" configs.bluez-monitor;
|
||||
};
|
||||
|
||||
environment.etc."pipewire/media-session.d/with-jack" =
|
||||
mkIf config.services.pipewire.jack.enable {
|
||||
text = "";
|
||||
};
|
||||
};
|
||||
}
|
||||
262
nixos/modules/services/desktops/pipewire/pipewire.nix
Normal file
262
nixos/modules/services/desktops/pipewire/pipewire.nix
Normal file
|
|
@ -0,0 +1,262 @@
|
|||
# pipewire service.
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
json = pkgs.formats.json {};
|
||||
cfg = config.services.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 "${cfg.package.jack}/lib" "$out/lib/pipewire"
|
||||
'';
|
||||
|
||||
# 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 = lib.importJSON ./daemon/client.conf.json;
|
||||
client-rt = lib.importJSON ./daemon/client-rt.conf.json;
|
||||
jack = lib.importJSON ./daemon/jack.conf.json;
|
||||
minimal = lib.importJSON ./daemon/minimal.conf.json;
|
||||
pipewire = lib.importJSON ./daemon/pipewire.conf.json;
|
||||
pipewire-pulse = lib.importJSON ./daemon/pipewire-pulse.conf.json;
|
||||
};
|
||||
|
||||
useSessionManager = cfg.wireplumber.enable || cfg.media-session.enable;
|
||||
|
||||
configs = {
|
||||
client = recursiveUpdate defaults.client cfg.config.client;
|
||||
client-rt = recursiveUpdate defaults.client-rt cfg.config.client-rt;
|
||||
jack = recursiveUpdate defaults.jack cfg.config.jack;
|
||||
pipewire = recursiveUpdate (if useSessionManager then defaults.pipewire else defaults.minimal) cfg.config.pipewire;
|
||||
pipewire-pulse = recursiveUpdate defaults.pipewire-pulse cfg.config.pipewire-pulse;
|
||||
};
|
||||
in {
|
||||
|
||||
meta = {
|
||||
maintainers = teams.freedesktop.members;
|
||||
# uses attributes of the linked package
|
||||
buildDocsInSandbox = false;
|
||||
};
|
||||
|
||||
###### interface
|
||||
options = {
|
||||
services.pipewire = {
|
||||
enable = mkEnableOption "pipewire service";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.pipewire;
|
||||
defaultText = literalExpression "pkgs.pipewire";
|
||||
description = ''
|
||||
The pipewire derivation to use.
|
||||
'';
|
||||
};
|
||||
|
||||
socketActivation = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Automatically run pipewire when connections are made to the pipewire socket.
|
||||
'';
|
||||
};
|
||||
|
||||
config = {
|
||||
client = mkOption {
|
||||
type = json.type;
|
||||
default = {};
|
||||
description = ''
|
||||
Configuration for pipewire clients. For details see
|
||||
https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/${cfg.package.version}/src/daemon/client.conf.in
|
||||
'';
|
||||
};
|
||||
|
||||
client-rt = mkOption {
|
||||
type = json.type;
|
||||
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
|
||||
'';
|
||||
};
|
||||
|
||||
jack = mkOption {
|
||||
type = json.type;
|
||||
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
|
||||
'';
|
||||
};
|
||||
|
||||
pipewire = mkOption {
|
||||
type = json.type;
|
||||
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
|
||||
'';
|
||||
};
|
||||
|
||||
pipewire-pulse = mkOption {
|
||||
type = json.type;
|
||||
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
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
audio = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
# this is for backwards compatibility
|
||||
default = cfg.alsa.enable || cfg.jack.enable || cfg.pulse.enable;
|
||||
defaultText = lib.literalExpression "config.services.pipewire.alsa.enable || config.services.pipewire.jack.enable || config.services.pipewire.pulse.enable";
|
||||
description = "Whether to use PipeWire as the primary sound server";
|
||||
};
|
||||
};
|
||||
|
||||
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 server emulation";
|
||||
};
|
||||
|
||||
systemWide = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
If true, a system-wide PipeWire service and socket is enabled
|
||||
allowing all users in the "pipewire" group to use it simultaneously.
|
||||
If false, then user units are used instead, restricting access to
|
||||
only one user.
|
||||
|
||||
Enabling system-wide PipeWire is however not recommended and disabled
|
||||
by default according to
|
||||
https://github.com/PipeWire/pipewire/blob/master/NEWS
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
###### implementation
|
||||
config = mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = cfg.audio.enable -> !config.hardware.pulseaudio.enable;
|
||||
message = "Using PipeWire as the sound server conflicts with PulseAudio. This option requires `hardware.pulseaudio.enable` to be set to false";
|
||||
}
|
||||
{
|
||||
assertion = cfg.jack.enable -> !config.services.jack.jackd.enable;
|
||||
message = "PipeWire based JACK emulation doesn't use the JACK service. This option requires `services.jack.jackd.enable` to be set to false";
|
||||
}
|
||||
{
|
||||
# JACK intentionally not checked, as PW-on-JACK setups are a thing that some people may want
|
||||
assertion = (cfg.alsa.enable || cfg.pulse.enable) -> cfg.audio.enable;
|
||||
message = "Using PipeWire's ALSA/PulseAudio compatibility layers requires running PipeWire as the sound server. Set `services.pipewire.audio.enable` to true.";
|
||||
}
|
||||
];
|
||||
|
||||
environment.systemPackages = [ cfg.package ]
|
||||
++ lib.optional cfg.jack.enable jack-libs;
|
||||
|
||||
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.services.pipewire.bindsTo = [ "dbus.service" ];
|
||||
systemd.user.services.pipewire.bindsTo = [ "dbus.service" ];
|
||||
|
||||
# Enable either system or user units. Note that for pipewire-pulse there
|
||||
# are only user units, which work in both cases.
|
||||
systemd.sockets.pipewire.enable = cfg.systemWide;
|
||||
systemd.services.pipewire.enable = cfg.systemWide;
|
||||
systemd.user.sockets.pipewire.enable = !cfg.systemWide;
|
||||
systemd.user.services.pipewire.enable = !cfg.systemWide;
|
||||
|
||||
systemd.sockets.pipewire.wantedBy = lib.mkIf cfg.socketActivation [ "sockets.target" ];
|
||||
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"];
|
||||
|
||||
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.etc."pipewire/client.conf" = {
|
||||
source = json.generate "client.conf" configs.client;
|
||||
};
|
||||
environment.etc."pipewire/client-rt.conf" = {
|
||||
source = json.generate "client-rt.conf" configs.client-rt;
|
||||
};
|
||||
environment.etc."pipewire/jack.conf" = {
|
||||
source = json.generate "jack.conf" configs.jack;
|
||||
};
|
||||
environment.etc."pipewire/pipewire.conf" = {
|
||||
source = json.generate "pipewire.conf" configs.pipewire;
|
||||
};
|
||||
environment.etc."pipewire/pipewire-pulse.conf" = {
|
||||
source = json.generate "pipewire-pulse.conf" configs.pipewire-pulse;
|
||||
};
|
||||
|
||||
environment.sessionVariables.LD_LIBRARY_PATH =
|
||||
lib.mkIf cfg.jack.enable [ "${cfg.package.jack}/lib" ];
|
||||
|
||||
users = lib.mkIf cfg.systemWide {
|
||||
users.pipewire = {
|
||||
uid = config.ids.uids.pipewire;
|
||||
group = "pipewire";
|
||||
extraGroups = [
|
||||
"audio"
|
||||
"video"
|
||||
] ++ lib.optional config.security.rtkit.enable "rtkit";
|
||||
description = "Pipewire system service user";
|
||||
isSystemUser = true;
|
||||
};
|
||||
groups.pipewire.gid = config.ids.gids.pipewire;
|
||||
};
|
||||
|
||||
# https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/464#note_723554
|
||||
systemd.services.pipewire.environment."PIPEWIRE_LINK_PASSIVE" = "1";
|
||||
systemd.user.services.pipewire.environment."PIPEWIRE_LINK_PASSIVE" = "1";
|
||||
};
|
||||
}
|
||||
54
nixos/modules/services/desktops/pipewire/wireplumber.nix
Normal file
54
nixos/modules/services/desktops/pipewire/wireplumber.nix
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
pwCfg = config.services.pipewire;
|
||||
cfg = pwCfg.wireplumber;
|
||||
pwUsedForAudio = pwCfg.audio.enable;
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ lib.maintainers.k900 ];
|
||||
|
||||
options = {
|
||||
services.pipewire.wireplumber = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = config.services.pipewire.enable;
|
||||
defaultText = lib.literalExpression "config.services.pipewire.enable";
|
||||
description = "Whether to enable Wireplumber, a modular session / policy manager for PipeWire";
|
||||
};
|
||||
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = pkgs.wireplumber;
|
||||
defaultText = lib.literalExpression "pkgs.wireplumber";
|
||||
description = "The wireplumber derivation to use.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = !config.services.pipewire.media-session.enable;
|
||||
message = "WirePlumber and pipewire-media-session can't be enabled at the same time.";
|
||||
}
|
||||
];
|
||||
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
|
||||
environment.etc."wireplumber/main.lua.d/80-nixos.lua" = lib.mkIf (!pwUsedForAudio) {
|
||||
text = ''
|
||||
-- Pipewire is not used for audio, so prevent it from grabbing audio devices
|
||||
alsa_monitor.enable = function() end
|
||||
'';
|
||||
};
|
||||
|
||||
systemd.packages = [ cfg.package ];
|
||||
|
||||
systemd.services.wireplumber.enable = config.services.pipewire.systemWide;
|
||||
systemd.user.services.wireplumber.enable = !config.services.pipewire.systemWide;
|
||||
|
||||
systemd.services.wireplumber.wantedBy = [ "pipewire.service" ];
|
||||
systemd.user.services.wireplumber.wantedBy = [ "pipewire.service" ];
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue