90 lines
2.3 KiB
Nix
90 lines
2.3 KiB
Nix
{
|
|
pkgs,
|
|
lib,
|
|
config,
|
|
...
|
|
}: let
|
|
inherit (lib) mkEnableOption mkIf;
|
|
|
|
cfg = config.module.pipewire;
|
|
in {
|
|
options = {
|
|
module.pipewire.enable = mkEnableOption "enable pipewire";
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
# security.rtkit = {
|
|
# enable = true;
|
|
# args = ["--no-canary"];
|
|
# };
|
|
services.pulseaudio.enable = false;
|
|
services.pipewire = {
|
|
enable = true;
|
|
alsa.enable = true;
|
|
pulse.enable = true;
|
|
# extraConfig.pipewire."92-low-latency" = {
|
|
# "context.properties" = {
|
|
# "default.clock.rate" = 48000;
|
|
# "default.clock.quantum" = 32;
|
|
# "default.clock.min-quantum" = 2048;
|
|
# "default.clock.max-quantum" = 32;
|
|
# };
|
|
# };
|
|
# wireplumber.extraConfig."10-alsa-vm" = {
|
|
# "api.alsa.period-size" = 1024; # seems to fix random crackling
|
|
# "api.alsa.headroom" = 128;
|
|
# };
|
|
extraConfig.pipewire-pulse."93-auto-connect" = {
|
|
"pulse.cmd" = [
|
|
{
|
|
cmd = "load-module";
|
|
args = "module-switch-on-connect";
|
|
}
|
|
];
|
|
};
|
|
# extraConfig.pipewire-pulse."92-low-latency" = {
|
|
# "context.properties" = [
|
|
# {
|
|
# name = "libpipewire-module-protocol-pulse";
|
|
# args = {};
|
|
# }
|
|
# ];
|
|
# "pulse.properties" = {
|
|
# "pulse.min.req" = "32/48000";
|
|
# "pulse.default.req" = "32/48000";
|
|
# "pulse.max.req" = "32/48000";
|
|
# "pulse.min.quantum" = "32/48000";
|
|
# "pulse.max.quantum" = "32/48000";
|
|
# };
|
|
# "stream.properties" = {
|
|
# "node.latency" = "32/48000";
|
|
# "resample.quality" = 1;
|
|
# };
|
|
# };
|
|
};
|
|
services.pipewire.wireplumber.configPackages = [
|
|
(pkgs.writeTextDir "share/wireplumber/main.lua.d/10-disable-suspend.conf" ''
|
|
monitor.alsa.rules = [
|
|
{
|
|
matches = [
|
|
{
|
|
# Matches all sources
|
|
node.name = "~alsa_input.*"
|
|
},
|
|
{
|
|
# Matches all sinks
|
|
node.name = "~alsa_output.*"
|
|
}
|
|
]
|
|
actions = {
|
|
update-props = {
|
|
session.suspend-timeout-seconds = 0
|
|
}
|
|
}
|
|
}
|
|
]
|
|
'')
|
|
];
|
|
};
|
|
}
|