niksos/hosts/niks/pipewire.nix

49 lines
1.5 KiB
Nix
Raw Normal View History

2023-07-30 23:47:30 +02:00
{
config,
pkgs,
...
}: {
2023-07-30 23:52:23 +02:00
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
wireplumber.enable = true;
2023-07-30 23:47:30 +02:00
};
security.rtkit.enable = true;
2023-07-30 23:52:23 +02:00
environment.etc = let
2023-07-30 23:47:30 +02:00
json = pkgs.formats.json {};
2023-07-30 23:58:44 +02:00
rate = "48000";
2023-08-02 15:54:46 +02:00
quantum = "128";
2023-07-30 23:47:30 +02:00
in {
"pipewire/pipewire.conf.d/92-low-latency.conf".text = ''
context.properties = {
default.clock.rate = ${rate}
default.clock.quantum = ${quantum}
default.clock.min-quantum = ${quantum}
default.clock.max-quantum = ${quantum}
}
'';
"pipewire/pipewire-pulse.d/92-low-latency.conf".source = json.generate "92-low-latency.conf" {
context.modules = [
{
name = "libpipewire-module-protocol-pulse";
args = {
pulse.min.req = "${quantum}/${rate}";
pulse.default.req = "${quantum}/${rate}";
pulse.max.req = "${quantum}/${rate}";
pulse.min.quantum = "${quantum}/${rate}";
pulse.max.quantum = "${quantum}/${rate}";
};
}
];
stream.properties = {
node.latency = "${quantum}/${rate}";
resample.quality = 1;
};
};
};
}