about summary refs log tree commit diff
path: root/pkgs/applications/audio/spotify-player
diff options
context:
space:
mode:
authorXyven1 <maritimus987@gmail.com>2023-02-26 02:29:53 -0500
committerxyven1 <git@xyven.dev>2023-08-20 17:30:36 -0400
commit8e53e1bae7f3df96627501966ec3ce3970523864 (patch)
tree6db6a169e996fe119a36e24067dce29d03737a46 /pkgs/applications/audio/spotify-player
parent8c84eb3e93a786fdd04cfae91b8e65b425787b76 (diff)
spotify-player: make build options configurable
Surface rust build features as configurations in nixpkgs, update
description to better match the applications use, add xyven1 as
maintainer.
Diffstat (limited to 'pkgs/applications/audio/spotify-player')
-rw-r--r--pkgs/applications/audio/spotify-player/default.nix58
1 files changed, 41 insertions, 17 deletions
diff --git a/pkgs/applications/audio/spotify-player/default.nix b/pkgs/applications/audio/spotify-player/default.nix
index 4c5417ab99fc8..963cbe3252ea0 100644
--- a/pkgs/applications/audio/spotify-player/default.nix
+++ b/pkgs/applications/audio/spotify-player/default.nix
@@ -4,12 +4,30 @@
 , pkg-config
 , openssl
 , cmake
+# deps for audio backends
 , alsa-lib
+, libpulseaudio
+, portaudio
+, libjack2
+, SDL2
+, gst_all_1
 , dbus
 , fontconfig
 , libsixel
+
+# build options
+, withStreaming ? true
+, withDaemon ? true
+, withAudioBackend ? "rodio" # alsa, pulseaudio, rodio, portaudio, jackaudio, rodiojack, sdl
+, withMediaControl ? true
+, withLyrics ? true
+, withImage ? true
+, withNotify ? true
+, withSixel ? true
 }:
 
+assert lib.assertOneOf "withAudioBackend" withAudioBackend [ "" "alsa" "pulseaudio" "rodio" "portaudio" "jackaudio" "rodiojack" "sdl" "gstreamer" ];
+
 rustPlatform.buildRustPackage rec {
   pname = "spotify-player";
   version = "0.15.0";
@@ -30,31 +48,37 @@ rustPlatform.buildRustPackage rec {
 
   buildInputs = [
     openssl
-    alsa-lib
     dbus
     fontconfig
-    libsixel
-  ];
+  ]
+    ++ lib.optionals withSixel [ libsixel ]
+    ++ lib.optionals (withAudioBackend == "alsa") [ alsa-lib ]
+    ++ lib.optionals (withAudioBackend == "pulseaudio") [ libpulseaudio ]
+    ++ lib.optionals (withAudioBackend == "rodio") [ alsa-lib ]
+    ++ lib.optionals (withAudioBackend == "portaudio") [ portaudio ]
+    ++ 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 ];
 
   buildNoDefaultFeatures = true;
 
-  buildFeatures = [
-    "rodio-backend"
-    "media-control"
-    "image"
-    "lyric-finder"
-    "daemon"
-    "notify"
-    "streaming"
-    "sixel"
-  ];
+  buildFeatures = [ ]
+    ++ lib.optionals (withAudioBackend != "") [ "${withAudioBackend}-backend" ]
+    ++ lib.optionals withMediaControl [ "media-control" ]
+    ++ lib.optionals withImage [ "image" ]
+    ++ lib.optionals withLyrics [ "lyric-finder" ]
+    ++ lib.optionals withDaemon [ "daemon" ]
+    ++ lib.optionals withNotify [ "notify" ]
+    ++ lib.optionals withStreaming [ "streaming" ]
+    ++ lib.optionals withSixel [ "sixel" ];
 
-  meta = with lib; {
-    description = "A command driven spotify player";
+  meta = {
+    description = "A terminal spotify player that has feature parity with the official client";
     homepage = "https://github.com/aome510/spotify-player";
     changelog = "https://github.com/aome510/spotify-player/releases/tag/v${version}";
     mainProgram = "spotify_player";
-    license = licenses.mit;
-    maintainers = with maintainers; [ dit7ya ];
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [ dit7ya xyven1 ];
   };
 }