MPD: Difference between revisions

imported>Novmar
mNo edit summary
imported>Novmar
No edit summary
Line 82: Line 82:
== Further reading ==
== Further reading ==
The legendary Arch Wiki : https://wiki.archlinux.org/index.php/Mpd
The legendary Arch Wiki : https://wiki.archlinux.org/index.php/Mpd
== Another solution - pulseaudio with systemWide ==
You can also set pulseaudio running system wide.
<syntaxhighlight lang="nix">
sound.enable = true;
  hardware.pulseaudio = {
    systemWide = true;
    enable = true;
  };
services.mpd = {
  enable = true ;
  extraConfig = ''
    audio_output {
      type "pulse"
      name "Pulseaudio"
      mixer_type      "hardware"      # optional
      mixer_device    "default"      # optional
      mixer_control  "PCM"          # optional
      mixer_index    "0"            # optional
    }  '';
  ## optional
  network.listenAddress = "any"; # allow to control mop from any host
  musicDirectory = "/path/to/some/music"; # ptah to your music
};
</syntaxhighlight>
You can also use alsa, just add audio output to services.mpd.extraConfig
<syntaxhighlight lang="nix">
services.mpd = {
  enabled = true;
  extraConfig = ''
    audio_output {
      type "alsa"
      name "alsa"
      device "hw:0,0" # optional
      format "44100:16:2" # optional
      mixer_type "hardware"
      mixer_device "default"
      mixer_control "PCM"
    }
  '';
}
</syntaxhighlight>