7 # deps for audio backends
19 , withStreaming ? true
21 , withAudioBackend ? "rodio" # alsa, pulseaudio, rodio, portaudio, jackaudio, rodiojack, sdl
22 , withMediaControl ? true
36 assert lib.assertOneOf "withAudioBackend" withAudioBackend [ "" "alsa" "pulseaudio" "rodio" "portaudio" "jackaudio" "rodiojack" "sdl" "gstreamer" ];
38 rustPlatform.buildRustPackage rec {
39 pname = "spotify-player";
42 src = fetchFromGitHub {
45 rev = "refs/tags/v${version}";
46 hash = "sha256-SKlESIw8eAyAqR1HVW004yyL2nNVEnb4/xmf0ch3ZMo=";
49 cargoHash = "sha256-VlJ8Bz4EY2rERyOn6ifC7JAL5Mvjt0ZOzlPBOwiH6WA=";
54 rustPlatform.bindgenHook
55 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
64 ++ lib.optionals withSixel [ libsixel ]
65 ++ lib.optionals (withAudioBackend == "alsa") [ alsa-lib ]
66 ++ lib.optionals (withAudioBackend == "pulseaudio") [ libpulseaudio ]
67 ++ lib.optionals (withAudioBackend == "rodio" && stdenv.hostPlatform.isLinux) [ alsa-lib ]
68 ++ lib.optionals (withAudioBackend == "portaudio") [ portaudio ]
69 ++ lib.optionals (withAudioBackend == "jackaudio") [ libjack2 ]
70 ++ lib.optionals (withAudioBackend == "rodiojack") [ alsa-lib libjack2 ]
71 ++ lib.optionals (withAudioBackend == "sdl") [ SDL2 ]
72 ++ lib.optionals (withAudioBackend == "gstreamer") [ gst_all_1.gstreamer gst_all_1.gst-devtools gst_all_1.gst-plugins-base gst_all_1.gst-plugins-good ]
73 ++ lib.optionals (stdenv.hostPlatform.isDarwin && withMediaControl) [ darwin.apple_sdk.frameworks.MediaPlayer ]
74 ++ lib.optionals stdenv.hostPlatform.isDarwin (with darwin.apple_sdk.frameworks; [
80 buildNoDefaultFeatures = true;
83 ++ lib.optionals (withAudioBackend != "") [ "${withAudioBackend}-backend" ]
84 ++ lib.optionals withMediaControl [ "media-control" ]
85 ++ lib.optionals withImage [ "image" ]
86 ++ lib.optionals withLyrics [ "lyric-finder" ]
87 ++ lib.optionals withDaemon [ "daemon" ]
88 ++ lib.optionals withNotify [ "notify" ]
89 ++ lib.optionals withStreaming [ "streaming" ]
90 ++ lib.optionals withSixel [ "sixel" ]
91 ++ lib.optionals withFuzzy [ "fzf" ];
93 # sixel-sys is dynamically linked to libsixel
94 postInstall = lib.optionals (stdenv.hostPlatform.isDarwin && withSixel) ''
95 wrapProgram $out/bin/spotify_player \
96 --prefix DYLD_LIBRARY_PATH : "${lib.makeLibraryPath [libsixel]}"
100 updateScript = nix-update-script { };
104 description = "Terminal spotify player that has feature parity with the official client";
105 homepage = "https://github.com/aome510/spotify-player";
106 changelog = "https://github.com/aome510/spotify-player/releases/tag/v${version}";
107 mainProgram = "spotify_player";
108 license = lib.licenses.mit;
109 maintainers = with lib.maintainers; [ dit7ya xyven1 _71zenith caperren ];