Merge pull request #218394 from xyven1/master

spotify-player: make build options configurable
This commit is contained in:
Pol Dellaiera 2023-08-28 15:24:03 +02:00 committed by GitHub
commit 38e7c600ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 17 deletions

View File

@ -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";

View File

@ -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 ];
};
}