nix machine / user configurations
at terra 1.3 kB view raw
1{ pkgs, ... }: 2let 3 rate = 48000; 4 quant = 512; 5 quantRateMax = "${toString quant}/${toString rate}"; 6 quantRateMin = "${toString (quant / 2)}/${toString rate}"; 7in 8{ 9 imports = [ ../../../modules/audio/desktop-audio.nix ]; 10 11 environment.systemPackages = with pkgs; [ 12 helvum 13 pwvucontrol 14 ]; 15 16 security.rtkit.enable = true; 17 services.pipewire = { 18 enable = true; 19 audio.enable = true; 20 alsa.enable = true; 21 alsa.support32Bit = true; 22 pulse.enable = true; 23 jack.enable = true; 24 }; 25 26 services.pipewire.extraConfig.pipewire."92-low-latency" = { 27 "context.properties" = { 28 "default.clock.rate" = rate; 29 "default.clock.quantum" = quant; 30 "default.clock.min-quantum" = quant / 2; 31 "default.clock.max-quantum" = quant; 32 }; 33 }; 34 35 services.pipewire.extraConfig.pipewire-pulse."92-low-latency" = { 36 context.modules = [ 37 { 38 name = "libpipewire-module-protocol-pulse"; 39 args = { 40 pulse.min.req = quantRateMin; 41 pulse.default.req = quantRateMax; 42 pulse.max.req = quantRateMax; 43 pulse.min.quantum = quantRateMin; 44 pulse.max.quantum = quantRateMax; 45 }; 46 } 47 ]; 48 stream.properties = { 49 node.latency = quantRateMax; 50 resample.quality = 1; 51 }; 52 }; 53}