nixpkgs/pkgs/applications/audio/clementine/default.nix

139 lines
3.9 KiB
Nix
Raw Normal View History

2017-08-03 02:54:50 +00:00
{ stdenv, fetchurl, boost, cmake, chromaprint, gettext, gst_all_1, liblastfm
, qt4, taglib, fftw, glew, qjson, sqlite, libgpod, libplist, usbmuxd, libmtp
, libpulseaudio, gvfs, libcdio, libechonest, libspotify, pcre, protobuf
, qca2, pkgconfig, sparsehash, config, makeWrapper, runCommand, gst_plugins }:
let
2015-05-05 02:07:56 +00:00
withSpotify = config.clementine.spotify or false;
withIpod = config.clementine.ipod or false;
withMTP = config.clementine.mtp or true;
withCD = config.clementine.cd or true;
withCloud = config.clementine.cloud or true;
2015-05-05 02:07:56 +00:00
2017-08-03 02:54:50 +00:00
version = "1.3.1";
2015-05-02 18:37:10 +00:00
exeName = "clementine";
2015-05-05 02:07:56 +00:00
src = fetchurl {
2017-08-03 02:54:50 +00:00
url = https://github.com/clementine-player/Clementine/archive/1.3.1.tar.gz;
sha256 = "0z7k73wyz54c3020lb6x2dgw0vz4ri7wcl3vs03qdj5pk8d971gq";
2015-05-05 02:07:56 +00:00
};
2015-05-05 02:07:56 +00:00
patches = [
./clementine-spotify-blob.patch
2017-08-03 02:54:50 +00:00
# Required so as to avoid adding libspotify as a build dependency (as it is
# unfree and thus would prevent us from having a free package).
./clementine-spotify-blob-remove-from-build.patch
2015-05-05 02:07:56 +00:00
];
2015-05-05 02:07:56 +00:00
buildInputs = [
boost
cmake
2017-08-03 02:54:50 +00:00
chromaprint
2015-05-05 02:07:56 +00:00
fftw
gettext
glew
2017-08-03 02:54:50 +00:00
gst_all_1.gst-plugins-base
gst_all_1.gstreamer
2015-05-05 02:07:56 +00:00
gvfs
2017-08-03 02:54:50 +00:00
libechonest
2015-05-05 02:07:56 +00:00
liblastfm
2017-08-03 02:54:50 +00:00
libpulseaudio
pcre
2015-05-05 02:07:56 +00:00
pkgconfig
protobuf
qca2
qjson
qt4
sqlite
taglib
]
++ stdenv.lib.optionals (withIpod) [libgpod libplist usbmuxd]
++ stdenv.lib.optionals (withMTP) [libmtp]
++ stdenv.lib.optionals (withCD) [libcdio]
++ stdenv.lib.optionals (withCloud) [sparsehash];
free = stdenv.mkDerivation {
name = "clementine-free-${version}";
2015-05-05 02:07:56 +00:00
inherit patches src buildInputs;
enableParallelBuilding = true;
postPatch = ''
sed -i src/CMakeLists.txt \
-e 's,-Werror,,g' \
-e 's,-Wno-unknown-warning-option,,g' \
-e 's,-Wno-unused-private-field,,g'
'';
2015-05-05 02:07:56 +00:00
meta = with stdenv.lib; {
homepage = http://www.clementine-player.org;
2015-05-05 02:07:56 +00:00
description = "A multiplatform music player";
license = licenses.gpl3Plus;
platforms = platforms.linux;
maintainers = [ maintainers.ttuegel ];
};
};
2015-05-05 02:07:56 +00:00
# Spotify blob for Clementine
blob = stdenv.mkDerivation {
name = "clementine-blob-${version}";
# Use the same patches and sources as Clementine
2017-08-03 02:54:50 +00:00
inherit src;
patches = [
./clementine-spotify-blob.patch
];
2015-05-05 02:07:56 +00:00
buildInputs = buildInputs ++ [ libspotify ];
# Only build and install the Spotify blob
preBuild = ''
cd ext/clementine-spotifyblob
'';
postInstall = ''
mkdir -p $out/libexec/clementine
mv $out/bin/clementine-spotifyblob $out/libexec/clementine
rmdir $out/bin
'';
enableParallelBuilding = true;
2015-05-05 02:07:56 +00:00
meta = with stdenv.lib; {
homepage = http://www.clementine-player.org;
2015-05-05 02:07:56 +00:00
description = "Spotify integration for Clementine";
# The blob itself is Apache-licensed, although libspotify is unfree.
license = licenses.asl20;
platforms = platforms.linux;
maintainers = [ maintainers.ttuegel ];
};
};
2013-12-31 13:51:11 +00:00
in
2015-05-05 02:07:56 +00:00
with stdenv.lib;
runCommand "clementine-${version}"
{
inherit blob free;
2015-05-05 02:07:56 +00:00
buildInputs = [ makeWrapper ] ++ gst_plugins; # for the setup-hooks
dontPatchELF = true;
dontStrip = true;
2015-05-05 02:07:56 +00:00
meta = {
homepage = http://www.clementine-player.org;
description = "A multiplatform music player"
2015-05-05 02:07:56 +00:00
+ " (" + (optionalString withSpotify "with Spotify, ")
+ "with gstreamer plugins: "
+ concatStrings (intersperse ", " (map (x: x.name) gst_plugins))
+ ")";
2013-12-31 13:51:11 +00:00
license = licenses.gpl3Plus;
platforms = platforms.linux;
maintainers = [ maintainers.ttuegel ];
2013-12-31 13:51:11 +00:00
};
}
''
mkdir -p $out/bin
makeWrapper "$free/bin/${exeName}" "$out/bin/${exeName}" \
2015-05-05 02:07:56 +00:00
${optionalString withSpotify "--set CLEMENTINE_SPOTIFYBLOB \"$blob/libexec/clementine\""} \
2017-08-03 02:54:50 +00:00
--prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "$GST_PLUGIN_SYSTEM_PATH_1_0"
mkdir -p $out/share
for dir in applications icons kde4; do
ln -s "$free/share/$dir" "$out/share/$dir"
done
''