# ABOUTME: PipeWire and the RNNoise input denoising from the shared config. # ABOUTME: Both halves in one place; they used to sit in two separate modules. { pkgs, moonarchSrc, ... }: let xdg = "${moonarchSrc}/defaults/xdg"; # PipeWire searches $PIPEWIRE_CONFIG_DIR, then $XDG_CONFIG_HOME/pipewire, then # its compiled-in /etc/pipewire — never /etc/xdg (verified in PipeWire's # src/pipewire/conf.c). The shared file therefore cannot be deployed the way # the other XDG configs are; it goes through the module's configPackages, # which is what its own option documentation shows for a conf.d file. # # The file names the plugin as `librnnoise_ladspa`, resolved through # LADSPA_PATH, which points at nothing here. Substituted to the # store path, the way modules/desktop.nix does it for the wallpaper. LADSPA # has no counterpart to services.pipewire.extraLv2Packages, so the path # belongs in the file. denoisingConfig = pkgs.runCommand "moonarch-pipewire-denoising" { } '' mkdir -p "$out/share/pipewire/pipewire.conf.d" substitute ${xdg}/pipewire/pipewire.conf.d/99-input-denoising.conf \ "$out/share/pipewire/pipewire.conf.d/99-input-denoising.conf" \ --replace-fail "plugin = librnnoise_ladspa" \ "plugin = ${pkgs.rnnoise-plugin}/lib/ladspa/librnnoise_ladspa.so" ''; in { services.pipewire = { enable = true; alsa.enable = true; alsa.support32Bit = true; pulse.enable = true; jack.enable = true; # RNNoise input denoising, from the shared config. The filter chain appears # as a separate "Noise Canceling source" input; it does not replace the raw # microphone, so applications have to select it. configPackages = [ denoisingConfig ]; }; # No pulseaudio for pactl: Steam probes wpctl and pactl both and takes # whichever is on PATH (nixpkgs#525793), and wireplumber puts wpctl there. # Its "pactl: command not found" is noise from Steam, not a gap. environment.systemPackages = with pkgs; [ pavucontrol alsa-utils ]; }