nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 175 lines 4.3 kB view raw
1{ 2 config, 3 lib, 4 stdenv, 5 fetchFromGitHub, 6 ncurses, 7 pkg-config, 8 libiconv, 9 10 alsaSupport ? stdenv.hostPlatform.isLinux, 11 alsa-lib ? null, 12 # simple fallback for everyone else 13 aoSupport ? !stdenv.hostPlatform.isLinux, 14 libao ? null, 15 jackSupport ? false, 16 libjack2 ? null, 17 samplerateSupport ? jackSupport, 18 libsamplerate ? null, 19 ossSupport ? false, 20 alsa-oss ? null, 21 pulseaudioSupport ? config.pulseaudio or false, 22 libpulseaudio ? null, 23 sndioSupport ? false, 24 sndio ? null, 25 mprisSupport ? stdenv.hostPlatform.isLinux, 26 systemd ? null, 27 28 # TODO: add these 29 #, artsSupport 30 #, roarSupport 31 #, sunSupport 32 #, waveoutSupport 33 34 cddbSupport ? true, 35 libcddb ? null, 36 cdioSupport ? true, 37 libcdio ? null, 38 libcdio-paranoia ? null, 39 cueSupport ? true, 40 libcue ? null, 41 discidSupport ? false, 42 libdiscid ? null, 43 ffmpegSupport ? true, 44 ffmpeg_7 ? null, 45 flacSupport ? true, 46 flac ? null, 47 madSupport ? true, 48 libmad ? null, 49 mikmodSupport ? true, 50 libmikmod ? null, 51 modplugSupport ? true, 52 libmodplug ? null, 53 mpcSupport ? true, 54 libmpcdec ? null, 55 tremorSupport ? false, 56 tremor ? null, 57 vorbisSupport ? true, 58 libvorbis ? null, 59 wavpackSupport ? true, 60 wavpack ? null, 61 opusSupport ? true, 62 opusfile ? null, 63 64 aacSupport ? false, 65 faad2 ? null, # already handled by ffmpeg 66 mp4Support ? false, 67 mp4v2 ? null, # ffmpeg does support mp4 better 68 69 # not in nixpkgs 70 #, vtxSupport ? true, libayemu ? null 71}: 72 73assert samplerateSupport -> jackSupport; 74 75# vorbis and tremor are mutually exclusive 76assert vorbisSupport -> !tremorSupport; 77assert tremorSupport -> !vorbisSupport; 78 79let 80 # https://github.com/cmus/cmus/issues/1459 81 ffmpeg = ffmpeg_7; 82 83 mkFlag = 84 b: f: dep: 85 if b then 86 { 87 flags = [ f ]; 88 deps = [ dep ]; 89 } 90 else 91 { 92 flags = [ ]; 93 deps = [ ]; 94 }; 95 96 opts = [ 97 # Audio output 98 (mkFlag alsaSupport "CONFIG_ALSA=y" alsa-lib) 99 (mkFlag aoSupport "CONFIG_AO=y" libao) 100 (mkFlag jackSupport "CONFIG_JACK=y" libjack2) 101 (mkFlag samplerateSupport "CONFIG_SAMPLERATE=y" libsamplerate) 102 (mkFlag ossSupport "CONFIG_OSS=y" alsa-oss) 103 (mkFlag pulseaudioSupport "CONFIG_PULSE=y" libpulseaudio) 104 (mkFlag sndioSupport "CONFIG_SNDIO=y" sndio) 105 (mkFlag mprisSupport "CONFIG_MPRIS=y" systemd) 106 107 #(mkFlag artsSupport "CONFIG_ARTS=y") 108 #(mkFlag roarSupport "CONFIG_ROAR=y") 109 #(mkFlag sunSupport "CONFIG_SUN=y") 110 #(mkFlag waveoutSupport "CONFIG_WAVEOUT=y") 111 112 # Input file formats 113 (mkFlag cddbSupport "CONFIG_CDDB=y" libcddb) 114 (mkFlag cdioSupport "CONFIG_CDIO=y" [ 115 libcdio 116 libcdio-paranoia 117 ]) 118 (mkFlag cueSupport "CONFIG_CUE=y" libcue) 119 (mkFlag discidSupport "CONFIG_DISCID=y" libdiscid) 120 (mkFlag ffmpegSupport "CONFIG_FFMPEG=y" ffmpeg) 121 (mkFlag flacSupport "CONFIG_FLAC=y" flac) 122 (mkFlag madSupport "CONFIG_MAD=y" libmad) 123 (mkFlag mikmodSupport "CONFIG_MIKMOD=y" libmikmod) 124 (mkFlag modplugSupport "CONFIG_MODPLUG=y" libmodplug) 125 (mkFlag mpcSupport "CONFIG_MPC=y" libmpcdec) 126 (mkFlag tremorSupport "CONFIG_TREMOR=y" tremor) 127 (mkFlag vorbisSupport "CONFIG_VORBIS=y" libvorbis) 128 (mkFlag wavpackSupport "CONFIG_WAVPACK=y" wavpack) 129 (mkFlag opusSupport "CONFIG_OPUS=y" opusfile) 130 131 (mkFlag mp4Support "CONFIG_MP4=y" mp4v2) 132 (mkFlag aacSupport "CONFIG_AAC=y" faad2) 133 134 #(mkFlag vtxSupport "CONFIG_VTX=y" libayemu) 135 ]; 136in 137 138stdenv.mkDerivation (finalAttrs: { 139 pname = "cmus"; 140 version = "2.12.0"; 141 142 src = fetchFromGitHub { 143 owner = "cmus"; 144 repo = "cmus"; 145 rev = "v${finalAttrs.version}"; 146 hash = "sha256-8hgibGtkiwzenMI9YImIApRmw2EzTwE6RhglALpUkp4="; 147 }; 148 149 nativeBuildInputs = [ pkg-config ]; 150 buildInputs = [ 151 ncurses 152 ] 153 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 154 libiconv 155 ] 156 ++ lib.flatten (lib.concatMap (a: a.deps) opts); 157 158 prefixKey = "prefix="; 159 160 configureFlags = [ 161 "CONFIG_WAV=y" 162 "HOSTCC=${stdenv.cc.targetPrefix}cc" 163 ] 164 ++ lib.concatMap (a: a.flags) opts; 165 166 makeFlags = [ "LD=$(CC)" ]; 167 168 meta = { 169 description = "Small, fast and powerful console music player for Linux and *BSD"; 170 homepage = "https://cmus.github.io/"; 171 license = lib.licenses.gpl2Only; 172 maintainers = with lib.maintainers; [ oxij ]; 173 platforms = with lib.platforms; linux ++ darwin; 174 }; 175})