2020-05-16 15:05:38 +01:00
|
|
|
{ stdenv, fetchFromGitHub, meson, ninja, pkg-config, glib, systemd, boost, darwin
|
2019-11-13 15:38:46 +00:00
|
|
|
# Inputs
|
|
|
|
, curl, libmms, libnfs, samba
|
|
|
|
# Archive support
|
|
|
|
, bzip2, zziplib
|
|
|
|
# Codecs
|
2020-07-02 19:10:47 +01:00
|
|
|
, audiofile, faad2, ffmpeg, flac, fluidsynth, game-music-emu
|
2019-11-13 15:38:46 +00:00
|
|
|
, libmad, libmikmod, mpg123, libopus, libvorbis, lame
|
|
|
|
# Filters
|
|
|
|
, libsamplerate
|
|
|
|
# Outputs
|
|
|
|
, alsaLib, libjack2, libpulseaudio, libshout
|
|
|
|
# Misc
|
|
|
|
, icu, sqlite, avahi, dbus, pcre, libgcrypt, expat
|
|
|
|
# Services
|
|
|
|
, yajl
|
|
|
|
# Client support
|
|
|
|
, mpd_clientlib
|
|
|
|
# Tag support
|
|
|
|
, libid3tag
|
2020-04-16 08:22:28 +01:00
|
|
|
, nixosTests
|
2020-05-16 15:08:25 +01:00
|
|
|
# For documentation
|
|
|
|
, doxygen
|
|
|
|
, python3Packages # for sphinx-build
|
2020-05-16 15:08:05 +01:00
|
|
|
# For tests
|
|
|
|
, gtest
|
|
|
|
, fetchpatch # used to fetch an upstream patch fixing a failing test
|
|
|
|
, zip
|
2014-06-01 16:07:46 +01:00
|
|
|
}:
|
2013-01-18 11:01:14 +00:00
|
|
|
|
2010-04-18 20:26:30 +01:00
|
|
|
let
|
2019-11-13 15:38:46 +00:00
|
|
|
lib = stdenv.lib;
|
2017-06-09 05:04:23 +01:00
|
|
|
|
2019-11-13 15:38:46 +00:00
|
|
|
featureDependencies = {
|
|
|
|
# Storage plugins
|
|
|
|
udisks = [ dbus ];
|
|
|
|
webdav = [ curl expat ];
|
|
|
|
# Input plugins
|
|
|
|
curl = [ curl ];
|
|
|
|
mms = [ libmms ];
|
|
|
|
nfs = [ libnfs ];
|
|
|
|
smbclient = [ samba ];
|
|
|
|
# Archive support
|
|
|
|
bzip2 = [ bzip2 ];
|
|
|
|
zzip = [ zziplib ];
|
|
|
|
# Decoder plugins
|
|
|
|
audiofile = [ audiofile ];
|
|
|
|
faad = [ faad2 ];
|
2020-07-02 19:10:47 +01:00
|
|
|
ffmpeg = [ ffmpeg ];
|
2019-11-13 15:38:46 +00:00
|
|
|
flac = [ flac ];
|
|
|
|
fluidsynth = [ fluidsynth ];
|
|
|
|
gme = [ game-music-emu ];
|
|
|
|
mad = [ libmad ];
|
|
|
|
mikmod = [ libmikmod ];
|
|
|
|
mpg123 = [ mpg123 ];
|
|
|
|
opus = [ libopus ];
|
|
|
|
vorbis = [ libvorbis ];
|
|
|
|
# Encoder plugins
|
|
|
|
vorbisenc = [ libvorbis ];
|
|
|
|
lame = [ lame ];
|
|
|
|
# Filter plugins
|
|
|
|
libsamplerate = [ libsamplerate ];
|
|
|
|
# Output plugins
|
|
|
|
alsa = [ alsaLib ];
|
|
|
|
jack = [ libjack2 ];
|
|
|
|
pulse = [ libpulseaudio ];
|
|
|
|
shout = [ libshout ];
|
|
|
|
# Commercial services
|
|
|
|
qobuz = [ curl libgcrypt yajl ];
|
|
|
|
soundcloud = [ curl yajl ];
|
|
|
|
tidal = [ curl yajl ];
|
|
|
|
# Client support
|
|
|
|
libmpdclient = [ mpd_clientlib ];
|
|
|
|
# Tag support
|
|
|
|
id3tag = [ libid3tag ];
|
|
|
|
# Misc
|
|
|
|
dbus = [ dbus ];
|
|
|
|
expat = [ expat ];
|
|
|
|
icu = [ icu ];
|
|
|
|
pcre = [ pcre ];
|
|
|
|
sqlite = [ sqlite ];
|
|
|
|
syslog = [ ];
|
|
|
|
systemd = [ systemd ];
|
|
|
|
yajl = [ yajl ];
|
|
|
|
zeroconf = [ avahi dbus ];
|
2010-04-18 20:26:30 +01:00
|
|
|
};
|
2012-10-25 02:15:48 +01:00
|
|
|
|
2019-11-13 15:38:46 +00:00
|
|
|
run = { features ? null }:
|
|
|
|
let
|
|
|
|
# Disable platform specific features if needed
|
|
|
|
# using libmad to decode mp3 files on darwin is causing a segfault -- there
|
|
|
|
# is probably a solution, but I'm disabling it for now
|
2019-12-14 03:22:22 +00:00
|
|
|
platformMask = lib.optionals stdenv.isDarwin [ "mad" "pulse" "jack" "nfs" "smbclient" ]
|
2019-11-13 15:38:46 +00:00
|
|
|
++ lib.optionals (!stdenv.isLinux) [ "alsa" "systemd" "syslog" ];
|
2017-03-23 21:57:51 +00:00
|
|
|
|
2019-11-13 15:38:46 +00:00
|
|
|
knownFeatures = builtins.attrNames featureDependencies;
|
|
|
|
platformFeatures = lib.subtractLists platformMask knownFeatures;
|
2013-01-18 11:01:14 +00:00
|
|
|
|
2019-11-13 15:38:46 +00:00
|
|
|
features_ = if (features == null )
|
|
|
|
then platformFeatures
|
|
|
|
else
|
|
|
|
let unknown = lib.subtractLists knownFeatures features; in
|
|
|
|
if (unknown != [])
|
|
|
|
then throw "Unknown feature(s): ${lib.concatStringsSep " " unknown}"
|
|
|
|
else
|
|
|
|
let unsupported = lib.subtractLists platformFeatures features; in
|
|
|
|
if (unsupported != [])
|
|
|
|
then throw "Feature(s) ${lib.concatStringsSep " " unsupported} are not supported on ${stdenv.hostPlatform.system}"
|
|
|
|
else features;
|
2017-06-09 05:04:23 +01:00
|
|
|
|
2019-11-13 15:38:46 +00:00
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
pname = "mpd";
|
2020-05-05 23:56:54 +01:00
|
|
|
version = "0.21.23";
|
2017-06-09 05:04:23 +01:00
|
|
|
|
2019-11-13 15:38:46 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "MusicPlayerDaemon";
|
|
|
|
repo = "MPD";
|
|
|
|
rev = "v${version}";
|
2020-05-05 23:56:54 +01:00
|
|
|
sha256 = "0jnhjhm1ilpcwb4f58b8pgyzjq3dlr0j2xyk0zck0afwkdxyj9cb";
|
2019-11-13 15:38:46 +00:00
|
|
|
};
|
2012-10-25 02:15:48 +01:00
|
|
|
|
2020-05-16 15:08:05 +01:00
|
|
|
# Won't be needed when 0.21.24 will be out
|
|
|
|
patches = [
|
|
|
|
# Tests fail otherwise, see https://github.com/MusicPlayerDaemon/MPD/issues/844
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/MusicPlayerDaemon/MPD/commit/7aea2853612743e111ae5e947c8d467049e291a8.patch";
|
|
|
|
sha256 = "1bmxlsaiz3wlg1yyc4rkwsmgvc0pirv0s1vdxxsn91yssmh16c2g";
|
|
|
|
excludes = [
|
|
|
|
# The patch fails otherwise because it tries to update the NEWS
|
|
|
|
# file which doesn't have the title "ver 0.21.24" yet.
|
|
|
|
"NEWS"
|
|
|
|
];
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2020-05-16 15:06:55 +01:00
|
|
|
buildInputs = [
|
|
|
|
glib
|
|
|
|
boost
|
2020-05-16 15:08:05 +01:00
|
|
|
# According to the configurePhase of meson, gtest is considered a
|
|
|
|
# runtime dependency. Quoting:
|
|
|
|
#
|
|
|
|
# Run-time dependency GTest found: YES 1.10.0
|
|
|
|
gtest
|
2020-05-16 15:06:55 +01:00
|
|
|
]
|
2019-11-13 15:38:46 +00:00
|
|
|
++ (lib.concatLists (lib.attrVals features_ featureDependencies))
|
2019-12-14 03:22:22 +00:00
|
|
|
++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.AudioToolbox darwin.apple_sdk.frameworks.AudioUnit ];
|
2012-10-25 02:15:48 +01:00
|
|
|
|
2020-05-16 15:06:55 +01:00
|
|
|
nativeBuildInputs = [
|
|
|
|
meson
|
|
|
|
ninja
|
|
|
|
pkg-config
|
2020-05-16 15:08:25 +01:00
|
|
|
python3Packages.sphinx
|
|
|
|
doxygen
|
2020-05-16 15:06:55 +01:00
|
|
|
];
|
2013-07-04 06:07:37 +01:00
|
|
|
|
2020-05-16 15:08:05 +01:00
|
|
|
# Otherwise, the meson log says:
|
|
|
|
#
|
|
|
|
# Program zip found: NO
|
|
|
|
checkInputs = [ zip ];
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
2019-11-13 15:38:46 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
mesonAutoFeatures = "disabled";
|
2020-05-16 15:08:05 +01:00
|
|
|
|
2020-05-16 15:08:25 +01:00
|
|
|
outputs = [ "out" "doc" "man" ];
|
|
|
|
|
2020-05-16 15:08:05 +01:00
|
|
|
mesonFlags = [
|
2020-05-16 15:08:25 +01:00
|
|
|
# Documentation is enabled unconditionally but it's not installed
|
|
|
|
# unconditionally thanks to the outputs being split
|
|
|
|
"-Ddocumentation=true"
|
2020-05-16 15:08:05 +01:00
|
|
|
"-Dtest=true"
|
|
|
|
]
|
|
|
|
++ map (x: "-D${x}=enabled") features_
|
2019-11-13 15:38:46 +00:00
|
|
|
++ map (x: "-D${x}=disabled") (lib.subtractLists features_ knownFeatures)
|
|
|
|
++ lib.optional (builtins.elem "zeroconf" features_)
|
|
|
|
"-Dzeroconf=avahi"
|
|
|
|
++ lib.optional (builtins.elem "systemd" features_)
|
|
|
|
"-Dsystemd_system_unit_dir=etc/systemd/system";
|
|
|
|
|
2020-04-16 08:22:28 +01:00
|
|
|
passthru.tests.nixos = nixosTests.mpd;
|
|
|
|
|
2019-11-13 15:38:46 +00:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "A flexible, powerful daemon for playing music";
|
2020-03-02 15:30:28 +00:00
|
|
|
homepage = "https://www.musicpd.org/";
|
2019-11-13 15:38:46 +00:00
|
|
|
license = licenses.gpl2;
|
2019-12-05 07:29:48 +00:00
|
|
|
maintainers = with maintainers; [ astsmtl ehmry fpletz tobim ];
|
2019-11-13 15:38:46 +00:00
|
|
|
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.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
mpd = run { };
|
|
|
|
mpd-small = run { features = [
|
|
|
|
"webdav" "curl" "mms" "bzip2" "zzip"
|
|
|
|
"audiofile" "faad" "flac" "gme" "mad"
|
|
|
|
"mpg123" "opus" "vorbis" "vorbisenc"
|
|
|
|
"lame" "libsamplerate" "shout"
|
|
|
|
"libmpdclient" "id3tag" "expat" "pcre"
|
|
|
|
"yajl" "sqlite"
|
|
|
|
"soundcloud" "qobuz" "tidal"
|
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
"alsa" "systemd" "syslog"
|
|
|
|
] ++ lib.optionals (!stdenv.isDarwin) [
|
|
|
|
"mad" "jack" "nfs"
|
|
|
|
]; };
|
|
|
|
mpdWithFeatures = run;
|
2010-04-18 20:26:30 +01:00
|
|
|
}
|