From 21bd89d4052d0abaa90b20923f3f777b990ff736 Mon Sep 17 00:00:00 2001 From: sweenu Date: Tue, 7 Oct 2025 22:10:24 +0200 Subject: [PATCH 1/2] librespot-ma: init at 0.6.0-unstable-2025-08-10 --- pkgs/by-name/li/librespot-ma/package.nix | 39 ++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 pkgs/by-name/li/librespot-ma/package.nix diff --git a/pkgs/by-name/li/librespot-ma/package.nix b/pkgs/by-name/li/librespot-ma/package.nix new file mode 100644 index 000000000000..f5e86091c206 --- /dev/null +++ b/pkgs/by-name/li/librespot-ma/package.nix @@ -0,0 +1,39 @@ +{ + lib, + rustPlatform, + fetchFromGitHub, + pkg-config, + openssl, +}: + +rustPlatform.buildRustPackage { + pname = "librespot-ma"; + version = "0.6.0-unstable-2025-08-10"; + + src = fetchFromGitHub { + owner = "music-assistant"; + repo = "librespot"; + rev = "accecb60a16334013c0c99a5ded553794ee871b7"; + hash = "sha256-vPiI8llXB6+ahX+iad/Ut81D3iZcTSVmYGDXXwApk/w="; + }; + + cargoHash = "sha256-Lujz2revTAok9B0hzdl8NVQ5XMRY9ACJzoQHIkIgKMg="; + + nativeBuildInputs = [ + pkg-config + ]; + + buildInputs = [ openssl ]; + + meta = { + description = "Fork of librespot for use in Music Assistant only"; + homepage = "https://github.com/music-assistant/librespot"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ + sweenu + emilylange + ]; + mainProgram = "librespot"; + platforms = lib.platforms.linux; + }; +} From 4e23b4365f17ca3f1e0a44f0cacb7a731b55cf27 Mon Sep 17 00:00:00 2001 From: sweenu Date: Tue, 7 Oct 2025 22:11:10 +0200 Subject: [PATCH 2/2] music-assistant: use librespot-ma as spotify provider --- .../services/audio/music-assistant.nix | 2 +- .../mu/music-assistant/librespot.patch | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/audio/music-assistant.nix b/nixos/modules/services/audio/music-assistant.nix index dadab7aa906f..b38e77ce9f4e 100644 --- a/nixos/modules/services/audio/music-assistant.nix +++ b/nixos/modules/services/audio/music-assistant.nix @@ -85,7 +85,7 @@ in lsof ] ++ lib.optionals (lib.elem "spotify" cfg.providers) [ - librespot + librespot-ma ] ++ lib.optionals (lib.elem "snapcast" cfg.providers) [ snapcast diff --git a/pkgs/by-name/mu/music-assistant/librespot.patch b/pkgs/by-name/mu/music-assistant/librespot.patch index e69de29bb2d1..5e130993be65 100644 --- a/pkgs/by-name/mu/music-assistant/librespot.patch +++ b/pkgs/by-name/mu/music-assistant/librespot.patch @@ -0,0 +1,25 @@ +diff --git a/music_assistant/providers/spotify/helpers.py b/music_assistant/providers/spotify/helpers.py +index 8b6c4e78f5f3f64c9dc6206028177c99ed0542ed..25ed6e468b393d2da74167e3c2ac4bdcd2e2699e 100644 +--- a/music_assistant/providers/spotify/helpers.py ++++ b/music_assistant/providers/spotify/helpers.py +@@ -4,6 +4,7 @@ from __future__ import annotations + + import os + import platform ++from shutil import which + + from music_assistant.helpers.process import check_output + +@@ -20,12 +21,8 @@ async def get_librespot_binary() -> str: + except OSError: + return None + +- base_path = os.path.join(os.path.dirname(__file__), "bin") +- system = platform.system().lower().replace("darwin", "macos") +- architecture = platform.machine().lower() +- + if bridge_binary := await check_librespot( +- os.path.join(base_path, f"librespot-{system}-{architecture}") ++ which("librespot") + ): + return bridge_binary