From unknown Sun Jun 15 09:03:40 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#70363] Librespot package and service Resent-From: =?UTF-8?Q?No=C3=A9?= Lopez Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 13 Apr 2024 07:14:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 70363 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 70363@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.171299241632690 (code B ref -1); Sat, 13 Apr 2024 07:14:03 +0000 Received: (at submit) by debbugs.gnu.org; 13 Apr 2024 07:13:36 +0000 Received: from localhost ([127.0.0.1]:59914 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rvXZt-0008Uy-Oi for submit@debbugs.gnu.org; Sat, 13 Apr 2024 03:13:35 -0400 Received: from lists.gnu.org ([2001:470:142::17]:54384) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rvPts-0001xQ-Ra for submit@debbugs.gnu.org; Fri, 12 Apr 2024 19:01:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rvPtd-0004b1-4O for guix-patches@gnu.org; Fri, 12 Apr 2024 19:01:25 -0400 Received: from smtp.domeneshop.no ([2a01:5b40:0:3006::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rvPtW-0003RX-JH for guix-patches@gnu.org; Fri, 12 Apr 2024 19:01:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xn--no-cja.eu; s=ds202402; h=Content-Type:MIME-Version:Message-ID:Date: Subject:To:From:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=0ypcbc/tckITDfX0wb8JAWpG+hsHacQMRylACMCtYWg=; b=Q8XqsL8+0cPpP/qzx6mcJZb7TH pKnFsxFQM4NZqI2F2ACnEkRXnhXu9XdshsXzBVq8MW88Mt1N7/b+B1zEfBMKA9HQFogH7h8qohwyT /ODNoqqhPLg1HzMuEPfhWQRL2YSS6TUPPAzuViufEzlPIVVIAqR8Nnl7GoB1bhYhEsj0clwKTx9Fu VitS9wtivPqa0IiMKMAavpEkndwvJbQtA4ImcrLJC81iPL4QWlDAN9aOQ9OB2cyGvNipsw55qgGUi WvzkJEFXCCHiSBip4PAV2jSAVy7E80/JKPIt+YYmIa6R7bL4jdAWK9DpwCJolYZvZkrodCQ1Cc7Ly vDGvgzVw==; Received: from [2a01:e0a:990:a960:de21:48ff:fe5a:d787] (port=46064 helo=lignux) by smtp.domeneshop.no with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rvPtP-005lQ6-HF for guix-patches@gnu.org; Sat, 13 Apr 2024 01:01:11 +0200 From: =?UTF-8?Q?No=C3=A9?= Lopez Date: Sat, 13 Apr 2024 01:01:09 +0200 Message-ID: <87pluu9oei.fsf@xn--no-cja.eu> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a01:5b40:0:3006::1; envelope-from=noe@xn--no-cja.eu; helo=smtp.domeneshop.no X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Mailman-Approved-At: Sat, 13 Apr 2024 03:13:32 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, I've started writing a package for librespot, a spotify client similar to spotifyd which is already packaged. I've gotten the package to build and work, but I also wanted a home service to run it automatically with shepherd. This is my first time making a home service, can someone review my code to make sure it follows good practices ? I would love to get feedback on this and then submit it as a patch. Thanks in advance. The usage for the home service is as follows: (service home-librespot-service-type (for-home (librespot-configuration (username "...") (password "...")))) P.S. I'm moderately sure that the spotifyd package is using pulseaudio as a dependency incorrectly, from my understanding spotifyd uses exclusively ALSA, unless the pulseaudio backend is selected but that's very optional. Thanks in advance, No=C3=A9 Lopez --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=librespot.scm (define-module (gnu packages librespot) #:use-module (gnu services) #:use-module (gnu services shepherd) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix download) #:use-module (gnu packages crates-io) #:use-module (gnu packages crates-web) #:use-module (gnu packages crates-crypto) #:use-module (gnu packages pkg-config) #:use-module (gnu packages linux) #:use-module (guix records) #:use-module (guix build-system cargo) #:use-module (gnu home services) #:use-module (guix gexp) #:use-module (srfi srfi-9) #:export (librespot-configuration librespot-configuration? librespot-service-type home-librespot-service-type)) (define-public rust-librespot-0.4 (package (name "rust-librespot") (version "0.4.2") (source (origin (method url-fetch) (uri (crate-uri "librespot" version)) (file-name (string-append name "-" version ".tar.gz")) (sha256 (base32 "0i2aisbw9ngp51d2sd13wvmjc94qfs2pza54hj0qz5j8xx99jk7a")))) (build-system cargo-build-system) (native-inputs (list pkg-config)) (inputs (list alsa-lib)) (arguments `(#:cargo-inputs (("rust-base64" ,rust-base64-0.13) ("rust-env-logger" ,rust-env-logger-0.9) ("rust-futures-util" ,rust-futures-util-0.3) ("rust-getopts" ,rust-getopts-0.2) ("rust-hex" ,rust-hex-0.4) ("rust-hyper" ,rust-hyper-0.14) ("rust-librespot-audio" ,rust-librespot-audio-0.4) ("rust-librespot-connect" ,rust-librespot-connect-0.4) ("rust-librespot-core" ,rust-librespot-core-0.4) ("rust-librespot-discovery" ,rust-librespot-discovery-0.4) ("rust-librespot-metadata" ,rust-librespot-metadata-0.4) ("rust-librespot-playback" ,rust-librespot-playback-0.4) ("rust-librespot-protocol" ,rust-librespot-protocol-0.4) ("rust-log" ,rust-log-0.4) ("rust-rpassword" ,rust-rpassword-6) ("rust-sha-1" ,rust-sha-1-0.9) ("rust-thiserror" ,rust-thiserror-1) ("rust-tokio" ,rust-tokio-1) ("rust-url" ,rust-url-2)))) (home-page "https://github.com/librespot-org/librespot") (synopsis "Open source client library for Spotify, with support for Spotify Connect") (description "Librespot is a daemon that connects to the Spotify music and can be controlled by clients that use the Spotify Connect protocel, which includes the official Spotify mobile apps.") (license license:expat))) (define-record-type* librespot-configuration make-librespot-configuration librespot-configuration? (librespot librespot-configuration-librespot ;file-like (default rust-librespot-0.4)) (username librespot-configuration-username) ;string (password librespot-configuration-password) ;string (arguments librespot-configuration-arguments ;list of strings (default '()))) (define librespot-shepherd-service (match-record-lambda (librespot username password arguments) (list (shepherd-service (provision '(librespot)) (documentation "Run librespot.") (requirement '()) (start #~(make-forkexec-constructor (cons (string-append #$librespot "/bin/librespot") '#$arguments) #:environment-variables (append (list (string-append "LIBRESPOT_USERNAME=" #$username) (string-append "LIBRESPOT_PASSWORD=" #$password)) (environ)))) (respawn? #f) (stop #~(make-kill-destructor)))))) (define librespot-service-type (service-type (name 'librespot) (extensions (list (service-extension shepherd-root-service-type librespot-shepherd-service))) (description "Run librespot. A spotify client."))) (define home-librespot-service-type (service-type (inherit (system->home-service-type librespot-service-type)))) --=-=-=--