2024-09-08 13:29:44 +00:00
|
|
|
{ config, lib, ... }:
|
|
|
|
|
2024-09-24 13:09:36 +00:00
|
|
|
let
|
2024-09-08 13:29:44 +00:00
|
|
|
cfg = config.modules.pipewire;
|
2024-09-24 13:09:36 +00:00
|
|
|
in
|
|
|
|
{
|
2024-09-08 13:29:44 +00:00
|
|
|
options.modules.pipewire.enable = lib.mkEnableOption "pipewire module";
|
2024-09-08 14:27:43 +00:00
|
|
|
options.modules.pipewire.latencyFix.enable = lib.mkEnableOption "enable latency fixes";
|
2024-09-08 13:29:44 +00:00
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
hardware.pulseaudio.enable = false;
|
|
|
|
# rtkit is optional but recommended
|
|
|
|
security.rtkit.enable = true;
|
|
|
|
services.pipewire = {
|
|
|
|
enable = true;
|
|
|
|
alsa.enable = true;
|
|
|
|
alsa.support32Bit = true;
|
|
|
|
pulse.enable = true;
|
|
|
|
# If you want to use JACK applications, uncomment this
|
|
|
|
#jack.enable = true;
|
|
|
|
};
|
|
|
|
|
2024-09-08 14:27:43 +00:00
|
|
|
services.pipewire.extraConfig.pipewire."92-low-latency" = lib.mkIf cfg.latencyFix.enable {
|
2024-09-08 13:29:44 +00:00
|
|
|
"context.properties" = {
|
2024-09-24 13:09:36 +00:00
|
|
|
"default.clock.rate" = 48000;
|
2024-09-22 10:36:05 +00:00
|
|
|
"default.clock.allowed-rates" = [ 48000 ];
|
|
|
|
"default.clock.quantum" = 2048;
|
2024-09-24 13:09:36 +00:00
|
|
|
"default.clock.min-quantum" = 1024;
|
2024-09-22 10:36:05 +00:00
|
|
|
|
2024-09-08 13:29:44 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|