about summary refs log tree commit diff
path: root/pkgs/applications/audio/clementine
diff options
context:
space:
mode:
authorThomas Tuegel <ttuegel@gmail.com>2015-05-04 21:07:56 -0500
committerThomas Tuegel <ttuegel@gmail.com>2015-05-04 21:07:56 -0500
commit256a372b08dc296ae5084c6d38f5ddeab5d56bbf (patch)
treedad2ba3e0b841597b04b106eb98bfe602151d823 /pkgs/applications/audio/clementine
parent7931799a0f1a492ddab7325a488df729810b53bd (diff)
downloadnixlib-256a372b08dc296ae5084c6d38f5ddeab5d56bbf.tar
nixlib-256a372b08dc296ae5084c6d38f5ddeab5d56bbf.tar.gz
nixlib-256a372b08dc296ae5084c6d38f5ddeab5d56bbf.tar.bz2
nixlib-256a372b08dc296ae5084c6d38f5ddeab5d56bbf.tar.lz
nixlib-256a372b08dc296ae5084c6d38f5ddeab5d56bbf.tar.xz
nixlib-256a372b08dc296ae5084c6d38f5ddeab5d56bbf.tar.zst
nixlib-256a372b08dc296ae5084c6d38f5ddeab5d56bbf.zip
clementine: fix Spotify support
Diffstat (limited to 'pkgs/applications/audio/clementine')
-rw-r--r--pkgs/applications/audio/clementine/clementine-spotify-blob.patch25
-rw-r--r--pkgs/applications/audio/clementine/default.nix119
2 files changed, 105 insertions, 39 deletions
diff --git a/pkgs/applications/audio/clementine/clementine-spotify-blob.patch b/pkgs/applications/audio/clementine/clementine-spotify-blob.patch
new file mode 100644
index 000000000000..d41720c90215
--- /dev/null
+++ b/pkgs/applications/audio/clementine/clementine-spotify-blob.patch
@@ -0,0 +1,25 @@
+From d9ebe7ec09a48b1ea505ccc33686b72642f083f4 Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@gmail.com>
+Date: Mon, 4 May 2015 19:59:38 -0500
+Subject: [PATCH] Runtime selection of Spotify blob
+
+---
+ src/internet/spotifyservice.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/internet/spotifyservice.cpp b/src/internet/spotifyservice.cpp
+index 543744e..d987a36 100644
+--- a/src/internet/spotifyservice.cpp
++++ b/src/internet/spotifyservice.cpp
+@@ -65,7 +65,7 @@ SpotifyService::SpotifyService(Application* app, InternetModel* parent)
+   system_blob_path_ = QCoreApplication::applicationDirPath() +
+       "/../PlugIns/clementine-spotifyblob";
+ #else
+-  system_blob_path_ = QCoreApplication::applicationDirPath() +
++  system_blob_path_ = qgetenv("CLEMENTINE_SPOTIFYBLOB") +
+       "/clementine-spotifyblob" CMAKE_EXECUTABLE_SUFFIX;
+ #endif
+ 
+-- 
+2.3.6
+
diff --git a/pkgs/applications/audio/clementine/default.nix b/pkgs/applications/audio/clementine/default.nix
index de5fd148aa1a..cc13868e9d4e 100644
--- a/pkgs/applications/audio/clementine/default.nix
+++ b/pkgs/applications/audio/clementine/default.nix
@@ -1,65 +1,105 @@
 { stdenv, fetchurl, boost, cmake, gettext, gstreamer, gst_plugins_base
 , liblastfm, qt4, taglib, fftw, glew, qjson, sqlite, libgpod, libplist
-, usbmuxd, libmtp, gvfs, libcdio, protobuf, libspotify, qca2, pkgconfig
+, usbmuxd, libmtp, gvfs, libcdio, libspotify, protobuf, qca2, pkgconfig
 , sparsehash, config, makeWrapper, runCommand, gst_plugins }:
 
 let
+  withSpotify = config.clementine.spotify or false;
+
   version = "1.2.3";
 
   exeName = "clementine";
 
