Hello! I recently installed NixOS for the first time on my laptop and I noticed that whenever I plug in my headphones into the headphone jack, there is no audio in both the speakers and through my headphones.
Upon installing pwvucontrol, I noticed it was because the audio controller wasn’t automatically switching profiles when I plug them in. Clicking on the profile with “Headphones” in the title caused audio to correctly play through my headphones, but I had to manually switch back to speakers when I was done with them.
This problem is apparent just for the headphone jack; Bluetooth, the built-in speakers, and even a wired connection through USB-C work and switch between each other perfectly fine.
How can I configure NixOS to automatically detect my wired headphones and change audio controller profiles when I plug my headphones into the headphone jack?
Below are the relevant lines in my Nix config as well as the output of wpctl status, both while I have my headphones plugged in but the “Speaker” profile still selected.
# Enable sound with pipewire.
services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
# jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
PipeWire 'pipewire-0' [1.6.5, cocotreb@tpt14g5, cookie:1160273331]
└─ Clients:
34. .kwin_wayland-wrapped [1.6.5, cocotreb@tpt14g5, pid:2205]
44. pipewire [1.6.5, cocotreb@tpt14g5, pid:2399]
45. libcanberra [1.6.5, cocotreb@tpt14g5, pid:2306]
66. WirePlumber [export] [1.6.5, cocotreb@tpt14g5, pid:26191]
77. Floorp [1.6.5, cocotreb@tpt14g5, pid:20999]
82. [1.6.5, cocotreb@tpt14g5, pid:2306]
83. .xdg-desktop-portal-wrapped [1.6.5, cocotreb@tpt14g5, pid:2214]
86. .plasmashell-wrapped [1.6.5, cocotreb@tpt14g5, pid:2348]
87. libcanberra [1.6.5, cocotreb@tpt14g5, pid:2348]
88. [1.6.5, cocotreb@tpt14g5, pid:2348]
93. wpctl [1.6.5, cocotreb@tpt14g5, pid:28417]
94. [1.6.5, cocotreb@tpt14g5, pid:2306]
103. Floorp [1.6.5, cocotreb@tpt14g5, pid:20999]
108. .pwvucontrol-wrapped [1.6.5, cocotreb@tpt14g5, pid:28162]
141. WirePlumber [1.6.5, cocotreb@tpt14g5, pid:26191]
Audio
├─ Devices:
│ 58. Meteor Lake-P HD Audio Controller [alsa]
│
├─ Sinks:
│ 39. Meteor Lake-P HD Audio Controller HDMI / DisplayPort 2 Output [vol: 1.00]
│ * 42. Meteor Lake-P HD Audio Controller Speaker [vol: 0.80]
│ 47. Meteor Lake-P HD Audio Controller HDMI / DisplayPort 1 Output [vol: 1.00]
│ 79. Meteor Lake-P HD Audio Controller HDMI / DisplayPort 3 Output [vol: 1.00]
│
├─ Sources:
│ 35. Meteor Lake-P HD Audio Controller Stereo Microphone [vol: 1.00]
│ * 115. Meteor Lake-P HD Audio Controller Digital Microphone [vol: 1.00]
│
├─ Filters:
│
└─ Streams:
62. Floorp
38. output_FR > Speaker:playback_FR [init]
59. output_FL > Speaker:playback_FL [init]
Video
├─ Devices:
│ 43. Integrated Camera [v4l2]
│ 100. Integrated Camera: Integrated C [libcamera]
│ 142. Integrated Camera [v4l2]
│
├─ Sinks:
│
├─ Sources:
│ * 37. Integrated Camera (V4L2)
│
├─ Filters:
│
└─ Streams:
Settings
└─ Default Configured Devices:
0. Audio/Sink alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__Speaker__sink
