@@ -0,0 +1,49 @@
1+{ stdenv, fetchFromGitHub, rustPlatform, pkgconfig, openssl
2+, withRodio ? true
3+, withALSA ? true, alsaLib ? null
4+, withPulseAudio ? false, libpulseaudio ? null
5+, withPortAudio ? false, portaudio ? null
6+}:
7+
8+rustPlatform.buildRustPackage rec {
9+ pname = "librespot";
10+ version = "0.1.1";
11+
12+ src = fetchFromGitHub {
13+ owner = "librespot-org";
14+ repo = "librespot";
15+ rev = "v${version}";
16+ sha256 = "1sdbjv8w2mfpv82rx5iy4s532l1767vmlrg9d8khnvh8vrm2lshy";
17+ };
18+
19+ cargoSha256 = "0zi50imjvalwl6pxl35qrmbg74j5xdfaws8v69am4g9agbfjvlms";
20+
21+ cargoBuildFlags = with stdenv.lib; [
22+ "--no-default-features"
23+ "--features"
24+ (concatStringsSep "," (filter (x: x != "") [
25+ (optionalString withRodio "rodio-backend")
26+ (optionalString withALSA "alsa-backend")
27+ (optionalString withPulseAudio "pulseaudio-backend")
28+ (optionalString withPortAudio "portaudio-backend")
29+
30+ ]))
31+ ];
32+
33+ nativeBuildInputs = [ pkgconfig ];
34+
35+ buildInputs = [ openssl ]
36+ ++ stdenv.lib.optional withALSA alsaLib
37+ ++ stdenv.lib.optional withPulseAudio libpulseaudio
38+ ++ stdenv.lib.optional withPortAudio portaudio;
39+
40+ doCheck = false;
41+
42+ meta = with stdenv.lib; {
43+ description = "Open Source Spotify client library and playback daemon";
44+ homepage = "https://github.com/librespot-org/librespot";
45+ license = with licenses; [ mit ];
46+ maintainers = with maintainers; [ bennofs ];
47+ platforms = platforms.unix;
48+ };
49+}