Install Sound Open Firmware

I finally bought an ThinkPad X1 Yoga (4. Generation). I can report that everything works on nixos, but the internal microphone.

According to the arch wiki, one should install the Sound Open Firmware. Is there an example on howto install such a firmware on nixos or can I just simply create a derivation that downloads the release and copies the files?

1 Like

Maybe it’s part of nixpkgs.alsa-firmware? I would try that, and if that does not work, yes you could make a derivation that simply downloads the released files and populates a tree with them. Alternatively, you could create a derivation from the source, GitHub - thesofproject/sof: Sound Open Firmware.

The intel firmware isn’t included in the alsa-firmware package, it seems.

@zeec123 can you try nixos-unstable and use the latest kernel?

You can import this as sound.nix in your configuration.nix:

{ config, pkgs, options, ... }:

  # support audio out
  boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_latest;

  # Enable sound.
  sound.enable = true;
  hardware.pulseaudio.enable = true;
  hardware.pulseaudio.support32Bit = true;
  hardware.pulseaudio.package = pkgs.pulseaudioFull;

I have the same laptop, and I was able to get it working on nixos-unstable by enabling kernel firmware following the merge of Sound Open Firmware support, sof-firmware: init at 1.4.2, update kernel config by lblasc · Pull Request #86168 · NixOS/nixpkgs · GitHub. Seems like it’s going to be in the default list of firmwares enabled for the kernel.

1 Like

This was also backported to 20.03 in [20.03] Backport SOF by phunehehe · Pull Request #87988 · NixOS/nixpkgs · GitHub and is in the stable channel by now.

Thank you all. @NickHu How can I enable this? Is it just

hardware.enableAllFirmware =true;

or can I just load the soc driver somehow?

I think you should be able to add just pkgs.sof-firmware to hardware.firmware in your config.

I seems that the SOF-firmware is automatically installed when using
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_latest;

The only thing I had to do is switch the sof-hda-dsp card in alsamixer AND MUTE the “Speaker” item. This is necessary for normal sound

Press the “M” key on the third column , this is essential to have bass sound.


Thank you! With this and nixos 20.03 both speakers and mic seem to work on my Thinkpad X1 gen 7.

I have a Lenovo C940 and with the 5.7 kernel I only needed to add

  boot.blacklistedKernelModules = [ "snd_hda_intel" "snd_soc_skl" ];

  # This can be removed when PulseAudio is at least version 14
  hardware.pulseaudio.extraConfig = ''
    load-module module-alsa-sink   device=hw:0,0 channels=4
    load-module module-alsa-source device=hw:0,6 channels=4

and I now have working microphone and 2 speakers (not the bass boosters though sadly)

I tried every solution in this post, but sound on my X1 Carbon Gen 7 never works. This is a new laptop, and it worked in the beginning - but somewhere along the upgrades (probably after fwupdmgr updates) it stopped working.

Has anyone figured a solution yet?

EDIT: Reverting to nixos 20.03 fixed it. Only happens on nixos-unstable.

@srid As far as I can tell, sof-firmware was introduced after the 20.03 release, so you’re probably using the legacy driver (and there’s nothing wrong with that). Come 20.09, I believe you’ll get SOF by default.

If it’s interesting, I have a working sound setup on my X1C7 running nixos-unstable (61525137fd10). I put my options pertaining to audio here and here.

Generally, audio on the X1C7 is a long story, but with Sound Open Firmware and PulseAudio 14 (as well as an upcoming kernel patch), I think it’s starting to come together.

Personally, I haven’t had any problems with the sound being completely gone, but judging from the discussion that I linked to above, you’re not alone.

I should note that an update of nixos-unstable fixed the issue for me. Though I can’t say if my config is optimal (I have only sound.enable = true;)