about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPol Dellaiera <pol.dellaiera@protonmail.com>2023-08-28 15:24:03 +0200
committerGitHub <noreply@github.com>2023-08-28 15:24:03 +0200
commit38e7c600ad528469a84a006a064788ed7fd88469 (patch)
tree1f317aaa43d1effbd6d7f82203ad33c2bed259d2
parente9315ce137f5c3d17e78eae5596d8690afbd7188 (diff)
parent8e53e1bae7f3df96627501966ec3ce3970523864 (diff)
Merge pull request #218394 from xyven1/master
spotify-player: make build options configurable
-rw-r--r--maintainers/maintainer-list.nix6
-rw-r--r--pkgs/applications/audio/spotify-player/default.nix58
2 files changed, 47 insertions, 17 deletions
diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix
index edfe43e350edf..f4d79b3a72c53 100644
--- a/maintainers/maintainer-list.nix
+++ b/maintainers/maintainer-list.nix
@@ -18631,6 +18631,12 @@
     github = "XYenon";
     githubId = 20698483;
   };
+  xyven1 = {
+    name = "Xyven";
+    email = "nix@xyven.dev";
+    github = "xyven1";
+    githubId = 35360746;
+  };
   xzfc = {
     email = "xzfcpw@gmail.com";
     github = "xzfc";
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 ];
   };
 }