Audio not working on new install

Hello,

I’m a new NixOS user and have a fresh install of NixOS 24.11 on my laptop. There’s no sound from the speaker when playing an audio file or a video on the browser.

Here are some outputs that I’ve seen people post for this issue:

  • journalctl --user-unit=pipewire --user-unit=pipewire-media-session --user-unit=pipewire-pulse -f
Mar 21 17:01:33 nixos systemd[2031]: Started PipeWire Multimedia Service.
Mar 21 17:01:33 nixos systemd[2031]: Started PipeWire PulseAudio.
Mar 21 17:18:54 nixos pipewire[2600]: pw.node: (alsa_output.pci-0000_07_00.6.HiFi__Speaker__sink-61) graph xrun not-triggered (0 suppressed)
Mar 21 17:18:54 nixos pipewire[2600]: pw.node: (alsa_output.pci-0000_07_00.6.HiFi__Speaker__sink-61) xrun state:0x7fbbcc131008 pending:1/1 s:1072272078780 a:1072272434788 f:1072272493801 waiting:356008 process:59013 status:triggered
  • sudo dmesg | grep -i audio
[   10.918344] snd_hda_intel 0000:03:00.1: Handle vga_switcheroo audio client
[   10.919077] snd_hda_intel 0000:07:00.1: Handle vga_switcheroo audio client
[   10.927991] input: HD-Audio Generic HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:08.1/0000:07:00.1/sound/card1/input13
[   10.976268] snd_hda_codec_realtek hdaudioC2D0: autoconfig for ALC287: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:speaker
[   10.976275] snd_hda_codec_realtek hdaudioC2D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[   10.976279] snd_hda_codec_realtek hdaudioC2D0:    hp_outs=1 (0x21/0x0/0x0/0x0/0x0)
[   10.976282] snd_hda_codec_realtek hdaudioC2D0:    mono: mono_out=0x0
[   10.976284] snd_hda_codec_realtek hdaudioC2D0:    inputs:
[   10.976287] snd_hda_codec_realtek hdaudioC2D0:      Mic=0x19
[   11.016498] input: HD-Audio Generic Mic as /devices/pci0000:00/0000:00:08.1/0000:07:00.6/sound/card2/input18
[   11.016682] input: HD-Audio Generic Headphone as /devices/pci0000:00/0000:00:08.1/0000:07:00.6/sound/card2/input19
[   14.581975] Modules linked in: af_packet cmac algif_hash algif_skcipher af_alg bnep nls_iso8859_1 nls_cp437 vfat fat amdgpu(+) mt7921e mt7921_common snd_soc_acp6x_mach snd_soc_dmic snd_acp6x_pdm_dma mt792x_lib snd_sof_amd_vangogh snd_sof_amd_rembrandt mt76_connac_lib snd_sof_amd_renoir snd_sof_amd_acp mt76 snd_hda_codec_realtek snd_sof_pci snd_sof_xtensa_dsp mousedev snd_sof snd_hda_codec_generic snd_sof_utils ledtrig_audio snd_soc_core snd_hda_codec_hdmi mac80211 snd_compress snd_hda_intel ac97_bus drm_exec snd_pcm_dmaengine snd_intel_dspcfg amdxcp snd_pci_ps hid_multitouch drm_buddy snd_intel_sdw_acpi btusb snd_hda_scodec_cs35l41_spi btrtl intel_rapl_msr gpu_sched regmap_spi snd_rpl_pci_acp6x drm_suballoc_helper snd_hda_codec btintel snd_acp_pci drm_ttm_helper think_lmi btbcm snd_acp_legacy_common btmtk firmware_attributes_class wmi_bmof edac_mce_amd snd_hda_scodec_cs35l41_i2c ttm snd_pci_acp6x snd_hda_core cfg80211 edac_core bluetooth snd_hda_scodec_cs35l41 snd_pci_acp5x intel_rapl_common snd_hda_cs_dsp_ctls
[   14.967329] snd_hda_intel 0000:03:00.1: bound 0000:03:00.0 (ops amdgpu_dm_audio_component_bind_ops [amdgpu])
[   16.965406] snd_hda_intel 0000:07:00.1: bound 0000:07:00.0 (ops amdgpu_dm_audio_component_bind_ops [amdgpu])
  • systemctl status --user pipewire
● pipewire.service - PipeWire Multimedia Service
     Loaded: loaded (/etc/systemd/user/pipewire.service; linked-runtime; preset: ignored)
    Drop-In: /nix/store/j480c1vimigz5xgqbqm940lfmfcgpilc-user-units/pipewire.service.d
             └─overrides.conf
     Active: active (running) since Fri 2025-03-21 17:01:33 PDT; 1h 59min ago
 Invocation: e277fbaeb6af4afdab8278bc222a7ab5
TriggeredBy: ● pipewire.socket
   Main PID: 2600 (pipewire)
      Tasks: 4 (limit: 18187)
     Memory: 6.7M (peak: 8.7M)
        CPU: 3.351s
     CGroup: /user.slice/user-1000.slice/user@1000.service/session.slice/pipewire.service
             └─2600 /nix/store/vmj55f4sc24mhzag9dxq40dkxaq1v83y-pipewire-1.2.7/bin/pipewire

Mar 21 17:01:33 nixos systemd[2031]: Started PipeWire Multimedia Service.
Mar 21 17:18:54 nixos pipewire[2600]: pw.node: (alsa_output.pci-0000_07_00.6.HiFi__Speaker__sink-61) graph xrun not-triggered (0 suppressed)
Mar 21 17:18:54 nixos pipewire[2600]: pw.node: (alsa_output.pci-0000_07_00.6.HiFi__Speaker__sink-61) xrun state:0x7fbbcc131008 pending:1/1 s:1072272078780 a:1072272434788 f:10722724>
  • The audio secion of the /etc/nixos/configuration.nix file:
