From d80a9f0e211f443fc276b733da50f5906f280389 Mon Sep 17 00:00:00 2001 From: hacker1024 Date: Fri, 22 Sep 2023 15:04:56 +1000 Subject: [PATCH 1/2] librespot: Set ALSA_PLUGIN_DIR --- pkgs/applications/audio/librespot/default.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/audio/librespot/default.nix b/pkgs/applications/audio/librespot/default.nix index f477b811d70f..df7bfab74b94 100644 --- a/pkgs/applications/audio/librespot/default.nix +++ b/pkgs/applications/audio/librespot/default.nix @@ -1,11 +1,13 @@ { lib , rustPlatform , fetchFromGitHub +, makeWrapper , pkg-config , stdenv , openssl , withALSA ? true , alsa-lib +, alsa-plugins , withPortAudio ? false , portaudio , withPulseAudio ? false @@ -26,7 +28,7 @@ rustPlatform.buildRustPackage rec { cargoSha256 = "sha256-tbDlWP0sUIa0W9HhdYNOvo9cGeqFemclhA7quh7f/Rw="; - nativeBuildInputs = [ pkg-config ] ++ lib.optionals stdenv.isDarwin [ + nativeBuildInputs = [ pkg-config makeWrapper ] ++ lib.optionals stdenv.isDarwin [ rustPlatform.bindgenHook ]; @@ -41,6 +43,11 @@ rustPlatform.buildRustPackage rec { ++ lib.optional withPortAudio "portaudio-backend" ++ lib.optional withPulseAudio "pulseaudio-backend"; + postFixup = lib.optionalString withALSA '' + wrapProgram "$out/bin/librespot" \ + --set ALSA_PLUGIN_DIR '${alsa-plugins}/lib/alsa-lib' + ''; + meta = with lib; { description = "Open Source Spotify client library and playback daemon"; homepage = "https://github.com/librespot-org/librespot"; From 6baeb351fa745e62a19544200d7e14f8f9098158 Mon Sep 17 00:00:00 2001 From: hacker1024 Date: Fri, 22 Sep 2023 19:41:05 +1000 Subject: [PATCH 2/2] librespot: Only enable ALSA by default on Linux Co-authored-by: Artturi --- pkgs/applications/audio/librespot/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/audio/librespot/default.nix b/pkgs/applications/audio/librespot/default.nix index df7bfab74b94..2617030829a5 100644 --- a/pkgs/applications/audio/librespot/default.nix +++ b/pkgs/applications/audio/librespot/default.nix @@ -5,7 +5,7 @@ , pkg-config , stdenv , openssl -, withALSA ? true +, withALSA ? stdenv.isLinux , alsa-lib , alsa-plugins , withPortAudio ? false