summaryrefslogtreecommitdiff
path: root/mpd.nix
diff options
context:
space:
mode:
Diffstat (limited to 'mpd.nix')
-rw-r--r--mpd.nix119
1 files changed, 119 insertions, 0 deletions
diff --git a/mpd.nix b/mpd.nix
new file mode 100644
index 00000000..36b78388
--- /dev/null
+++ b/mpd.nix
@@ -0,0 +1,119 @@
1{ stdenv, fetchurl, pkgconfig, glib, systemd, boost
2, alsaSupport ? true, alsaLib
3, flacSupport ? true, flac
4, vorbisSupport ? true, libvorbis
5, madSupport ? true, libmad
6, id3tagSupport ? true, libid3tag
7, mikmodSupport ? true, libmikmod
8, shoutSupport ? true, libshout
9, sqliteSupport ? true, sqlite
10, curlSupport ? true, curl
11, audiofileSupport ? true, audiofile
12, bzip2Support ? true, bzip2
13, ffmpegSupport ? true, ffmpeg
14, fluidsynthSupport ? true, fluidsynth
15, zipSupport ? true, zziplib
16, samplerateSupport ? true, libsamplerate
17, mmsSupport ? true, libmms
18, mpg123Support ? true, mpg123
19, aacSupport ? true, faad2
20, pulseaudioSupport ? true, pulseaudio
21, jackSupport ? true, jack2
22, gmeSupport ? true, game-music-emu
23, icuSupport ? true, icu
24, clientSupport ? false, mpd_clientlib
25, opusSupport ? true, libopus
26}:
27
28let
29 opt = stdenv.lib.optional;
30 mkFlag = c: f: if c then "--enable-${f}" else "--disable-${f}";
31 major = "0.19";
32 minor = "9";
33
34in stdenv.mkDerivation rec {
35 name = "mpd-${major}.${minor}";
36 src = fetchurl {
37 url = "http://www.musicpd.org/download/mpd/${major}/${name}.tar.xz";
38 sha256 = "0vzj365s4j0pw5w37lfhx3dmpkdp85driravsvx8rlrw0lii91a7";
39 };
40
41 buildInputs = [ pkgconfig glib boost ]
42 ++ opt stdenv.isLinux systemd
43 ++ opt (stdenv.isLinux && alsaSupport) alsaLib
44 ++ opt flacSupport flac
45 ++ opt vorbisSupport libvorbis
46 # using libmad to decode mp3 files on darwin is causing a segfault -- there
47 # is probably a solution, but I'm disabling it for now
48 ++ opt (!stdenv.isDarwin && madSupport) libmad
49 ++ opt id3tagSupport libid3tag
50 ++ opt mikmodSupport libmikmod
51 ++ opt shoutSupport libshout
52 ++ opt sqliteSupport sqlite
53 ++ opt curlSupport curl
54 ++ opt bzip2Support bzip2
55 ++ opt audiofileSupport audiofile
56 ++ opt ffmpegSupport ffmpeg
57 ++ opt fluidsynthSupport fluidsynth
58 ++ opt samplerateSupport libsamplerate
59 ++ opt mmsSupport libmms
60 ++ opt mpg123Support mpg123
61 ++ opt aacSupport faad2
62 ++ opt zipSupport zziplib
63 ++ opt pulseaudioSupport pulseaudio
64 ++ opt jackSupport jack2
65 ++ opt gmeSupport game-music-emu
66 ++ opt icuSupport icu
67 ++ opt clientSupport mpd_clientlib
68 ++ opt opusSupport libopus;
69
70 configureFlags =
71 [ (mkFlag (!stdenv.isDarwin && alsaSupport) "alsa")
72 (mkFlag flacSupport "flac")
73 (mkFlag vorbisSupport "vorbis")
74 (mkFlag vorbisSupport "vorbis-encoder")
75 (mkFlag (!stdenv.isDarwin && madSupport) "mad")
76 (mkFlag mikmodSupport "mikmod")
77 (mkFlag id3tagSupport "id3")
78 (mkFlag shoutSupport "shout")
79 (mkFlag sqliteSupport "sqlite")
80 (mkFlag curlSupport "curl")
81 (mkFlag audiofileSupport "audiofile")
82 (mkFlag bzip2Support "bzip2")
83 (mkFlag ffmpegSupport "ffmpeg")
84 (mkFlag fluidsynthSupport "fluidsynth")
85 (mkFlag zipSupport "zzip")
86 (mkFlag samplerateSupport "lsr")
87 (mkFlag mmsSupport "mms")
88 (mkFlag mpg123Support "mpg123")
89 (mkFlag aacSupport "aac")
90 (mkFlag pulseaudioSupport "pulse")
91 (mkFlag jackSupport "jack")
92 (mkFlag stdenv.isDarwin "osx")
93 (mkFlag icuSupport "icu")
94 (mkFlag gmeSupport "gme")
95 (mkFlag clientSupport "libmpdclient")
96 (mkFlag opusSupport "opus")
97 "--enable-debug"
98 ]
99 ++ opt stdenv.isLinux
100 "--with-systemdsystemunitdir=$(out)/etc/systemd/system";
101
102 NIX_LDFLAGS = ''
103 ${if shoutSupport then "-lshout" else ""}
104 '';
105
106 meta = with stdenv.lib; {
107 description = "A flexible, powerful daemon for playing music";
108 homepage = http://mpd.wikia.com/wiki/Music_Player_Daemon_Wiki;
109 license = licenses.gpl2;
110 maintainers = with maintainers; [ astsmtl fuuzetsu emery ];
111 platforms = platforms.unix;
112
113 longDescription = ''
114 Music Player Daemon (MPD) is a flexible, powerful daemon for playing
115 music. Through plugins and libraries it can play a variety of sound
116 files while being controlled by its network protocol.
117 '';
118 };
119}