Speakers do not autosilence when audio output is changed from speakers to headphones

Hi, how can I apply the solution from this post in configuration.nix in my nixos gnome 3 desktop?
I tried looking at different options like hardware.pulseaudio.extraConfig but no success. I have disabled the automute option in alsamixer, but now every time I change the audio output from speakers to headphones, the speakers do not autosilence. I have to go to alsamixer options and silence it manually.

How are you changing the output. On the hardware itself or in your volume control, if so, what application are you using for selecting the output?

Hi, in the sound menu in settings.

This could be an issue specific to gnome volume control. As a workaround, I’d use pavucontrol (nix-shell -p pavucontrol) to switch devices. Or alsamixer (a terminal app). Actually, this could be an alsa configuration issue, possible resolvable within alsamixer. But in essence, pavucontrol is in more direct contact with the pulseaudio service than gnome, which is relying on dbus/dmsg.

I did try using pavucontrol but it had the exact same issue as gnome’s default volume control.