diff --git a/pkgs/applications/audio/spotify-player/default.nix b/pkgs/applications/audio/spotify-player/default.nix index 963cbe3252ea..cd2d050c9a96 100644 --- a/pkgs/applications/audio/spotify-player/default.nix +++ b/pkgs/applications/audio/spotify-player/default.nix @@ -24,6 +24,9 @@ , withImage ? true , withNotify ? true , withSixel ? true +, stdenv +, darwin +, makeBinaryWrapper }: assert lib.assertOneOf "withAudioBackend" withAudioBackend [ "" "alsa" "pulseaudio" "rodio" "portaudio" "jackaudio" "rodiojack" "sdl" "gstreamer" ]; @@ -44,6 +47,9 @@ rustPlatform.buildRustPackage rec { nativeBuildInputs = [ pkg-config cmake + rustPlatform.bindgenHook + ] ++ lib.optionals stdenv.isDarwin [ + makeBinaryWrapper ]; buildInputs = [ @@ -59,7 +65,13 @@ rustPlatform.buildRustPackage rec { ++ lib.optionals (withAudioBackend == "jackaudio") [ libjack2 ] ++ lib.optionals (withAudioBackend == "rodiojack") [ alsa-lib libjack2 ] ++ lib.optionals (withAudioBackend == "sdl") [ SDL2 ] - ++ 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 ]; + ++ 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 ] + ++ lib.optionals (stdenv.isDarwin && withMediaControl) [ darwin.apple_sdk.frameworks.MediaPlayer ] + ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ + AppKit + AudioUnit + Cocoa + ]); buildNoDefaultFeatures = true; @@ -73,6 +85,12 @@ rustPlatform.buildRustPackage rec { ++ lib.optionals withStreaming [ "streaming" ] ++ lib.optionals withSixel [ "sixel" ]; + # sixel-sys is dynamically linked to libsixel + postInstall = lib.optionals (stdenv.isDarwin && withSixel) '' + wrapProgram $out/bin/spotify_player \ + --prefix DYLD_LIBRARY_PATH : "${lib.makeLibraryPath [libsixel]}" + ''; + meta = { description = "A terminal spotify player that has feature parity with the official client"; homepage = "https://github.com/aome510/spotify-player";