about summary refs log tree commit diff
path: root/pkgs/applications/audio/spotify-player
diff options
context:
space:
mode:
authorTom Cammann <tom.cammann@forgerock.com>2023-08-14 21:28:30 +0100
committerTom Cammann <tom.cammann@forgerock.com>2023-09-03 13:31:03 +0100
commit34f8d5399650651eb848202b4c1831629ce0a959 (patch)
treed8d0eaf9439734feaab4c8f3138088e0960b5567 /pkgs/applications/audio/spotify-player
parentc2f3ec47aad406a6ccce21bfabe72ff83ee3862a (diff)
Fix build spotify_player for macos
- Add require Apple SDK libraries
- Fix dynamic linking to the sixel lib
- Only include alsa for linux builds, as this is not supported on MacOS
Diffstat (limited to 'pkgs/applications/audio/spotify-player')
-rw-r--r--pkgs/applications/audio/spotify-player/default.nix20
1 files changed, 19 insertions, 1 deletions
diff --git a/pkgs/applications/audio/spotify-player/default.nix b/pkgs/applications/audio/spotify-player/default.nix
index 963cbe3252ea0..cd2d050c9a963 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";