···
1
-
{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, glib, systemd, boost, darwin
2
-
, alsaSupport ? true, alsaLib
3
-
, avahiSupport ? true, avahi, dbus
4
-
, flacSupport ? true, flac
5
-
, vorbisSupport ? true, libvorbis
6
-
, madSupport ? true, libmad
7
-
, id3tagSupport ? true, libid3tag
8
-
, mikmodSupport ? true, libmikmod
9
-
, shoutSupport ? true, libshout
10
-
, sqliteSupport ? true, sqlite
11
-
, curlSupport ? true, curl
12
-
, audiofileSupport ? true, audiofile
13
-
, bzip2Support ? true, bzip2
14
-
, ffmpegSupport ? true, ffmpeg
15
-
, fluidsynthSupport ? true, fluidsynth
16
-
, zipSupport ? true, zziplib
17
-
, samplerateSupport ? true, libsamplerate
18
-
, mmsSupport ? true, libmms
19
-
, mpg123Support ? true, mpg123
20
-
, aacSupport ? true, faad2
21
-
, lameSupport ? true, lame
22
-
, pulseaudioSupport ? true, libpulseaudio
23
-
, jackSupport ? true, libjack2
24
-
, gmeSupport ? true, game-music-emu
25
-
, icuSupport ? true, icu
26
-
, clientSupport ? true, mpd_clientlib
27
-
, opusSupport ? true, libopus
28
-
, soundcloudSupport ? true, yajl
29
-
, nfsSupport ? true, libnfs
30
-
, smbSupport ? true, samba
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
33
-
assert avahiSupport -> avahi != null && dbus != null;
36
-
opt = stdenv.lib.optional;
37
-
mkFlag = c: f: if c then "--enable-${f}" else "--disable-${f}";
41
-
in stdenv.mkDerivation rec {
43
-
version = "${major}${if minor == "" then "" else "." + minor}";
45
-
src = fetchFromGitHub {
46
-
owner = "MusicPlayerDaemon";
48
-
rev = "v${version}";
49
-
sha256 = "1z1pdgiddimnmck0ardrpxkvgk1wn9zxri5wfv5ppasbb7kfm350";
26
+
featureDependencies = {
29
+
webdav = [ curl expat ];
34
+
smbclient = [ samba ];
39
+
audiofile = [ audiofile ];
41
+
ffmpeg = [ ffmpeg ];
43
+
fluidsynth = [ fluidsynth ];
44
+
gme = [ game-music-emu ];
46
+
mikmod = [ libmikmod ];
47
+
mpg123 = [ mpg123 ];
49
+
vorbis = [ libvorbis ];
51
+
vorbisenc = [ libvorbis ];
54
+
libsamplerate = [ libsamplerate ];
57
+
jack = [ libjack2 ];
58
+
pulse = [ libpulseaudio ];
59
+
shout = [ libshout ];
60
+
# Commercial services
61
+
qobuz = [ curl libgcrypt yajl ];
62
+
soundcloud = [ curl yajl ];
63
+
tidal = [ curl yajl ];
65
+
libmpdclient = [ mpd_clientlib ];
67
+
id3tag = [ libid3tag ];
73
+
sqlite = [ sqlite ];
75
+
systemd = [ systemd ];
77
+
zeroconf = [ avahi dbus ];
52
-
patches = [ ./x86.patch ];
80
+
run = { features ? null }:
82
+
# Disable platform specific features if needed
83
+
# using libmad to decode mp3 files on darwin is causing a segfault -- there
84
+
# is probably a solution, but I'm disabling it for now
85
+
platformMask = lib.optionals stdenv.isDarwin [ "mad" "pulse" "jack" "nfs" "smb" ]
86
+
++ lib.optionals (!stdenv.isLinux) [ "alsa" "systemd" "syslog" ];
54
-
buildInputs = [ glib boost ]
55
-
++ opt stdenv.isDarwin darwin.apple_sdk.frameworks.CoreAudioKit
56
-
++ opt stdenv.isLinux systemd
57
-
++ opt (stdenv.isLinux && alsaSupport) alsaLib
58
-
++ opt avahiSupport avahi
59
-
++ opt avahiSupport dbus
60
-
++ opt flacSupport flac
61
-
++ opt vorbisSupport libvorbis
62
-
# using libmad to decode mp3 files on darwin is causing a segfault -- there
63
-
# is probably a solution, but I'm disabling it for now
64
-
++ opt (!stdenv.isDarwin && madSupport) libmad
65
-
++ opt id3tagSupport libid3tag
66
-
++ opt mikmodSupport libmikmod
67
-
++ opt shoutSupport libshout
68
-
++ opt sqliteSupport sqlite
69
-
++ opt curlSupport curl
70
-
++ opt bzip2Support bzip2
71
-
++ opt audiofileSupport audiofile
72
-
++ opt ffmpegSupport ffmpeg
73
-
++ opt fluidsynthSupport fluidsynth
74
-
++ opt samplerateSupport libsamplerate
75
-
++ opt mmsSupport libmms
76
-
++ opt mpg123Support mpg123
77
-
++ opt aacSupport faad2
78
-
++ opt lameSupport lame
79
-
++ opt zipSupport zziplib
80
-
++ opt (!stdenv.isDarwin && pulseaudioSupport) libpulseaudio
81
-
++ opt (!stdenv.isDarwin && jackSupport) libjack2
82
-
++ opt gmeSupport game-music-emu
83
-
++ opt icuSupport icu
84
-
++ opt clientSupport mpd_clientlib
85
-
++ opt opusSupport libopus
86
-
++ opt soundcloudSupport yajl
87
-
++ opt (!stdenv.isDarwin && nfsSupport) libnfs
88
-
++ opt (!stdenv.isDarwin && smbSupport) samba;
88
+
knownFeatures = builtins.attrNames featureDependencies;
89
+
platformFeatures = lib.subtractLists platformMask knownFeatures;
91
+
features_ = if (features == null )
92
+
then platformFeatures
94
+
let unknown = lib.subtractLists knownFeatures features; in
96
+
then throw "Unknown feature(s): ${lib.concatStringsSep " " unknown}"
98
+
let unsupported = lib.subtractLists platformFeatures features; in
99
+
if (unsupported != [])
100
+
then throw "Feature(s) ${lib.concatStringsSep " " unsupported} are not supported on ${stdenv.hostPlatform.system}"
103
+
in stdenv.mkDerivation rec {
105
+
version = "0.21.16";
107
+
src = fetchFromGitHub {
108
+
owner = "MusicPlayerDaemon";
110
+
rev = "v${version}";
111
+
sha256 = "0yfzn1hcyww8z5pp70n7iinycz097vjc6q9fzmfrc6ikvz3db8f4";
90
-
nativeBuildInputs = [ autoreconfHook pkgconfig ];
114
+
buildInputs = [ glib boost ]
115
+
++ (lib.concatLists (lib.attrVals features_ featureDependencies))
116
+
++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.AudioToolbox;
92
-
enableParallelBuilding = true;
118
+
nativeBuildInputs = [ meson ninja pkgconfig ];
95
-
[ (mkFlag (!stdenv.isDarwin && alsaSupport) "alsa")
96
-
(mkFlag flacSupport "flac")
97
-
(mkFlag vorbisSupport "vorbis")
98
-
(mkFlag vorbisSupport "vorbis-encoder")
99
-
(mkFlag (!stdenv.isDarwin && madSupport) "mad")
100
-
(mkFlag mikmodSupport "mikmod")
101
-
(mkFlag id3tagSupport "id3")
102
-
(mkFlag shoutSupport "shout")
103
-
(mkFlag sqliteSupport "sqlite")
104
-
(mkFlag curlSupport "curl")
105
-
(mkFlag audiofileSupport "audiofile")
106
-
(mkFlag bzip2Support "bzip2")
107
-
(mkFlag ffmpegSupport "ffmpeg")
108
-
(mkFlag fluidsynthSupport "fluidsynth")
109
-
(mkFlag zipSupport "zzip")
110
-
(mkFlag samplerateSupport "lsr")
111
-
(mkFlag mmsSupport "mms")
112
-
(mkFlag mpg123Support "mpg123")
113
-
(mkFlag aacSupport "aac")
114
-
(mkFlag lameSupport "lame-encoder")
115
-
(mkFlag (!stdenv.isDarwin && pulseaudioSupport) "pulse")
116
-
(mkFlag (!stdenv.isDarwin && jackSupport) "jack")
117
-
(mkFlag stdenv.isDarwin "osx")
118
-
(mkFlag icuSupport "icu")
119
-
(mkFlag gmeSupport "gme")
120
-
(mkFlag clientSupport "libmpdclient")
121
-
(mkFlag opusSupport "opus")
122
-
(mkFlag soundcloudSupport "soundcloud")
123
-
(mkFlag (!stdenv.isDarwin && nfsSupport) "libnfs")
124
-
(mkFlag (!stdenv.isDarwin && smbSupport) "smbclient")
126
-
"--with-zeroconf=avahi"
128
-
++ opt stdenv.isLinux
129
-
"--with-systemdsystemunitdir=$(out)/etc/systemd/system";
120
+
enableParallelBuilding = true;
132
-
${if shoutSupport then "-lshout" else ""}
122
+
mesonAutoFeatures = "disabled";
124
+
map (x: "-D${x}=enabled") features_
125
+
++ map (x: "-D${x}=disabled") (lib.subtractLists features_ knownFeatures)
126
+
++ lib.optional (builtins.elem "zeroconf" features_)
128
+
++ lib.optional (builtins.elem "systemd" features_)
129
+
"-Dsystemd_system_unit_dir=etc/systemd/system";
135
-
meta = with stdenv.lib; {
136
-
description = "A flexible, powerful daemon for playing music";
137
-
homepage = http://mpd.wikia.com/wiki/Music_Player_Daemon_Wiki;
138
-
license = licenses.gpl2;
139
-
maintainers = with maintainers; [ astsmtl fuuzetsu ehmry fpletz ];
140
-
platforms = platforms.unix;
131
+
meta = with stdenv.lib; {
132
+
description = "A flexible, powerful daemon for playing music";
133
+
homepage = http://mpd.wikia.com/wiki/Music_Player_Daemon_Wiki;
134
+
license = licenses.gpl2;
135
+
maintainers = with maintainers; [ astsmtl fuuzetsu ehmry fpletz tobim ];
136
+
platforms = platforms.unix;
142
-
longDescription = ''
143
-
Music Player Daemon (MPD) is a flexible, powerful daemon for playing
144
-
music. Through plugins and libraries it can play a variety of sound
145
-
files while being controlled by its network protocol.
138
+
longDescription = ''
139
+
Music Player Daemon (MPD) is a flexible, powerful daemon for playing
140
+
music. Through plugins and libraries it can play a variety of sound
141
+
files while being controlled by its network protocol.
148
+
mpd-small = run { features = [
149
+
"webdav" "curl" "mms" "bzip2" "zzip"
150
+
"audiofile" "faad" "flac" "gme" "mad"
151
+
"mpg123" "opus" "vorbis" "vorbisenc"
152
+
"lame" "libsamplerate" "shout"
153
+
"libmpdclient" "id3tag" "expat" "pcre"
155
+
"soundcloud" "qobuz" "tidal"
156
+
] ++ lib.optionals stdenv.isLinux [
157
+
"alsa" "systemd" "syslog"
158
+
] ++ lib.optionals (!stdenv.isDarwin) [
161
+
mpdWithFeatures = run;