summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2022-10-07 22:48:17 +0200
committerAlan Pearce2022-10-07 22:48:17 +0200
commitc220861a689873030d0c49a16c0ad441fb31395a (patch)
tree8d574b607fb25aacf83219706ee08c76003f4d2b
parentb7e68f6af7d47d4c1cb0248abf6ec41d8cdf2ab1 (diff)
downloadnixfiles-c220861a689873030d0c49a16c0ad441fb31395a.tar.lz
nixfiles-c220861a689873030d0c49a16c0ad441fb31395a.tar.zst
nixfiles-c220861a689873030d0c49a16c0ad441fb31395a.zip
gaming: configure pipewire for low latency
-rw-r--r--system/settings/gaming.nix57
1 files changed, 57 insertions, 0 deletions
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 = ''