{ lib, stdenv, fetchFromGitHub, rustPlatform, pkg-config, openssl, withRodio ? true , withALSA ? true, alsa-lib ? null, withPulseAudio ? false, libpulseaudio ? null , withPortAudio ? false, portaudio ? null }: rustPlatform.buildRustPackage rec { pname = "librespot"; version = "0.4.2"; src = fetchFromGitHub { owner = "librespot-org"; repo = "librespot"; rev = "v${version}"; sha256 = "sha256-DtF6asSlLdC2m/0JTBo4YUx9HgsojpfiqVdqaIwniKA="; }; cargoSha256 = "sha256-tbDlWP0sUIa0W9HhdYNOvo9cGeqFemclhA7quh7f/Rw="; nativeBuildInputs = [ pkg-config ]; buildInputs = [ openssl ] ++ lib.optional withALSA alsa-lib ++ lib.optional withPulseAudio libpulseaudio ++ lib.optional withPortAudio portaudio; buildNoDefaultFeatures = true; buildFeatures = lib.optional withRodio "rodio-backend" ++ lib.optional withALSA "alsa-backend" ++ lib.optional withPulseAudio "pulseaudio-backend" ++ lib.optional withPortAudio "portaudio-backend"; doCheck = false; meta = with 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; broken = stdenv.isDarwin; # never built on Hydra https://hydra.nixos.org/job/nixpkgs/trunk/librespot.x86_64-darwin }; }