1 { stdenv, fetchFromGitHub, meson, ninja, pkgconfig, glib, systemd, boost, darwin
3 , curl, libmms, libnfs, samba
7 , audiofile, faad2, ffmpeg, flac, fluidsynth, game-music-emu
8 , libmad, libmikmod, mpg123, libopus, libvorbis, lame
12 , alsaLib, libjack2, libpulseaudio, libshout
14 , icu, sqlite, avahi, dbus, pcre, libgcrypt, expat
28 mkDisable = f: "-D${f}=disabled";
29 mkEnable = f: "-D${f}=enabled";
30 keys = lib.mapAttrsToList (k: v: k);
32 featureDependencies = {
35 webdav = [ curl expat ];
40 smbclient = [ samba ];
45 audiofile = [ audiofile ];
49 fluidsynth = [ fluidsynth ];
50 gme = [ game-music-emu ];
52 mikmod = [ libmikmod ];
55 vorbis = [ libvorbis ];
57 vorbisenc = [ libvorbis ];
60 libsamplerate = [ libsamplerate ];
64 pulse = [ libpulseaudio ];
67 qobuz = [ curl libgcrypt yajl ];
68 soundcloud = [ curl yajl ];
69 tidal = [ curl yajl ];
71 libmpdclient = [ mpd_clientlib ];
73 id3tag = [ libid3tag ];
80 systemd = [ systemd ];
82 zeroconf = [ avahi dbus ];
85 run = { features ? null }:
87 fl = if (features == null )
88 then keys featureDependencies
91 # Disable platform specific features if needed
92 # using libmad to decode mp3 files on darwin is causing a segfault -- there
93 # is probably a solution, but I'm disabling it for now
94 platformMask = lib.optionals stdenv.isDarwin [ "mad" "pulse" "jack" "nfs" "smb" ]
95 ++ lib.optionals (!stdenv.isLinux) [ "alsa" "systemd" ];
96 features_ = lib.subtractLists platformMask fl;
98 in stdenv.mkDerivation rec {
99 name = "mpd-${version}";
100 version = "${major}${if minor == "" then "" else "." + minor}";
102 src = fetchFromGitHub {
103 owner = "MusicPlayerDaemon";
106 sha256 = "11zi8hmlj63ngzl06vzx05669k20j4cdsp0caz4p4ayn46fd4m17";
109 buildInputs = [ glib boost ]
110 ++ (lib.concatLists (lib.attrVals features_ featureDependencies))
111 ++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.AudioToolbox;
113 nativeBuildInputs = [ meson ninja pkgconfig ];
115 enableParallelBuilding = true;
118 map mkEnable features_ ++ map mkDisable (lib.subtractLists features_ (keys featureDependencies))
119 ++ [ "-Dsyslog=enabled" ]
120 ++ lib.optional (lib.any (x: x == "zeroconf") features_)
122 ++ lib.optional stdenv.isLinux
123 "-Dsystemd_system_unit_dir=etc/systemd/system";
125 meta = with stdenv.lib; {
126 description = "A flexible, powerful daemon for playing music";
127 homepage = http://mpd.wikia.com/wiki/Music_Player_Daemon_Wiki;
128 license = licenses.gpl2;
129 maintainers = with maintainers; [ astsmtl fuuzetsu ehmry fpletz ];
130 platforms = platforms.unix;
133 Music Player Daemon (MPD) is a flexible, powerful daemon for playing
134 music. Through plugins and libraries it can play a variety of sound
135 files while being controlled by its network protocol.
142 mpd-small = run { features = [
143 "webdav" "curl" "mms" "nfs" "bzip2" "zzip"
144 "audiofile" "faad" "flac" "gme" "mad"
145 "mpg123" "opus" "vorbis"
146 "vorbisenc" "lame" "libsamplerate"
147 "alsa" "shout" "libmpdclient"
148 "id3tag" "expat" "pcre" "yajl" "sqlite"
149 "soundcloud" "qobuz" "tidal"