about summary refs log tree commit diff
path: root/pkgs/development/libraries/libspotify
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2013-01-25 01:10:36 -0500
committerShea Levy <shea@shealevy.com>2013-01-25 01:10:36 -0500
commit495fbceef93ca347d74413cf1a716975dface96d (patch)
tree1211bd4f64d532d01640c8c5911bc6f701dd3c89 /pkgs/development/libraries/libspotify
parent90909ea936def048f39818fca98ff4ad9d0cf821 (diff)
Add libspotify
Diffstat (limited to 'pkgs/development/libraries/libspotify')
-rw-r--r--pkgs/development/libraries/libspotify/default.nix61
1 files changed, 61 insertions, 0 deletions
diff --git a/pkgs/development/libraries/libspotify/default.nix b/pkgs/development/libraries/libspotify/default.nix
new file mode 100644
index 0000000000000..9c28a99fee8d2
--- /dev/null
+++ b/pkgs/development/libraries/libspotify/default.nix
@@ -0,0 +1,61 @@
+{ stdenv, fetchurl, libspotify, alsaLib, readline, pkgconfig, apiKey }:
+
+let version = "12.1.51"; in
+
+if stdenv.system != "x86_64-linux" then throw ''
+  Check https://developer.spotify.com/technologies/libspotify/ for a tarball for your system and add it here
+'' else stdenv.mkDerivation {
+  name = "libspotify-${version}";
+
+  src = fetchurl {
+    url = "https://developer.spotify.com/download/libspotify/libspotify-${version}-Linux-x86_64-release.tar.gz";
+
+    sha256 = "0n0h94i4xg46hfba95n3ypah93crwb80bhgsg00f6sms683lx8a3";
+  };
+
+  buildPhase = "true";
+
+  installFlags = "prefix=$(out)";
+
+  postInstall = "mv -v share $out";
+
+  patchPhase = "sed -i 's/ldconfig//' Makefile";
+
+  passthru = {
+    samples = if apiKey == null
+      then throw ''
+        Please visit ${libspotify.meta.homepage} to get an api key then set config.libspotify.apiKey accordingly
+      '' else stdenv.mkDerivation {
+        name = "libspotify-samples-${version}";
+
+        src = libspotify.src;
+
+        buildInputs = [ pkgconfig libspotify alsaLib readline ];
+
+        postUnpack = "sourceRoot=$sourceRoot/share/doc/libspotify/examples";
+
+        patchPhase = "cp ${apiKey} appkey.c";
+
+        installPhase = ''
+          mkdir -p $out/bin
+          install -m 755 jukebox/jukebox $out/bin
+          install -m 755 spshell/spshell $out/bin
+          install -m 755 localfiles/posix_stu $out/bin
+        '';
+
+        meta = libspotify.meta // { description = "Spotify API library samples"; };
+      };
+
+    inherit apiKey;
+  };
+
+  meta = {
+    description = "Spotify API library";
+
+    homepage = https://developer.spotify.com/technologies/libspotify;
+
+    maintainers = [ stdenv.lib.maintainers.shlevy ];
+
+    license = stdenv.lib.licenses.proprietary;
+  };
+}