From b1943da1cc0340d375191330dc0adc24cf0f1e92 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sun, 24 Sep 2023 01:21:36 +0200 Subject: [PATCH] feat: pipewire fixes fix: xinit hanging --- hosts/desktopnix/default.nix | 1 + modules/hardware/pipewire.nix | 51 +++++++++++++++++++++++++++++ users/common/graphical/Xorg/xinitrc | 4 +-- users/common/graphical/sway3.nix | 1 + 4 files changed, 55 insertions(+), 2 deletions(-) diff --git a/hosts/desktopnix/default.nix b/hosts/desktopnix/default.nix index 33c1300..35629d1 100644 --- a/hosts/desktopnix/default.nix +++ b/hosts/desktopnix/default.nix @@ -29,5 +29,6 @@ ]; stylix.fonts.sizes = { terminal = 10; + applications = 10; }; } diff --git a/modules/hardware/pipewire.nix b/modules/hardware/pipewire.nix index ab3c7ec..b8a2558 100644 --- a/modules/hardware/pipewire.nix +++ b/modules/hardware/pipewire.nix @@ -14,6 +14,57 @@ jack.enable = true; pulse.enable = true; }; + environment.etc = { + # Allow pipewire to dynamically adjust the rate sent to the devices based on the playback stream + "pipewire/pipewire.conf.d/99-allowed-rates.conf".text = builtins.toJSON { + "context.properties"."default.clock.allowed-rates" = [ + 44100 + 48000 + 88200 + 96000 + 176400 + 192000 + ]; + }; + # Nixos wiki copied + "pipewire/pipewire.conf.d/92-low-latency.conf".text = '' + context.properties = { + default.clock.rate = 48000 + default.clock.quantum = 32 + default.clock.min-quantum = 32 + default.clock.max-quantum = 32 + } + ''; + "pipewire/pipewire-pulse.d/91-low-latency.conf".text = builtins.toJSON { + context.modules = [ + { + name = "libpipewire-module-protocol-pulse"; + args = { + pulse.min.req = "32/48000"; + pulse.default.req = "32/48000"; + pulse.max.req = "32/48000"; + pulse.min.quantum = "32/48000"; + pulse.max.quantum = "32/48000"; + }; + } + ]; + stream.properties = { + node.latency = "32/48000"; + resample.quality = 1; + }; + }; + + # If resampling is required, use a higher quality. 15 is overkill and too cpu expensive without any obvious audible advantage + "pipewire/pipewire-pulse.conf.d/99-resample.conf".text = builtins.toJSON { + "stream.properties"."resample.quality" = 10; + }; + "pipewire/client.conf.d/99-resample.conf".text = builtins.toJSON { + "stream.properties"."resample.quality" = 10; + }; + "pipewire/client-rt.conf.d/99-resample.conf".text = builtins.toJSON { + "stream.properties"."resample.quality" = 10; + }; + }; sound.enable = false; } diff --git a/users/common/graphical/Xorg/xinitrc b/users/common/graphical/Xorg/xinitrc index 2965270..240f0f9 100644 --- a/users/common/graphical/Xorg/xinitrc +++ b/users/common/graphical/Xorg/xinitrc @@ -21,6 +21,6 @@ if command -v dbus-update-activation-environment >/dev/null 2>&1; then fi autorandr -c -streamdeck --no-ui -systemctl --user start set-wallpaper.service +streamdeck --no-ui & +systemctl --user start set-wallpaper.timer & exec i3 diff --git a/users/common/graphical/sway3.nix b/users/common/graphical/sway3.nix index 5d3b781..89de023 100644 --- a/users/common/graphical/sway3.nix +++ b/users/common/graphical/sway3.nix @@ -15,6 +15,7 @@ in { #bindkeysToCode = true; window.titlebar = false; floating.titlebar = false; + workspaceLayout = "stacking"; workspaceOutputAssign = [ { workspace = "1";