nixpkgs/pkgs/servers/mpd/default.nix

132 lines
4.4 KiB
Nix
Raw Normal View History

{ stdenv, fetchurl, fetchpatch, pkgconfig, glib, systemd, boost, darwin
, alsaSupport ? true, alsaLib
2017-02-16 00:17:31 +00:00
, avahiSupport ? true, avahi, dbus
, flacSupport ? true, flac
, vorbisSupport ? true, libvorbis
, madSupport ? true, libmad
, id3tagSupport ? true, libid3tag
, mikmodSupport ? true, libmikmod
2012-10-25 01:15:48 +00:00
, shoutSupport ? true, libshout
, sqliteSupport ? true, sqlite
, curlSupport ? true, curl
, audiofileSupport ? true, audiofile
, bzip2Support ? true, bzip2
, ffmpegSupport ? true, ffmpeg
, fluidsynthSupport ? true, fluidsynth
, zipSupport ? true, zziplib
, samplerateSupport ? true, libsamplerate
, mmsSupport ? true, libmms
, mpg123Support ? true, mpg123
2014-06-01 15:07:46 +00:00
, aacSupport ? true, faad2
, pulseaudioSupport ? true, libpulseaudio
, jackSupport ? true, libjack2
, gmeSupport ? true, game-music-emu
2014-10-19 16:34:03 +00:00
, icuSupport ? true, icu
, clientSupport ? true, mpd_clientlib
2015-04-17 15:37:35 +00:00
, opusSupport ? true, libopus
2016-05-12 20:35:13 +00:00
, soundcloudSupport ? true, yajl
2014-06-01 15:07:46 +00:00
}:
2017-02-16 00:17:31 +00:00
assert avahiSupport -> avahi != null && dbus != null;
let
opt = stdenv.lib.optional;
mkFlag = c: f: if c then "--enable-${f}" else "--disable-${f}";
major = "0.20";
2017-03-15 08:36:34 +00:00
minor = "6";
in stdenv.mkDerivation rec {
name = "mpd-${major}${if minor == "" then "" else "." + minor}";
src = fetchurl {
2015-04-17 15:37:35 +00:00
url = "http://www.musicpd.org/download/mpd/${major}/${name}.tar.xz";
2017-03-15 08:36:34 +00:00
sha256 = "0isbpa79m7zf09w3s1ry638cw96rxasy1ch66zl01k75i48mw1gl";
};
2012-10-25 01:15:48 +00:00
patches = [ ./x86.patch ];
2014-10-19 16:34:03 +00:00
buildInputs = [ pkgconfig glib boost ]
2016-09-13 16:02:20 +00:00
++ opt stdenv.isDarwin darwin.apple_sdk.frameworks.CoreAudioKit
2013-10-08 09:05:19 +00:00
++ opt stdenv.isLinux systemd
++ opt (stdenv.isLinux && alsaSupport) alsaLib
2017-02-16 00:17:31 +00:00
++ opt avahiSupport avahi
++ opt avahiSupport dbus
++ opt flacSupport flac
++ opt vorbisSupport libvorbis
# using libmad to decode mp3 files on darwin is causing a segfault -- there
# is probably a solution, but I'm disabling it for now
++ opt (!stdenv.isDarwin && madSupport) libmad
++ opt id3tagSupport libid3tag
++ opt mikmodSupport libmikmod
++ opt shoutSupport libshout
++ opt sqliteSupport sqlite
++ opt curlSupport curl
++ opt bzip2Support bzip2
++ opt audiofileSupport audiofile
++ opt ffmpegSupport ffmpeg
++ opt fluidsynthSupport fluidsynth
++ opt samplerateSupport libsamplerate
++ opt mmsSupport libmms
++ opt mpg123Support mpg123
++ opt aacSupport faad2
2014-06-01 15:07:46 +00:00
++ opt zipSupport zziplib
++ opt (!stdenv.isDarwin && pulseaudioSupport) libpulseaudio
++ opt (!stdenv.isDarwin && jackSupport) libjack2
++ opt gmeSupport game-music-emu
2015-04-17 15:37:35 +00:00
++ opt icuSupport icu
++ opt clientSupport mpd_clientlib
2016-05-12 20:35:13 +00:00
++ opt opusSupport libopus
++ opt soundcloudSupport yajl;
configureFlags =
[ (mkFlag (!stdenv.isDarwin && alsaSupport) "alsa")
(mkFlag flacSupport "flac")
(mkFlag vorbisSupport "vorbis")
(mkFlag vorbisSupport "vorbis-encoder")
(mkFlag (!stdenv.isDarwin && madSupport) "mad")
(mkFlag mikmodSupport "mikmod")
(mkFlag id3tagSupport "id3")
(mkFlag shoutSupport "shout")
(mkFlag sqliteSupport "sqlite")
(mkFlag curlSupport "curl")
(mkFlag audiofileSupport "audiofile")
(mkFlag bzip2Support "bzip2")
(mkFlag ffmpegSupport "ffmpeg")
(mkFlag fluidsynthSupport "fluidsynth")
(mkFlag zipSupport "zzip")
(mkFlag samplerateSupport "lsr")
(mkFlag mmsSupport "mms")
(mkFlag mpg123Support "mpg123")
(mkFlag aacSupport "aac")
(mkFlag (!stdenv.isDarwin && pulseaudioSupport) "pulse")
(mkFlag (!stdenv.isDarwin && jackSupport) "jack")
(mkFlag stdenv.isDarwin "osx")
(mkFlag icuSupport "icu")
(mkFlag gmeSupport "gme")
(mkFlag clientSupport "libmpdclient")
(mkFlag opusSupport "opus")
2016-05-12 20:35:13 +00:00
(mkFlag soundcloudSupport "soundcloud")
"--enable-debug"
2017-02-16 00:17:31 +00:00
"--with-zeroconf=avahi"
]
2013-10-08 09:05:19 +00:00
++ opt stdenv.isLinux
"--with-systemdsystemunitdir=$(out)/etc/systemd/system";
2012-10-25 01:15:48 +00:00
NIX_LDFLAGS = ''
${if shoutSupport then "-lshout" else ""}
'';
meta = with stdenv.lib; {
description = "A flexible, powerful daemon for playing music";
homepage = http://mpd.wikia.com/wiki/Music_Player_Daemon_Wiki;
license = licenses.gpl2;
maintainers = with maintainers; [ astsmtl fuuzetsu ehmry fpletz ];
platforms = platforms.unix;
longDescription = ''
Music Player Daemon (MPD) is a flexible, powerful daemon for playing
music. Through plugins and libraries it can play a variety of sound
files while being controlled by its network protocol.
'';
};
}