2021-10-24 17:01:22 +02:00
|
|
|
{ lib, stdenv, fetchFromGitHub, meson, ninja, pkg-config, glib, systemd, boost, fmt
|
2021-06-04 16:37:27 +02:00
|
|
|
# Darwin inputs
|
|
|
|
, AudioToolbox, AudioUnit
|
2019-11-13 16:38:46 +01:00
|
|
|
# Inputs
|
2020-09-26 17:38:36 +02:00
|
|
|
, curl, libmms, libnfs, liburing, samba
|
2019-11-13 16:38:46 +01:00
|
|
|
# Archive support
|
|
|
|
, bzip2, zziplib
|
|
|
|
# Codecs
|
2020-07-02 20:10:47 +02:00
|
|
|
, audiofile, faad2, ffmpeg, flac, fluidsynth, game-music-emu
|
2019-11-13 16:38:46 +01:00
|
|
|
, libmad, libmikmod, mpg123, libopus, libvorbis, lame
|
|
|
|
# Filters
|
|
|
|
, libsamplerate
|
|
|
|
# Outputs
|
2021-10-24 17:01:22 +02:00
|
|
|
, alsa-lib, libjack2, libpulseaudio, libshout, pipewire
|
2019-11-13 16:38:46 +01:00
|
|
|
# Misc
|
|
|
|
, icu, sqlite, avahi, dbus, pcre, libgcrypt, expat
|
|
|
|
# Services
|
|
|
|
, yajl
|
|
|
|
# Client support
|
2021-02-12 12:28:36 +01:00
|
|
|
, libmpdclient
|
2019-11-13 16:38:46 +01:00
|
|
|
# Tag support
|
|
|
|
, libid3tag
|
2020-04-16 09:22:28 +02:00
|
|
|
, nixosTests
|
2020-05-16 16:08:25 +02:00
|
|
|
# For documentation
|
|
|
|
, doxygen
|
|
|
|
, python3Packages # for sphinx-build
|
2020-05-16 16:08:05 +02:00
|
|
|
# For tests
|
|
|
|
, gtest
|
|
|
|
, zip
|
2014-06-01 17:07:46 +02:00
|
|
|
}:
|
2013-01-18 12:01:14 +01:00
|
|
|
|
2010-04-18 21:26:30 +02:00
|
|
|
let
|
2020-09-26 17:38:36 +02:00
|
|
|
concatAttrVals = nameList: set: lib.concatMap (x: set.${x} or []) nameList;
|
2017-06-09 06:04:23 +02:00
|
|
|
|
2019-11-13 16:38:46 +01:00
|
|
|
featureDependencies = {
|
|
|
|
# Storage plugins
|
|
|
|
udisks = [ dbus ];
|
|
|
|
webdav = [ curl expat ];
|
|
|
|
# Input plugins
|
|
|
|
curl = [ curl ];
|
2020-09-26 17:38:36 +02:00
|
|
|
io_uring = [ liburing ];
|
2019-11-13 16:38:46 +01:00
|
|
|
mms = [ libmms ];
|
|
|
|
nfs = [ libnfs ];
|
|
|
|
smbclient = [ samba ];
|
|
|
|
# Archive support
|
|
|
|
bzip2 = [ bzip2 ];
|
|
|
|
zzip = [ zziplib ];
|
|
|
|
# Decoder plugins
|
|
|
|
audiofile = [ audiofile ];
|
|
|
|
faad = [ faad2 ];
|
2020-07-02 20:10:47 +02:00
|
|
|
ffmpeg = [ ffmpeg ];
|
2019-11-13 16:38:46 +01: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
|
2021-06-10 04:57:09 +02:00
|
|
|
alsa = [ alsa-lib ];
|
2019-11-13 16:38:46 +01:00
|
|
|
jack = [ libjack2 ];
|
2021-10-24 17:01:22 +02:00
|
|
|
pipewire = [ pipewire ];
|
2019-11-13 16:38:46 +01:00
|
|
|
pulse = [ libpulseaudio ];
|
|
|
|
shout = [ libshout ];
|
|
|
|
# Commercial services
|
|
|
|
qobuz = [ curl libgcrypt yajl ];
|
|
|
|
soundcloud = [ curl yajl ];
|
|
|
|
tidal = [ curl yajl ];
|
|
|
|
# Client support
|
2021-02-12 12:28:36 +01:00
|
|
|
libmpdclient = [ libmpdclient ];
|
2019-11-13 16:38:46 +01:00
|
|
|
# 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 21:26:30 +02:00
|
|
|
};
|
2012-10-25 03:15:48 +02:00
|
|
|
|
2020-09-26 17:38:36 +02:00
|
|
|
nativeFeatureDependencies = {
|
|
|
|
documentation = [ doxygen python3Packages.sphinx ];
|
|
|
|
};
|
|
|
|
|
2019-11-13 16:38:46 +01: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 04:22:22 +01:00
|
|
|
platformMask = lib.optionals stdenv.isDarwin [ "mad" "pulse" "jack" "nfs" "smbclient" ]
|
2021-11-17 21:51:08 +01:00
|
|
|
++ lib.optionals (!stdenv.isLinux) [ "alsa" "pipewire" "io_uring" "systemd" "syslog" ];
|
2017-03-23 22:57:51 +01:00
|
|
|
|
2020-09-26 17:38:36 +02:00
|
|
|
knownFeatures = builtins.attrNames featureDependencies ++ builtins.attrNames nativeFeatureDependencies;
|
2019-11-13 16:38:46 +01:00
|
|
|
platformFeatures = lib.subtractLists platformMask knownFeatures;
|
2013-01-18 12:01:14 +01:00
|
|
|
|
2019-11-13 16:38:46 +01: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 06:04:23 +02:00
|
|
|
|
2019-11-13 16:38:46 +01:00
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
pname = "mpd";
|
2021-11-17 17:48:28 +01:00
|
|
|
version = "0.23.4";
|
2017-06-09 06:04:23 +02:00
|
|
|
|
2019-11-13 16:38:46 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "MusicPlayerDaemon";
|
|
|
|
repo = "MPD";
|
|
|
|
rev = "v${version}";
|
2021-11-17 17:48:28 +01:00
|
|
|
sha256 = "sha256-siMFLV1fKdRt8To6AhLXmAAsgqZCA/bbvmlhbb6hLic=";
|
2019-11-13 16:38:46 +01:00
|
|
|
};
|
2012-10-25 03:15:48 +02:00
|
|
|
|
2020-05-16 16:06:55 +02:00
|
|
|
buildInputs = [
|
|
|
|
glib
|
|
|
|
boost
|
2021-10-24 17:01:22 +02:00
|
|
|
fmt
|
2020-05-16 16:08:05 +02: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 16:06:55 +02:00
|
|
|
]
|
2020-09-26 17:38:36 +02:00
|
|
|
++ concatAttrVals features_ featureDependencies
|
2021-06-04 16:37:27 +02:00
|
|
|
++ lib.optionals stdenv.isDarwin [ AudioToolbox AudioUnit ];
|
2012-10-25 03:15:48 +02:00
|
|
|
|
2020-05-16 16:06:55 +02:00
|
|
|
nativeBuildInputs = [
|
|
|
|
meson
|
|
|
|
ninja
|
|
|
|
pkg-config
|
2020-09-26 17:38:36 +02:00
|
|
|
]
|
|
|
|
++ concatAttrVals features_ nativeFeatureDependencies;
|
2013-07-04 07:07:37 +02:00
|
|
|
|
2020-05-16 16:08:05 +02:00
|
|
|
# Otherwise, the meson log says:
|
|
|
|
#
|
|
|
|
# Program zip found: NO
|
|
|
|
checkInputs = [ zip ];
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
2019-11-13 16:38:46 +01:00
|
|
|
mesonAutoFeatures = "disabled";
|
2020-05-16 16:08:05 +02:00
|
|
|
|
2020-10-22 12:55:25 +02:00
|
|
|
outputs = [ "out" "doc" ]
|
|
|
|
++ lib.optional (builtins.elem "documentation" features_) "man";
|
2020-05-16 16:08:25 +02:00
|
|
|
|
2020-05-16 16:08:05 +02:00
|
|
|
mesonFlags = [
|
|
|
|
"-Dtest=true"
|
2020-09-26 17:38:36 +02:00
|
|
|
"-Dmanpages=true"
|
|
|
|
"-Dhtml_manual=true"
|
2020-05-16 16:08:05 +02:00
|
|
|
]
|
|
|
|
++ map (x: "-D${x}=enabled") features_
|
2019-11-13 16:38:46 +01: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 09:22:28 +02:00
|
|
|
passthru.tests.nixos = nixosTests.mpd;
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2019-11-13 16:38:46 +01:00
|
|
|
description = "A flexible, powerful daemon for playing music";
|
2020-03-02 16:30:28 +01:00
|
|
|
homepage = "https://www.musicpd.org/";
|
2021-02-26 08:49:51 +01:00
|
|
|
license = licenses.gpl2Only;
|
2019-12-05 08:29:48 +01:00
|
|
|
maintainers = with maintainers; [ astsmtl ehmry fpletz tobim ];
|
2019-11-13 16:38:46 +01: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"
|
2021-01-02 16:23:23 +01:00
|
|
|
"audiofile" "faad" "flac" "gme"
|
2019-11-13 16:38:46 +01:00
|
|
|
"mpg123" "opus" "vorbis" "vorbisenc"
|
|
|
|
"lame" "libsamplerate" "shout"
|
|
|
|
"libmpdclient" "id3tag" "expat" "pcre"
|
|
|
|
"yajl" "sqlite"
|
|
|
|
"soundcloud" "qobuz" "tidal"
|
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
2020-09-26 17:38:36 +02:00
|
|
|
"alsa" "systemd" "syslog" "io_uring"
|
2019-11-13 16:38:46 +01:00
|
|
|
] ++ lib.optionals (!stdenv.isDarwin) [
|
|
|
|
"mad" "jack" "nfs"
|
|
|
|
]; };
|
|
|
|
mpdWithFeatures = run;
|
2010-04-18 21:26:30 +02:00
|
|
|
}
|