From 6580c59352f8c2cffcd64c5a78f5f3d0d920648f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benno=20F=C3=BCnfst=C3=BCck?= Date: Thu, 18 Jun 2020 14:27:37 +0200 Subject: [PATCH] librespot: init at 0.1.1 --- pkgs/applications/audio/librespot/default.nix | 49 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 6 +++ 2 files changed, 55 insertions(+) create mode 100644 pkgs/applications/audio/librespot/default.nix diff --git a/pkgs/applications/audio/librespot/default.nix b/pkgs/applications/audio/librespot/default.nix new file mode 100644 index 000000000000..468cf57cdcfe --- /dev/null +++ b/pkgs/applications/audio/librespot/default.nix @@ -0,0 +1,49 @@ +{ stdenv, fetchFromGitHub, rustPlatform, pkgconfig, openssl +, withRodio ? true +, withALSA ? true, alsaLib ? null +, withPulseAudio ? false, libpulseaudio ? null +, withPortAudio ? false, portaudio ? null +}: + +rustPlatform.buildRustPackage rec { + pname = "librespot"; + version = "0.1.1"; + + src = fetchFromGitHub { + owner = "librespot-org"; + repo = "librespot"; + rev = "v${version}"; + sha256 = "1sdbjv8w2mfpv82rx5iy4s532l1767vmlrg9d8khnvh8vrm2lshy"; + }; + + cargoSha256 = "0zi50imjvalwl6pxl35qrmbg74j5xdfaws8v69am4g9agbfjvlms"; + + cargoBuildFlags = with stdenv.lib; [ + "--no-default-features" + "--features" + (concatStringsSep "," (filter (x: x != "") [ + (optionalString withRodio "rodio-backend") + (optionalString withALSA "alsa-backend") + (optionalString withPulseAudio "pulseaudio-backend") + (optionalString withPortAudio "portaudio-backend") + + ])) + ]; + + nativeBuildInputs = [ pkgconfig ]; + + buildInputs = [ openssl ] + ++ stdenv.lib.optional withALSA alsaLib + ++ stdenv.lib.optional withPulseAudio libpulseaudio + ++ stdenv.lib.optional withPortAudio portaudio; + + doCheck = false; + + meta = with stdenv.lib; { + description = "Open Source Spotify client library and playback daemon"; + homepage = "https://github.com/librespot-org/librespot"; + license = with licenses; [ mit ]; + maintainers = with maintainers; [ bennofs ]; + platforms = platforms.unix; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 27bca9d5dd6d..07089fc3aab4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19931,6 +19931,12 @@ in libquvi = callPackage ../applications/video/quvi/library.nix { }; + librespot = callPackage ../applications/audio/librespot { + withALSA = stdenv.isLinux; + withPulseAudio = config.pulseaudio or stdenv.isLinux; + withPortAudio = stdenv.isDarwin; + }; + linssid = libsForQt5.callPackage ../applications/networking/linssid { }; lollypop = callPackage ../applications/audio/lollypop { };