all repos — nixfiles @ c220861a689873030d0c49a16c0ad441fb31395a

System and user configuration, managed by nix and home-manager

gaming: configure pipewire for low latency
Alan Pearce alan@alanpearce.eu
Fri, 07 Oct 2022 22:48:17 +0200
commit

c220861a689873030d0c49a16c0ad441fb31395a

parent

b7e68f6af7d47d4c1cb0248abf6ec41d8cdf2ab1

1 files changed, 57 insertions(+), 0 deletions(-)

jump to
M system/settings/gaming.nixsystem/settings/gaming.nix
@@ -20,6 +20,63 @@ hardware.steam-hardware.enable = true;   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 = ''