Since recently every time I opened Discord, my audio server got really confused and reset my audio profile I set in pavucontrol to something that is not what I want it to be. After some digging around I did not find an answer to that problem. Fortunately after asking on unix.stackexchange.com someone answered that it could be related to the wireplumber version I’m running. They said that they experienced the same thing with wireplumber 0.5.6 but it was fixed by downgrading to version 0.5.5.

I won’t keep you in suspense and tell you now, that this was in fact a solution that worked for me as well. But I figured I might as well share how achieved downgrading this program on NixOS.

There are multiple ways to go about this, but I choose overlays, since it seemed reasonable for this.

First I used lazamars’ incredible project nix package versions to find the version of wireplumber that I wanted. In my case it was 0.5.5, which is the commit hash 05bbf675397d5366259409139039af8077d695ce of nixpkgs. With that info, I added a overlay with this specific version of nixpkgs in my flake:

{
<...>
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
    home-manager.url = "github:nix-community/home-manager";
    home-manager.inputs.nixpkgs.follows = "nixpkgs";
    stylix.url = "github:danth/stylix";
    wireplumber-nixpkgs.url = "github:NixOS/nixpkgs/05bbf675397d5366259409139039af8077d695ce";
  };
<...>
}

Then I added that newly created wireplumber-nixpkgs to the outputs of my flake like so:

<...>
  outputs =
    { self, 
      nixpkgs,
      home-manager, 
      stylix,
      wireplumber-nixpkgs,
      ...
    } @ inputs:
<...>

In the let block for my flake I then created a overlay with that:

<...>
    let
      inherit (self) outputs;
      system = "x86_64-linux";
      overlay-old-wireplumber = final: prev: {
        old-wireplumber = import wireplumber-nixpkgs {
          inherit system;
        };
      };

    in
    {
<...>

I didn’t yet find a way to more cleanly cascade the system down, which is a bummer because I use system = "x86_64-linux"; for my desktop machines and system = "aarch64-linux"; for my server running on ARM. It works for now tho.

With that done I could then add the overlay to my machine configuration:

<...>
      nixosConfigurations = {
        bigboi = nixpkgs.lib.nixosSystem {
          system = "x86_64-linux";
          specialArgs = { inherit inputs outputs; };
          modules = [
            ./hosts/bigboi
            stylix.nixosModules.stylix
            {
              nixpkgs.overlays = [ overlay-old-wireplumber ];
            }
          ];

        };
<...>

And finally I used that overlay in my sound configuration to overwrite the wireplumber package for that machine:

{ config, pkgs, ... }:
{
  hardware.pulseaudio.enable = false;
  security.rtkit.enable = true;

  services.pipewire = {
    enable = true;
    alsa = {
      enable = true;
      support32Bit = true;
    };
    pulse.enable = true;
    wireplumber = {
      enable = true;
      package = pkgs.old-wireplumber.wireplumber;
    };
    jack.enable = true;
  };

This worked flawlessly and I can keep my audio interface on “Pro Audio” without wireplumber fucking it up.

Unfortunately the documentation for doing something like this is sparse at best and you are basically required to know the nix language inside out. The latter is fair, I guess, but I think the docs could be better regarding this. I’ll create a PR to make it easier to understand when I get around to it.

Most of the stuff I did was based on the super helpful videos NixOS 41: Mixing Older and Newer nixpkgs Packages Under a Flakes-based Config by Chris McDonough and Customize Nix Packages | Gentoo Experience on NixOS by the GOAT himself, Vimjoyer.

I hope condensing this process down to a post like this is helpful to someone. If you have any input on how to do this more elegantly, shoot me an email. I’m always eager to optimize my solutions.

Thanks for reading ❄️