diff options
Diffstat (limited to 'os/core/audio.nix')
| -rw-r--r-- | os/core/audio.nix | 90 |
1 files changed, 85 insertions, 5 deletions
diff --git a/os/core/audio.nix b/os/core/audio.nix index 1e8985a..a7fb5db 100644 --- a/os/core/audio.nix +++ b/os/core/audio.nix @@ -24,24 +24,104 @@ in config = lib.mkMerge [ (lib.mkIf cfg.enable { + services.pulseaudio.enable = false; + security.rtkit.enable = true; + services = { pipewire = { enable = true; audio.enable = true; pulse.enable = true; - alsa.enable = true; - alsa.support32Bit = true; + alsa = { + enable = true; + support32Bit = true; + }; jack.enable = true; - wireplumber.enable = true; + wireplumber = { + enable = true; + extraConfig = { + "99-lock-microphone-gain" = { + "pulse.rules" = [ + { + matches = [ + { "application.name" = "~*cord*"; } + ]; + actions = { + quirks = [ "no-source-volume" ]; + }; + } + ]; + }; + "99-disable-suspend" = { + "monitor.alsa.rules" = [ + { + matches = [ + { "node.name" = "~alsa_input.*"; } + { "node.name" = "~alsa_output.*"; } + ]; + actions.update-props = { + "session.suspend-timeout-seconds" = 0; + }; + } + ]; + }; + "10-bluetooth-policy" = { + "wireplumber.profiles" = { + "main" = { + "policy.bluetooth" = "enabled"; + }; + }; + "monitor.bluez.properties" = { + "bluez5.roles" = [ + "a2dp_sink" + "a2dp_source" + "bap_sink" + "bap_source" + "hfp_hf" + "hsp_hs" + ]; + "bluez5.codecs" = [ + "sbc" + "sbc_xq" + "aac" + "ldac" + "aptx" + "aptx_hd" + ]; + }; + }; + }; + }; }; playerctld.enable = true; - spotifyd.enable = true; }; - security.rtkit.enable = true; + systemd.user.services.pipewire-quantum = { + description = "Set strict low-latency PipeWire quantum"; + after = [ "wireplumber.service" ]; + bindsTo = [ "pipewire.service" ]; + wantedBy = [ "wireplumber.service" ]; + serviceConfig = { + Type = "oneshot"; + ExecStart = [ + "${pkgs.pipewire}/bin/pw-metadata -n settings 0 clock.quantum 512" + "${pkgs.pipewire}/bin/pw-metadata -n settings 0 clock.min-quantum 512" + ]; + }; + }; + + programs.noisetorch.enable = true; + + systemd.user.services.pipewire-pulse = { + serviceConfig = { + Environment = [ "LADSPA_PATH=/tmp" ]; + }; + }; + environment.systemPackages = with pkgs; [ toggleMuteNotify pulsemixer + pavucontrol crosspipe alsa-utils ]; |
