2021-01-19 06:50:56 +00:00
|
|
|
{ config, lib, stdenv, fetchFromGitHub, runCommand, ncurses, pkg-config
|
2021-02-09 04:18:02 +00:00
|
|
|
, libiconv, CoreAudio, AudioUnit
|
2015-12-05 13:19:29 +00:00
|
|
|
|
|
|
|
, alsaSupport ? stdenv.isLinux, alsaLib ? null
|
|
|
|
# simple fallback for everyone else
|
|
|
|
, aoSupport ? !stdenv.isLinux, libao ? null
|
|
|
|
, jackSupport ? false, libjack ? null
|
|
|
|
, samplerateSupport ? jackSupport, libsamplerate ? null
|
|
|
|
, ossSupport ? false, alsaOss ? null
|
2019-02-03 15:31:26 +00:00
|
|
|
, pulseaudioSupport ? config.pulseaudio or false, libpulseaudio ? null
|
2019-03-07 01:33:02 +00:00
|
|
|
, mprisSupport ? stdenv.isLinux, systemd ? null
|
2015-12-05 13:19:29 +00:00
|
|
|
|
|
|
|
# TODO: add these
|
|
|
|
#, artsSupport
|
|
|
|
#, roarSupport
|
|
|
|
#, sndioSupport
|
|
|
|
#, sunSupport
|
|
|
|
#, waveoutSupport
|
|
|
|
|
|
|
|
, cddbSupport ? true, libcddb ? null
|
2018-03-04 18:30:09 +00:00
|
|
|
, cdioSupport ? true, libcdio ? null, libcdio-paranoia ? null
|
2015-12-05 13:19:29 +00:00
|
|
|
, cueSupport ? true, libcue ? null
|
2017-01-24 21:39:01 +00:00
|
|
|
, discidSupport ? (!stdenv.isDarwin), libdiscid ? null
|
2015-12-05 13:19:29 +00:00
|
|
|
, ffmpegSupport ? true, ffmpeg ? null
|
|
|
|
, flacSupport ? true, flac ? null
|
|
|
|
, madSupport ? true, libmad ? null
|
|
|
|
, mikmodSupport ? true, libmikmod ? null
|
|
|
|
, modplugSupport ? true, libmodplug ? null
|
|
|
|
, mpcSupport ? true, libmpcdec ? null
|
|
|
|
, tremorSupport ? false, tremor ? null
|
|
|
|
, vorbisSupport ? true, libvorbis ? null
|
|
|
|
, wavpackSupport ? true, wavpack ? null
|
2017-02-22 23:18:56 +00:00
|
|
|
, opusSupport ? true, opusfile ? null
|
2015-12-05 13:19:29 +00:00
|
|
|
|
2017-02-23 00:31:07 +00:00
|
|
|
, aacSupport ? false, faad2 ? null # already handled by ffmpeg
|
|
|
|
, mp4Support ? false, mp4v2 ? null # ffmpeg does support mp4 better
|
2015-12-05 13:19:29 +00:00
|
|
|
|
|
|
|
# not in nixpkgs
|
|
|
|
#, vtxSupport ? true, libayemu ? null
|
|
|
|
}:
|
|
|
|
|
2021-01-15 13:21:58 +00:00
|
|
|
with lib;
|
2015-12-05 13:19:29 +00:00
|
|
|
|
|
|
|
assert samplerateSupport -> jackSupport;
|
|
|
|
|
|
|
|
# vorbis and tremor are mutually exclusive
|
|
|
|
assert vorbisSupport -> !tremorSupport;
|
|
|
|
assert tremorSupport -> !vorbisSupport;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
mkFlag = b: f: dep: if b
|
|
|
|
then { flags = [ f ]; deps = [ dep ]; }
|
|
|
|
else { flags = []; deps = []; };
|
|
|
|
|
|
|
|
opts = [
|
|
|
|
# Audio output
|
|
|
|
(mkFlag alsaSupport "CONFIG_ALSA=y" alsaLib)
|
|
|
|
(mkFlag aoSupport "CONFIG_AO=y" libao)
|
|
|
|
(mkFlag jackSupport "CONFIG_JACK=y" libjack)
|
|
|
|
(mkFlag samplerateSupport "CONFIG_SAMPLERATE=y" libsamplerate)
|
|
|
|
(mkFlag ossSupport "CONFIG_OSS=y" alsaOss)
|
|
|
|
(mkFlag pulseaudioSupport "CONFIG_PULSE=y" libpulseaudio)
|
2019-03-07 01:33:02 +00:00
|
|
|
(mkFlag mprisSupport "CONFIG_MPRIS=y" systemd)
|
2015-12-05 13:19:29 +00:00
|
|
|
|
|
|
|
#(mkFlag artsSupport "CONFIG_ARTS=y")
|
|
|
|
#(mkFlag roarSupport "CONFIG_ROAR=y")
|
|
|
|
#(mkFlag sndioSupport "CONFIG_SNDIO=y")
|
|
|
|
#(mkFlag sunSupport "CONFIG_SUN=y")
|
|
|
|
#(mkFlag waveoutSupport "CONFIG_WAVEOUT=y")
|
|
|
|
|
|
|
|
# Input file formats
|
|
|
|
(mkFlag cddbSupport "CONFIG_CDDB=y" libcddb)
|
2018-03-04 18:30:09 +00:00
|
|
|
(mkFlag cdioSupport "CONFIG_CDIO=y" [ libcdio libcdio-paranoia ])
|
2015-12-05 13:19:29 +00:00
|
|
|
(mkFlag cueSupport "CONFIG_CUE=y" libcue)
|
|
|
|
(mkFlag discidSupport "CONFIG_DISCID=y" libdiscid)
|
|
|
|
(mkFlag ffmpegSupport "CONFIG_FFMPEG=y" ffmpeg)
|
|
|
|
(mkFlag flacSupport "CONFIG_FLAC=y" flac)
|
|
|
|
(mkFlag madSupport "CONFIG_MAD=y" libmad)
|
|
|
|
(mkFlag mikmodSupport "CONFIG_MIKMOD=y" libmikmod)
|
|
|
|
(mkFlag modplugSupport "CONFIG_MODPLUG=y" libmodplug)
|
|
|
|
(mkFlag mpcSupport "CONFIG_MPC=y" libmpcdec)
|
|
|
|
(mkFlag tremorSupport "CONFIG_TREMOR=y" tremor)
|
|
|
|
(mkFlag vorbisSupport "CONFIG_VORBIS=y" libvorbis)
|
|
|
|
(mkFlag wavpackSupport "CONFIG_WAVPACK=y" wavpack)
|
2017-02-22 23:18:56 +00:00
|
|
|
(mkFlag opusSupport "CONFIG_OPUS=y" opusfile)
|
2015-12-05 13:19:29 +00:00
|
|
|
|
2017-02-23 00:07:18 +00:00
|
|
|
(mkFlag mp4Support "CONFIG_MP4=y" mp4v2)
|
2017-02-23 00:06:57 +00:00
|
|
|
(mkFlag aacSupport "CONFIG_AAC=y" faad2)
|
2015-12-05 13:19:29 +00:00
|
|
|
|
|
|
|
#(mkFlag vtxSupport "CONFIG_VTX=y" libayemu)
|
|
|
|
];
|
|
|
|
|
2017-01-25 20:48:43 +00:00
|
|
|
clangGCC = runCommand "clang-gcc" {} ''
|
|
|
|
#! ${stdenv.shell}
|
|
|
|
mkdir -p $out/bin
|
|
|
|
ln -s ${stdenv.cc}/bin/clang $out/bin/gcc
|
|
|
|
ln -s ${stdenv.cc}/bin/clang++ $out/bin/g++
|
|
|
|
'';
|
|
|
|
|
2015-12-05 13:19:29 +00:00
|
|
|
in
|
2010-11-17 15:03:12 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "cmus";
|
2021-01-28 23:39:27 +00:00
|
|
|
version = "2.9.1";
|
2010-11-17 15:03:12 +00:00
|
|
|
|
2015-12-05 13:13:18 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "cmus";
|
|
|
|
repo = "cmus";
|
2016-06-19 12:08:16 +01:00
|
|
|
rev = "v${version}";
|
2021-01-28 23:39:27 +00:00
|
|
|
sha256 = "sha256-HEiEnEWf/MzhPO19VKTLYzhylpEvyzy1Jxs6EW2NU34=";
|
2010-11-17 15:03:12 +00:00
|
|
|
};
|
|
|
|
|
2015-12-05 13:19:29 +00:00
|
|
|
patches = [ ./option-debugging.patch ];
|
|
|
|
|
|
|
|
configurePhase = "./configure " + concatStringsSep " " ([
|
|
|
|
"prefix=$out"
|
|
|
|
"CONFIG_WAV=y"
|
|
|
|
] ++ concatMap (a: a.flags) opts);
|
2013-03-14 13:50:29 +00:00
|
|
|
|
2021-01-19 06:50:56 +00:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2017-09-05 22:26:13 +01:00
|
|
|
buildInputs = [ ncurses ]
|
2021-01-15 13:21:58 +00:00
|
|
|
++ lib.optional stdenv.cc.isClang clangGCC
|
2021-02-09 04:18:02 +00:00
|
|
|
++ lib.optionals stdenv.isDarwin [ libiconv CoreAudio AudioUnit ]
|
2019-11-09 23:52:53 +00:00
|
|
|
++ flatten (concatMap (a: a.deps) opts);
|
2013-03-14 13:50:29 +00:00
|
|
|
|
2017-08-06 19:34:14 +01:00
|
|
|
makeFlags = [ "LD=$(CC)" ];
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2014-08-24 15:21:08 +01:00
|
|
|
description = "Small, fast and powerful console music player for Linux and *BSD";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://cmus.github.io/";
|
2017-01-24 21:39:01 +00:00
|
|
|
license = licenses.gpl2;
|
|
|
|
maintainers = [ maintainers.oxij ];
|
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2010-11-17 15:03:12 +00:00
|
|
|
};
|
|
|
|
}
|