Can't control volume, either 100% or 0%

I also got no audio with that package.

After poking around a bit I found a fix from 2012

This is 100% my problem. The PCM controls my audio.

I found where someone tried to fix this with a post build script but he hadn’t had any luck.

I made an audio.nix based on this but I’m not able to figure it out.

The pipewire-patch-with-pcm-control package is there and it has the Element Master section added to it.

services.pipewire.package = pipewire_hacked; was the last thing I tried. The old one had hardware.pulseaudio.package but there’s no hardware.pipewire

EDIT: I really thought I had it when I saw someone else feeding the modified pipewire into wireplumber!

{ pkgs, lib, ... }:

let
  pipewire' = pkgs.pipewire.overrideAttrs (old: {
    # name = "pulseaudio-patched";
    pname = "${old.pname}-patched-with-pcm-control";
    # Instead of overriding some post-build action, which would require a
    # pulseaudio rebuild, we override the entire `buildCommand` to produce
    # its outputs by copying the original package's files (much faster).
    buildCommand = ''
      set -euo pipefail

      ${ # Copy original files, for each split-output (`out`, `dev` etc.).
      lib.concatStringsSep "\n" (map (outputName: ''
        echo "Copying output ${outputName}"
        set -x
        cp -a ${pkgs.pipewire.${outputName}} ''$${outputName}
        set +x
      '') old.outputs)}
        
      # Find this file: /nix/store/vr4mv8jppbvr96ml2chlgikmy6f9crb7-pipewire-0.3.80-lib/share/alsa-card-profile/mixer/paths/analog-output.conf.common 
      #   and add these three lines:
      # 
      #   [Element Master]
      #   switch = mute
      #   volume = ignore
      # 
      # Directly above of this part of code:
      # 
      #   [Element PCM]
      #   switch = mute
      #   volume = merge
      #   override-map.1 = all
      #   override-map.2 = all-left,all-right
      set -x
      INFILE=$out/share/alsa-card-profile/mixer/paths/analog-output.conf.common
      sed 's/\[Element PCM\]/\[Element Master\]\nswitch = mute\nvolume = ignore\n\n[Element PCM]/' $INFILE > tmp.conf
      # Ensure file changed (something was replaced)
      ! cmp tmp.conf $INFILE
      chmod +w $out/share/alsa-card-profile/mixer/paths/analog-output.conf.common
      cp tmp.conf $INFILE
      set +x
    '';
  });
  wireplumber' = (pkgs.wireplumber.override { pipewire = pipewire'; });
in {

  # Enable sound with pipewire.
  security.rtkit.enable = true;
  hardware.pulseaudio.enable = false;
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
    #jack.enabule = true;
    package = pipewire';
    wireplumber.package = wireplumber';

  };

  environment.systemPackages = [ pkgs.alsa-utils ];
}