From c220861a689873030d0c49a16c0ad441fb31395a Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 7 Oct 2022 22:48:17 +0200 Subject: gaming: configure pipewire for low latency --- system/settings/gaming.nix | 57 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'system/settings') diff --git a/system/settings/gaming.nix b/system/settings/gaming.nix index 88a6d7a5..1ad07470 100644 --- a/system/settings/gaming.nix +++ b/system/settings/gaming.nix @@ -20,6 +20,63 @@ hardware.opengl.driSupport32Bit = true; hardware.pulseaudio.support32Bit = true; services.pipewire.alsa.support32Bit = true; + services.pipewire.config.pipewire = { + "context.properties" = { + "link.max-buffers" = 16; + "log.level" = 2; + "default.clock.rate" = 44100; + "default.clock.quantum" = 32; + "default.clock.min-quantum" = 32; + "default.clock.max-quantum" = 32; + "core.daemon" = true; + "core.name" = "pipewire-0"; + }; + "context.modules" = [ + { + name = "libpipewire-module-rtkit"; + args = { + "nice.level" = -15; + "rt.prio" = 88; + "rt.time.soft" = 200000; + "rt.time.hard" = 200000; + }; + flags = [ "ifexists" "nofail" ]; + } + { name = "libpipewire-module-protocol-native"; } + { name = "libpipewire-module-profiler"; } + { name = "libpipewire-module-metadata"; } + { + name = "libpipewire-module-protocol-pulse"; + args = { + "pulse.min.req" = "32/44100"; + "pulse.default.req" = "32/44100"; + "pulse.max.req" = "32/44100"; + "pulse.min.quantum" = "32/44100"; + "pulse.max.quantum" = "32/44100"; + "server.address" = [ "unix:native" ]; + }; + } + { 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"; } + ]; + "stream.properties" = { + "node.latency" = "32/44100"; + "resample.quality" = 1; + }; + }; systemd = { extraConfig = '' -- cgit 1.4.1