# 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;
  };

Please let me know if any other information would be helpful.

Appreciate any help !

What about your volume mixer, e.g. pavucontrol?

I’ve installed pavucontrol and all audio packages that I could think of, but there’s no sound from the speaker …

I’m not sure what changes are required in configuration.nix.

This is my config file in its entirety, (apologies for the noise):

# Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, ... }:

{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    ];

  # Bootloader.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;

  networking.hostName = "nixos"; # Define your hostname.
  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.

  # Configure network proxy if necessary
  # networking.proxy.default = "http://user:password@proxy:port/";
  # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";

  # Enable networking
  networking.networkmanager.enable = true;

  # Set your time zone.
  time.timeZone = "America/Los_Angeles";

  # Select internationalisation properties.
  i18n.defaultLocale = "en_US.UTF-8";

  i18n.extraLocaleSettings = {
    LC_ADDRESS = "en_US.UTF-8";
    LC_IDENTIFICATION = "en_US.UTF-8";
    LC_MEASUREMENT = "en_US.UTF-8";
    LC_MONETARY = "en_US.UTF-8";
    LC_NAME = "en_US.UTF-8";
    LC_NUMERIC = "en_US.UTF-8";
    LC_PAPER = "en_US.UTF-8";
    LC_TELEPHONE = "en_US.UTF-8";
    LC_TIME = "en_US.UTF-8";
  };

  # Enable the X11 windowing system.
  services.xserver.enable = true;

  # Enable the GNOME Desktop Environment.
  services.xserver.displayManager.gdm.enable = true;
  services.xserver.desktopManager.gnome.enable = true;

  # Configure keymap in X11
  services.xserver.xkb = {
    layout = "us";
    variant = "";
  };

  # Enable CUPS to print documents.
  services.printing.enable = true;

  # 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;
    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;
  };

  # Enable touchpad support (enabled default in most desktopManager).
  # services.xserver.libinput.enable = true;

  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users.saurabh = {
    isNormalUser = true;
    description = "Saurabh Mishra";
    extraGroups = [ "networkmanager" "wheel" ];
    packages = with pkgs; [
      # apps
      qbittorrent
      keepassxc
      librewolf
      audacious
      audacious-plugins
      mpv
      vnote
      # development
      llvmPackages_19.libcxx
      llvmPackages_19.clang-tools
      # utilities
      kakoune
      nb
    ];
  };

  # Install firefox.
  programs.firefox.enable = true;

  # Allow unfree packages
  nixpkgs.config.allowUnfree = true;

  # List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = with pkgs; [
    # multimedia
    pavucontrol
    flac
    libao
    ffmpeg_6-full
    gst_all_1.gstreamer
    gst_all_1.gst-plugins-base
    gst_all_1.gst-vaapi
    gst_all_1.gst-plugins-ugly
    gst_all_1.gst-plugins-good
    gst_all_1.gst-plugins-bad
    gst_all_1.gst-libav
    haskellPackages.gi-gstaudio
    libmpcdec
    libmpg123
    libopus
    libsndfile
    mpd
    pcaudiolib
    pipewire
    pwvucontrol
    portaudio
    pulseaudioFull
    vorbis-tools
    libvorbis
    wireplumber
    # utilities
    git
    curl
    wget
    yt-dlp
    vim
  ];

  # Some programs need SUID wrappers, can be configured further or are
  # started in user sessions.
  # programs.mtr.enable = true;
  # programs.gnupg.agent = {
  #   enable = true;
  #   enableSSHSupport = true;
  # };

  # List services that you want to enable:

  # Enable the OpenSSH daemon.
  # services.openssh.enable = true;

  # Open ports in the firewall.
  # networking.firewall.allowedTCPPorts = [ ... ];
  # networking.firewall.allowedUDPPorts = [ ... ];
  # Or disable the firewall altogether.
  # networking.firewall.enable = false;

  # This value determines the NixOS release from which the default
  # settings for stateful data, like file locations and database versions
  # on your system were taken. It‘s perfectly fine and recommended to leave
  # this value at the release version of the first install of this system.
  # Before changing this value read the documentation for this option
  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
  system.stateVersion = "24.11"; # Did you read the comment?

}

( There’s nothing wrong with the speaker, it worked on OpenSUSE tumbleweed. )

Pressing Fn + F2 and F3 do provide the volume change indication visually, but there’s no “pop” sound.


Edit:

Here’s what the pavucontrol panel looks like:

There’s nothing wrong with your configuration (except for all the random unrelated and conflicting packages you put in environment.systemPackages, though at least those should be inert), chances are this is a missing kernel driver or something along those lines.

It could also simply be very quiet, sometimes there are bugs like that. Crank it all the way up and listen closely

Also check the configuration and playback tabs.

There’s nothing wrong with your configuration (except for all the random unrelated and conflicting packages you put in environment.systemPackages, though at least those should be inert), chances are this is a missing kernel driver or something along those lines.

Yes, it does look something like a missing kernel driver. How can it find it ?

It could also simply be very quiet, sometimes there are bugs like that. Crank it all the way up and listen closely

Tried it, not the case …

Also check the configuration and playback tabs

This as well.

When I connect bluetooth earphones, the audio works.

Its just the loudspeakers that aren’t outputting any sound …