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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

59 lines
1.6 KiB
Nix
Raw Normal View History

2022-12-17 05:39:35 +01:00
{ lib
, rustPlatform
, fetchFromGitHub
2023-09-22 07:04:56 +02:00
, makeWrapper
2022-12-17 05:39:35 +01:00
, pkg-config
, stdenv
, openssl
, withALSA ? stdenv.isLinux
2022-12-17 05:39:35 +01:00
, alsa-lib
2023-09-22 07:04:56 +02:00
, alsa-plugins
2022-12-17 05:39:35 +01:00
, withPortAudio ? false
, portaudio
, withPulseAudio ? false
, libpulseaudio
, withRodio ? true
}:
2020-06-18 14:27:37 +02:00
rustPlatform.buildRustPackage rec {
pname = "librespot";
2022-08-11 08:29:25 +02:00
version = "0.4.2";
2020-06-18 14:27:37 +02:00
src = fetchFromGitHub {
owner = "librespot-org";
repo = "librespot";
rev = "v${version}";
2022-08-11 08:29:25 +02:00
sha256 = "sha256-DtF6asSlLdC2m/0JTBo4YUx9HgsojpfiqVdqaIwniKA=";
2020-06-18 14:27:37 +02:00
};
2022-08-11 08:29:25 +02:00
cargoSha256 = "sha256-tbDlWP0sUIa0W9HhdYNOvo9cGeqFemclhA7quh7f/Rw=";
2020-06-18 14:27:37 +02:00
2023-09-22 07:04:56 +02:00
nativeBuildInputs = [ pkg-config makeWrapper ] ++ lib.optionals stdenv.isDarwin [
2022-12-17 05:39:35 +01:00
rustPlatform.bindgenHook
];
2020-06-18 14:27:37 +02:00
2022-12-17 05:39:35 +01:00
buildInputs = [ openssl ]
++ lib.optional withALSA alsa-lib
++ lib.optional withPortAudio portaudio
++ lib.optional withPulseAudio libpulseaudio;
2020-06-18 14:27:37 +02:00
2021-11-16 01:06:51 +01:00
buildNoDefaultFeatures = true;
buildFeatures = lib.optional withRodio "rodio-backend"
++ lib.optional withALSA "alsa-backend"
2022-12-17 05:39:35 +01:00
++ lib.optional withPortAudio "portaudio-backend"
++ lib.optional withPulseAudio "pulseaudio-backend";
2020-06-18 14:27:37 +02:00
2023-09-22 07:04:56 +02:00
postFixup = lib.optionalString withALSA ''
wrapProgram "$out/bin/librespot" \
--set ALSA_PLUGIN_DIR '${alsa-plugins}/lib/alsa-lib'
'';
meta = with lib; {
2020-06-18 14:27:37 +02:00
description = "Open Source Spotify client library and playback daemon";
homepage = "https://github.com/librespot-org/librespot";
2022-12-17 05:39:35 +01:00
changelog = "https://github.com/librespot-org/librespot/blob/v${version}/CHANGELOG.md";
2020-06-18 14:27:37 +02:00
license = with licenses; [ mit ];
maintainers = with maintainers; [ bennofs ];
};
}