1 { stdenv, fetchFromGitHub, meson, ninja, pkgconfig, glib, systemd, boost168, darwin
2 , cmake, libupnp, sndio, chromaprint, soxr, libcdio, libcdio-paranoia, ao, libao
5 , curl, libmms, libnfs, samba
9 , audiofile, faad2, ffmpeg, flac, fluidsynth, game-music-emu
10 , libmad, libmikmod, mpg123, libopus, libvorbis, lame
14 , alsaLib, libjack2, libpulseaudio, libshout
16 , icu, sqlite, avahi, dbus, pcre, libgcrypt, expat
30 mkDisable = f: "-D${f}=disabled";
31 mkEnable = f: "-D${f}=enabled";
32 keys = lib.mapAttrsToList (k: v: k);
34 featureDependencies = {
37 webdav = [ curl expat ];
42 smbclient = [ samba ];
47 audiofile = [ audiofile ];
51 fluidsynth = [ fluidsynth ];
52 gme = [ game-music-emu ];
54 mikmod = [ libmikmod ];
57 vorbis = [ libvorbis ];
59 vorbisenc = [ libvorbis ];
62 libsamplerate = [ libsamplerate ];
66 pulse = [ libpulseaudio ];
69 qobuz = [ curl libgcrypt yajl ];
70 soundcloud = [ curl yajl ];
71 tidal = [ curl yajl ];
73 libmpdclient = [ mpd_clientlib ];
75 id3tag = [ libid3tag ];
82 systemd = [ systemd ];
84 zeroconf = [ avahi dbus ];
87 run = { features ? null }:
89 fl = if (features == null )
90 then keys featureDependencies
93 # Disable platform specific features if needed
94 # using libmad to decode mp3 files on darwin is causing a segfault -- there
95 # is probably a solution, but I'm disabling it for now
96 platformMask = lib.optionals stdenv.isDarwin [ "mad" "pulse" "jack" "nfs" "smb" ]
97 ++ lib.optionals (!stdenv.isLinux) [ "alsa" "systemd" ];
98 features_ = lib.subtractLists platformMask fl;
100 in stdenv.mkDerivation rec {
101 name = "mpd-${version}";
102 version = "${major}${if minor == "" then "" else "." + minor}";
104 src = fetchFromGitHub {
105 owner = "MusicPlayerDaemon";
108 sha256 = "11zi8hmlj63ngzl06vzx05669k20j4cdsp0caz4p4ayn46fd4m17";
111 buildInputs = [ cmake glib boost168 sndio libupnp chromaprint soxr
112 libcdio libcdio-paranoia ao libao openal libvorbis
114 ++ (lib.concatLists (lib.attrVals features_ featureDependencies))
115 ++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.AudioToolbox;
117 nativeBuildInputs = [ meson ninja pkgconfig ];
119 enableParallelBuilding = true;
122 map mkEnable features_ ++ map mkDisable (lib.subtractLists features_ (keys featureDependencies))
123 ++ [ "-Dsyslog=enabled" ]
124 ++ lib.optional (lib.any (x: x == "zeroconf") features_)
126 ++ lib.optional stdenv.isLinux
127 "-Dsystemd_system_unit_dir=etc/systemd/system";
129 meta = with stdenv.lib; {
130 description = "A flexible, powerful daemon for playing music";
131 homepage = http://mpd.wikia.com/wiki/Music_Player_Daemon_Wiki;
132 license = licenses.gpl2;
133 maintainers = with maintainers; [ astsmtl fuuzetsu ehmry fpletz ];
134 platforms = platforms.unix;
137 Music Player Daemon (MPD) is a flexible, powerful daemon for playing
138 music. Through plugins and libraries it can play a variety of sound
139 files while being controlled by its network protocol.
146 mpd-small = run { features = [
147 "webdav" "curl" "mms" "nfs" "bzip2" "zzip"
148 "audiofile" "faad" "flac" "gme" "mad"
149 "mpg123" "opus" "vorbis"
150 "vorbisenc" "lame" "libsamplerate"
151 "alsa" "shout" "libmpdclient"
152 "id3tag" "expat" "pcre" "yajl" "sqlite"
153 "soundcloud" "qobuz" "tidal"