-  unwrapped = stdenv.mkDerivation {
-    name = "clementine-unwrapped-${version}";
+  src = fetchurl {
+    url = https://github.com/clementine-player/Clementine/archive/1.2.3.tar.gz;
+    sha256 = "1gx1109i4pylz6x7gvp4rdzc6dvh0w6in6hfbygw01d08l26bxbx";
+  };
 
-    src = fetchurl {
-      url = https://github.com/clementine-player/Clementine/archive/1.2.3.tar.gz;
-      sha256 = "1gx1109i4pylz6x7gvp4rdzc6dvh0w6in6hfbygw01d08l26bxbx";
-    };
+  patches = [
+    ./clementine-1.2.1-include-paths.patch
+    ./clementine-dbus-namespace.patch
+    ./clementine-spotify-blob.patch
+  ];
 
-    patches = [
-      ./clementine-1.2.1-include-paths.patch
-      ./clementine-dbus-namespace.patch
-    ];
+  buildInputs = [
+    boost
+    cmake
+    fftw
+    gettext
+    glew
+    gst_plugins_base
+    gstreamer
+    gvfs
+    libcdio
+    libgpod
+    liblastfm
+    libmtp
+    libplist
+    pkgconfig
+    protobuf
+    qca2
+    qjson
+    qt4
+    sparsehash
+    sqlite
+    taglib
+    usbmuxd
+  ];
 
-    buildInputs = [
-      boost
-      cmake
-      fftw
-      gettext
-      glew
-      gst_plugins_base
-      gstreamer
-      gvfs
-      libcdio
-      libgpod
-      liblastfm
-      libmtp
-      libplist
-      pkgconfig
-      protobuf
-      qca2
-      qjson
-      qt4
-      sparsehash
-      sqlite
-      taglib
-      usbmuxd
-    ];
+  unwrapped = stdenv.mkDerivation {
+    name = "clementine-unwrapped-${version}";
+    inherit patches src buildInputs;
+    enableParallelBuilding = true;
+    meta = with stdenv.lib; {
+      homepage = "http://www.clementine-player.org";
+      description = "A multiplatform music player";
+      license = licenses.gpl3Plus;
+      platforms = platforms.linux;
+      maintainers = [ maintainers.ttuegel ];
+    };
+  };
 
+  # Spotify blob for Clementine
+  blob = stdenv.mkDerivation {
+    name = "clementine-blob-${version}";
+    # Use the same patches and sources as Clementine
+    inherit patches src;
+    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;
+    meta = with stdenv.lib; {
+      homepage = "http://www.clementine-player.org";
+      description = "Spotify integration for Clementine";
+      # The blob itself is Apache-licensed, although libspotify is unfree.
+      license = licenses.asl20;
+      platforms = platforms.linux;
+      maintainers = [ maintainers.ttuegel ];
+    };
   };
 
 in
 
+with stdenv.lib;
+
 runCommand "clementine-${version}"
 {
-  buildInputs = [ unwrapped makeWrapper ] ++ gst_plugins;
+  inherit blob unwrapped;
+  buildInputs = [ makeWrapper ] ++ gst_plugins; # for the setup-hooks
   dontPatchELF = true;
   dontStrip = true;
-  meta = with stdenv.lib; {
+  meta = {
     homepage = "http://www.clementine-player.org";
     description = "A multiplatform music player"
-      + " (with gstreamer plugins: "
+      + " (" + (optionalString withSpotify "with Spotify, ")
+      + "with gstreamer plugins: "
       + concatStrings (intersperse ", " (map (x: x.name) gst_plugins))
       + ")";
     license = licenses.gpl3Plus;
@@ -69,6 +109,7 @@ runCommand "clementine-${version}"
 }
 ''
   mkdir -p $out/bin
-  makeWrapper "${unwrapped}/bin/${exeName}" "$out/bin/${exeName}" \
+  makeWrapper "$unwrapped/bin/${exeName}" "$out/bin/${exeName}" \
+      ${optionalString withSpotify "--set CLEMENTINE_SPOTIFYBLOB \"$blob/libexec/clementine\""} \
       --prefix GST_PLUGIN_SYSTEM_PATH : "$GST_PLUGIN_SYSTEM_PATH"
 ''