Sound works in live CD but not on installation for Huawei MateBook D 14 Intel Tiger Lake-LP Audio Controller

Hi, my live CD experience is excellent. Everything I need works, including sound.

But on installing NixOS (mostly unchanged, except I moved to nixos-unstable channel), my audio card is detected, and the feedback bars move for my speakers (when I play something) and microphone (picks up ambient noise or my voice well), but I cannot hear anything.

I tried this with Plasma and GNOME on different installs. Same issue.

$ lspci | grep -i audio
00:1f.3 Multimedia audio controller: Intel Corporation Tiger Lake-LP Smart Sound Technology Audio Controller (rev 20)

$ dmesg | grep -i audio
[    7.511176] sof-audio-pci-intel-tgl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040100
[    7.511234] sof-audio-pci-intel-tgl 0000:00:1f.3: enabling device (0000 -> 0002)
[    7.511402] sof-audio-pci-intel-tgl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if 0x040100
[    7.520487]  ghash_clmulni_intel btbcm snd_hwdep intel_pmc_bxt mtd nf_log_syslog watchdog snd_pcm processor_thermal_rfim videobuf2_common mei_me intel_gtt vfat intel_lpss_pci igen6_edac i2c_hid_acpi btmtk rapl processor_thermal_mbox huawei_wmi intel_lpss spi_intel_pci intel_rapl_msr wmi_bmof ledtrig_audio sparse_keymap fat idma64 intel_cstate bluetooth cfg80211 intel_uncore mc snd_timer xt_tcpudp processor_thermal_rapl i2c_hid i2c_algo_bit mei ecdh_generic virt_dma snd edac_core i2c_i801 ecc intel_rapl_common rfkill video i2c_smbus spi_intel hid soundcore nft_compat intel_soc_dts_iosf thermal uas wmi tpm_crb backlight tiny_power_button battery intel_pmc_core tpm_tis evdev int3400_thermal pinctrl_tigerlake int3403_thermal acpi_pad mac_hid acpi_thermal_rel int340x_thermal_zone tpm_tis_core ac button serio_raw nf_tables libcrc32c sch_fq_codel loop tun tap macvlan bridge stp llc kvm_intel kvm fuse irqbypass configfs efi_pstore nfnetlink efivarfs dmi_sysfs ip_tables x_tables autofs4 ext4 crc32c_generic crc16 mbcache jbd2
[    7.550332] sof-audio-pci-intel-tgl 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[    7.589681] sof-audio-pci-intel-tgl 0000:00:1f.3: use msi interrupt mode
[    7.607912] sof-audio-pci-intel-tgl 0000:00:1f.3: NHLT_DEVICE_I2S detected, ssp_mask 0x1
[    7.607917] sof-audio-pci-intel-tgl 0000:00:1f.3: Overriding topology with MCLK mask 0x1 from NHLT
[    7.607919] sof-audio-pci-intel-tgl 0000:00:1f.3: hda codecs found, mask 4
[    7.613130] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:2:0-57864
[    7.613134] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:23:0
[    7.613140] sof-audio-pci-intel-tgl 0000:00:1f.3: unknown sof_ext_man header type 3 size 0x30
[    7.708527] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:2:0-57864
[    7.708531] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:23:0
[    7.713311] sof-audio-pci-intel-tgl 0000:00:1f.3: Topology: ABI 3:22:1 Kernel ABI 3:23:0

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sofessx8336 [sof-essx8336], device 0: ES8336 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sofessx8336 [sof-essx8336], device 5: HDMI 1 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sofessx8336 [sof-essx8336], device 6: HDMI 2 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sofessx8336 [sof-essx8336], device 7: HDMI 3 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

pavucontrol also shows the same output: multiple devices, out of which my speaker also shows up. I can also see the feedback bars move up and down when I play a sound.

My sound config is the default that comes with the installation:

  # Enable sound with pipewire.
  hardware.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;
  };

I am convinced there’s a way to get this to work. I tried to track down how sound is activated in the installation disk here: nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-graphical-gnome.nix at 63efb7440ad36ef900e351e9575838623f4c3862 · NixOS/nixpkgs · GitHub but that didn’t get me too far.

Any help or pointers would be great, thanks!

Screenshots of my Plasma audio center and pavucontrol:

I was playing a video when I took the screenshot for speakers.png. You can see the activity on the screenshot.
Similarly it also detects my headphones correctly when I insert them.
(Volume is also set to 100%. It’s not muted)

EDIT: I also tried updating to the latest Linux:

boot.kernelPackages = pkgs.linuxPackages_latest;

More information: there seems to be an issue with my laptop model:

https://bbs.archlinux.org/viewtopic.php?id=274559

But that still doesn’t explain why the sound is available on live CD but not on the installation.

This suggests that there is a solution: I just don’t know how to get to it.

I switched to Pulseaudio on Linux 6.9.9 and it’s fixed.

  # Enable sound with Pulseaudio.
  hardware.pulseaudio.enable = true;
  security.rtkit.enable = true;

I’m facing this problem now but i can’t set the kernel version to 6.9 as it reached EOL. :frowning: