nixpkgs/pkgs/applications/audio/librespot/default.nix
Winter a19cd4ffb1 Revert "treewide: replace rev with tag"
This reverts commit 65a333600d.

This wasn't tested for correctness with something like fodwatch [0],
and should not have been (self-)merged so quickly, especially without
further review.

It also resulted in the breakage of at least one package [1] (and that's
the one we know of and was caught).

A few packages that were updated in between this commit and this revert
were not reverted back to using `rev`, but other than that, this is a
1:1 revert.

[0]: https://codeberg.org/raphaelr/fodwatch
[1]: https://github.com/NixOS/nixpkgs/pull/396904 / 758551e458
2025-04-08 02:57:25 -04:00

72 lines
1.8 KiB
Nix

{
lib,
rustPlatform,
fetchFromGitHub,
makeWrapper,
pkg-config,
stdenv,
openssl,
withALSA ? stdenv.hostPlatform.isLinux,
alsa-lib,
alsa-plugins,
withPortAudio ? false,
portaudio,
withPulseAudio ? false,
libpulseaudio,
withRodio ? true,
withAvahi ? false,
avahi-compat,
}:
rustPlatform.buildRustPackage rec {
pname = "librespot";
version = "0.6.0";
src = fetchFromGitHub {
owner = "librespot-org";
repo = "librespot";
rev = "v${version}";
sha256 = "sha256-dGQDRb7fgIkXelZKa+PdodIs9DxbgEMlVGJjK/hU3Mo=";
};
useFetchCargoVendor = true;
cargoHash = "sha256-SqvJSHkyd1IicT6c4pE96dBJNNodULhpyG14HRGVWCk=";
nativeBuildInputs =
[
pkg-config
makeWrapper
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
rustPlatform.bindgenHook
];
buildInputs =
[ openssl ]
++ lib.optional withALSA alsa-lib
++ lib.optional withAvahi avahi-compat
++ lib.optional withPortAudio portaudio
++ lib.optional withPulseAudio libpulseaudio;
buildNoDefaultFeatures = true;
buildFeatures =
lib.optional withRodio "rodio-backend"
++ lib.optional withALSA "alsa-backend"
++ lib.optional withAvahi "with-avahi"
++ lib.optional withPortAudio "portaudio-backend"
++ lib.optional withPulseAudio "pulseaudio-backend";
postFixup = lib.optionalString withALSA ''
wrapProgram "$out/bin/librespot" \
--set ALSA_PLUGIN_DIR '${alsa-plugins}/lib/alsa-lib'
'';
meta = with lib; {
description = "Open Source Spotify client library and playback daemon";
mainProgram = "librespot";
homepage = "https://github.com/librespot-org/librespot";
changelog = "https://github.com/librespot-org/librespot/blob/v${version}/CHANGELOG.md";
license = with licenses; [ mit ];
maintainers = with maintainers; [ bennofs ];
};
}