GNU logs - #40878, boring messages


Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#40878] [PATCH] services: mpd: Allow authentication and permissions to be configured.
Resent-From: pinoaffe@HIDDEN
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Sun, 26 Apr 2020 20:17:01 +0000
Resent-Message-ID: <handler.40878.B.158793217819907 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 40878
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: 40878 <at> debbugs.gnu.org
X-Debbugs-Original-To: guix-patches@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.158793217819907
          (code B ref -1); Sun, 26 Apr 2020 20:17:01 +0000
Received: (at submit) by debbugs.gnu.org; 26 Apr 2020 20:16:18 +0000
Received: from localhost ([127.0.0.1]:35015 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jSnhK-0005B1-CM
	for submit <at> debbugs.gnu.org; Sun, 26 Apr 2020 16:16:18 -0400
Received: from lists.gnu.org ([209.51.188.17]:40177)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <pinoaffe@HIDDEN>) id 1jSnhI-0005Au-Rp
 for submit <at> debbugs.gnu.org; Sun, 26 Apr 2020 16:16:17 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:54174)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <pinoaffe@HIDDEN>) id 1jSnhI-0003NQ-98
 for guix-patches@HIDDEN; Sun, 26 Apr 2020 16:16:16 -0400
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,
 DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_PSBL,T_SPF_PERMERROR,
 URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1)
 (envelope-from <pinoaffe@HIDDEN>) id 1jSnhE-0007KT-EV
 for guix-patches@HIDDEN; Sun, 26 Apr 2020 16:16:15 -0400
Received: from mail.cock.li ([37.120.193.124]:60356)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <pinoaffe@HIDDEN>)
 id 1jSnhC-0007IS-AZ
 for guix-patches@HIDDEN; Sun, 26 Apr 2020 16:16:12 -0400
MIME-Version: 1.0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=airmail.cc; s=mail;
 t=1587932165; bh=/r7fHuMelKOPk7mNh4a4NhSNBoApnUdkdlMKdP/EPP8=;
 h=Date:From:To:Subject:From;
 b=qR6bdScKgIRhYLzqMrCdGKFmmjbkGx5hHeHpnP1nRTeP/WzsEiBvgmeCnmbOJiFoC
 TbvydCGgeCRiOVPkh2XMsXc2jcPYHdd2XAwugQDlysMqsUT6bTIumz2V3xcWNeL4OI
 gJp3Mh4EbMEhExWas6enLAJtP9AWLRU2sHDeqLbQBNBYU1ExqirPx6xkXEg68Xovpb
 0dxNKeJIowN26v4aGAfbFFC3bRHm7UwtsjRuUbHsDEZsp1s9Y8kTf9sPZcU3iIlheK
 tFArPp09ZGJOt8lRs4YjjsSopaC5K0NTYHNNvR1XvLzeLY/l/JKGnzeM/qhvglKBay
 bDvJVHZAbmrGQ==
Content-Type: text/plain; charset=US-ASCII;
 format=flowed
Content-Transfer-Encoding: 7bit
Date: Sun, 26 Apr 2020 20:16:05 +0000
From: pinoaffe@HIDDEN
Message-ID: <1ee4ef44362d20518fe69da7b6c37df5@HIDDEN>
X-Sender: pinoaffe@HIDDEN
User-Agent: Roundcube Webmail/1.3.10
Received-SPF: permerror client-ip=37.120.193.124;
 envelope-from=pinoaffe@HIDDEN; helo=mail.cock.li
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/26 16:16:05
X-ACL-Warn: Detected OS   = Linux 3.11 and newer [fuzzy]
X-Received-From: 37.120.193.124
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

* gnu/services/audio.scm (mpd-credential): New public variable.
* gnu/services/audio.scm (mpd-configuration): Add credentials
and permissions.
---
  doc/guix.texi          | 23 ++++++++++++
  gnu/services/audio.scm | 79 ++++++++++++++++++++++++++++++------------
  2 files changed, 80 insertions(+), 22 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 6613a4af13..1693d938f1 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -23271,12 +23271,35 @@ an absolute path can be specified here.
  @item @code{outputs} (default: @code{"(list (mpd-output))"})
  The audio outputs that MPD can use.  By default this is a single output 
using pulseaudio.

+@item @code{default-permissions} (default: @code{'(read add control 
admin)})
+The permissions a user that connected to the mpd server without a 
password should enjoy.
+Should be a subset of @code{'(read add control admin)}.
+
+@item @code{credentials} (default: @code{'()})
+The list of credentials one can use to sign in to mpd and gain extra 
permissions.  By
+default this is an empty list.
+
  @end table
  @end deftp

+@deftp {Data Type} mpd-credential
+Data type representing an @command{mpd} password/permissions pair.
+
  @deftp {Data Type} mpd-output
  Data type representing an @command{mpd} audio output.

+@table @asis
+@item @code{password} (default: @code{""})
+The password used to authenticate.  The password may not contain "@".
+
+@item @code{permissions} (default: @code{'()})
+The permissions one gains after authenticating to the server using 
@code{password}.
+This should be a subset of @code{'(read add control admin)}, as in
+@code{default-permissions}.
+
+@end table
+@end deftp
+
  @table @asis
  @item @code{name} (default: @code{"MPD"})
  The name of the audio output.
diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm
index 345d8225b2..9a6dc8db94 100644
--- a/gnu/services/audio.scm
+++ b/gnu/services/audio.scm
@@ -26,6 +26,8 @@
    #:use-module (ice-9 match)
    #:export (mpd-output
              mpd-output?
+            mpd-credential
+            mpd-credential?
              mpd-configuration
              mpd-configuration?
              mpd-service-type))
@@ -36,6 +38,16 @@
  ;;;
  ;;; Code:

+(define-record-type* <mpd-credential>
+  mpd-credential make-mpd-credential
+  mpd-credential?
+  (password    mpd-credential-password
+               ;; valid: any string that does not contain #\@
+               (default ""))
+  (permissions mpd-credential-permissions
+               ;; valid: any subset of read, add, control and admin
+               (default '())))
+
  (define-record-type* <mpd-output>
    mpd-output make-mpd-output
    mpd-output?
@@ -58,24 +70,41 @@
  (define-record-type* <mpd-configuration>
    mpd-configuration make-mpd-configuration
    mpd-configuration?
-  (user         mpd-configuration-user
-                (default "mpd"))
-  (music-dir    mpd-configuration-music-dir
-                (default "~/Music"))
-  (playlist-dir mpd-configuration-playlist-dir
-                (default "~/.mpd/playlists"))
-  (db-file      mpd-configuration-db-file
-                (default "~/.mpd/tag_cache"))
-  (state-file   mpd-configuration-state-file
-                (default "~/.mpd/state"))
-  (sticker-file mpd-configuration-sticker-file
-                (default "~/.mpd/sticker.sql"))
-  (port         mpd-configuration-port
-                (default "6600"))
-  (address      mpd-configuration-address
-                (default "any"))
-  (outputs      mpd-configuration-outputs
-                (default (list (mpd-output)))))
+  (user                mpd-configuration-user
+                       (default "mpd"))
+  (music-dir           mpd-configuration-music-dir
+                       (default "~/Music"))
+  (playlist-dir        mpd-configuration-playlist-dir
+                       (default "~/.mpd/playlists"))
+  (db-file             mpd-configuration-db-file
+                       (default "~/.mpd/tag_cache"))
+  (state-file          mpd-configuration-state-file
+                       (default "~/.mpd/state"))
+  (sticker-file        mpd-configuration-sticker-file
+                       (default "~/.mpd/sticker.sql"))
+  (port                mpd-configuration-port
+                       (default "6600"))
+  (address             mpd-configuration-address
+                       (default "any"))
+  (credentials         mpd-configuration-credentials
+                       (default '()))
+  (default-permissions mpd-configuration-default-permissions
+                       (default '(read add control admin)))
+  (outputs             mpd-configuration-outputs
+                       (default (list (mpd-output)))))
+
+(define (mpd-permissions->string permissions)
+  (string-join (map symbol->string
+                    permissions)
+               ","))
+
+(define (mpd-credential->string credential)
+  "Convert the USER of type <mpd-credential> to a configuration file 
snippet."
+  (format #f
+          "password \"~a@~a\"\n"
+          (mpd-credential-password credential)
+          (mpd-permissions->string
+           (mpd-credential-permissions credential))))

  (define (mpd-output->string output)
    "Convert the OUTPUT of type <mpd-output> to a configuration file 
snippet."
@@ -110,8 +139,14 @@ audio_output {
    (apply
     mixed-text-file "mpd.conf"
     "pid_file \"" (mpd-file-name config "pid") "\"\n"
+   "default_permissions \""
+   (mpd-permissions->string
+    (mpd-configuration-default-permissions config))
+   "\"\n"
     (append (map mpd-output->string
                  (mpd-configuration-outputs config))
+           (map mpd-credential->string
+                (mpd-configuration-credentials config))
             (map (match-lambda
                    ((config-name config-val)
                     (string-append config-name " \"" (config-val config) 
"\"\n")))
@@ -143,10 +178,10 @@ audio_output {
               #:environment-variables
               ;; Required to detect PulseAudio when run under a user 
account.
               '(#$(string-append
-                   "XDG_RUNTIME_DIR=/run/user/"
-                   (number->string
-                     (passwd:uid
-                       (getpwnam (mpd-configuration-user config))))))
+                  "XDG_RUNTIME_DIR=/run/user/"
+                  (number->string
+                   (passwd:uid
+                    (getpwnam (mpd-configuration-user config))))))
               #:log-file #$(mpd-file-name config "log")))
     (stop  #~(make-kill-destructor))))

-- 
2.26.2




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: pinoaffe@HIDDEN
Subject: bug#40878: Acknowledgement ([PATCH] services: mpd: Allow
 authentication and permissions to be configured.)
Message-ID: <handler.40878.B.158793217819907.ack <at> debbugs.gnu.org>
References: <1ee4ef44362d20518fe69da7b6c37df5@HIDDEN>
X-Gnu-PR-Message: ack 40878
X-Gnu-PR-Package: guix-patches
X-Gnu-PR-Keywords: patch
Reply-To: 40878 <at> debbugs.gnu.org
Date: Sun, 26 Apr 2020 20:17:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 guix-patches@HIDDEN

If you wish to submit further information on this problem, please
send it to 40878 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
40878: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D40878
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to guix-patches@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: [bug#40878] [PATCH (hopefully not garbled this time)] services: mpd: Allow authentication and permissions to be configured.
References: <1ee4ef44362d20518fe69da7b6c37df5@HIDDEN>
In-Reply-To: <1ee4ef44362d20518fe69da7b6c37df5@HIDDEN>
Resent-From: pinoaffe <pinoaffe@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: guix-patches@HIDDEN
Resent-Date: Tue, 28 Apr 2020 11:31:02 +0000
Resent-Message-ID: <handler.40878.B40878.158807341216584 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 40878
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: 40878 <at> debbugs.gnu.org
Received: via spool by 40878-submit <at> debbugs.gnu.org id=B40878.158807341216584
          (code B ref 40878); Tue, 28 Apr 2020 11:31:02 +0000
Received: (at 40878) by debbugs.gnu.org; 28 Apr 2020 11:30:12 +0000
Received: from localhost ([127.0.0.1]:39169 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jTORH-0004Iy-IP
	for submit <at> debbugs.gnu.org; Tue, 28 Apr 2020 07:30:12 -0400
Received: from mail.cock.li ([37.120.193.124]:58996)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <pinoaffe@HIDDEN>) id 1jTORE-00047T-2p
 for 40878 <at> debbugs.gnu.org; Tue, 28 Apr 2020 07:30:10 -0400
Date: Tue, 28 Apr 2020 13:29:59 +0200
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=airmail.cc; s=mail;
 t=1588073402; bh=r4uAFeK2sZBPceJA9JOMw7DgOEhntiwmGkUPjCwnG/4=;
 h=Date:From:To:Subject:From;
 b=hRG/Np3HWR49roSmPtlZbBbeiEuHXZFkRxa5wCqUE9oV1rqd5Zr++ChjtouWQXED7
 /2ZxYjhz3Fs7YknilzEojtLspKsmYP8Zxavddvwa8rM3fuJagMJLkA7An+RagSxHxR
 vHfkqVM96JM3AdCCAbMQHsJtL50zymjxHiw0xDStfydLQ4ojR4AfV/xccnX7ozmEQv
 Ug92wJyWXoytlCBxGA7fDDcnd3U6oiw8gUhkmfz1cRFK9T6VRrk2DVxdZD3IgSupaj
 GVdc24qBDPYQNvy5D2hF75fLrcb58m0UxZx15T1qgdp9kBr2QCdw3mxEMbDTw15SvN
 PExeONVoUmRsQ==
From: pinoaffe <pinoaffe@HIDDEN>
Message-ID: <20200426223555.2a5793bb@HIDDEN>
X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-unknown-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-Spam-Score: 2.7 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview: * gnu/services/audio.scm (mpd-credential): New public
 variable.
 * gnu/services/audio.scm (mpd-configuration): Add credentials and permissions.
 --- doc/guix.texi | 23 ++++++++++++ gnu/services/audio.sc [...] 
 Content analysis details:   (2.7 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: airmail.cc]
 2.7 RCVD_IN_PSBL           RBL: Received via a relay in PSBL
 [37.120.193.124 listed in psbl.surriel.com]
 0.0 T_SPF_PERMERROR        SPF: test of record failed (permerror)
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.7 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  * gnu/services/audio.scm (mpd-credential): New public variable.
    * gnu/services/audio.scm (mpd-configuration): Add credentials and permissions.
    --- doc/guix.texi | 23 ++++++++++++ gnu/services/audio.sc [...] 
 
 Content analysis details:   (1.7 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
                             blocked.  See
                             http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
                              for more information.
                             [URIs: airmail.cc]
  2.7 RCVD_IN_PSBL           RBL: Received via a relay in PSBL
                             [37.120.193.124 listed in psbl.surriel.com]
  0.0 T_SPF_PERMERROR        SPF: test of record failed (permerror)
  0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -1.0 MAILING_LIST_MULTI     Multiple indicators imply a widely-seen list
                             manager


* gnu/services/audio.scm (mpd-credential): New public variable.
* gnu/services/audio.scm (mpd-configuration): Add credentials
and permissions.
---
 doc/guix.texi          | 23 ++++++++++++
 gnu/services/audio.scm | 79 ++++++++++++++++++++++++++++++------------
 2 files changed, 80 insertions(+), 22 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 6613a4af13..1693d938f1 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -23271,12 +23271,35 @@ an absolute path can be specified here.
 @item @code{outputs} (default: @code{"(list (mpd-output))"})
 The audio outputs that MPD can use.  By default this is a single output using pulseaudio.
 
+@item @code{default-permissions} (default: @code{'(read add control admin)})
+The permissions a user that connected to the mpd server without a password should enjoy. 
+Should be a subset of @code{'(read add control admin)}.
+
+@item @code{credentials} (default: @code{'()})
+The list of credentials one can use to sign in to mpd and gain extra permissions.  By
+default this is an empty list.
+
 @end table
 @end deftp
 
+@deftp {Data Type} mpd-credential
+Data type representing an @command{mpd} password/permissions pair.
+
 @deftp {Data Type} mpd-output
 Data type representing an @command{mpd} audio output.
 
+@table @asis
+@item @code{password} (default: @code{""})
+The password used to authenticate.  The password may not contain "@".
+
+@item @code{permissions} (default: @code{'()})
+The permissions one gains after authenticating to the server using @code{password}.
+This should be a subset of @code{'(read add control admin)}, as in
+@code{default-permissions}.
+
+@end table
+@end deftp
+
 @table @asis
 @item @code{name} (default: @code{"MPD"})
 The name of the audio output.
diff --git a/gnu/services/audio.scm b/gnu/services/audio.scm
index 345d8225b2..9a6dc8db94 100644
--- a/gnu/services/audio.scm
+++ b/gnu/services/audio.scm
@@ -26,6 +26,8 @@
   #:use-module (ice-9 match)
   #:export (mpd-output
             mpd-output?
+            mpd-credential
+            mpd-credential?
             mpd-configuration
             mpd-configuration?
             mpd-service-type))
@@ -36,6 +38,16 @@
 ;;;
 ;;; Code:
 
+(define-record-type* <mpd-credential>
+  mpd-credential make-mpd-credential
+  mpd-credential?
+  (password    mpd-credential-password
+               ;; valid: any string that does not contain #\@
+               (default ""))
+  (permissions mpd-credential-permissions
+               ;; valid: any subset of read, add, control and admin
+               (default '())))
+
 (define-record-type* <mpd-output>
   mpd-output make-mpd-output
   mpd-output?
@@ -58,24 +70,41 @@
 (define-record-type* <mpd-configuration>
   mpd-configuration make-mpd-configuration
   mpd-configuration?
-  (user         mpd-configuration-user
-                (default "mpd"))
-  (music-dir    mpd-configuration-music-dir
-                (default "~/Music"))
-  (playlist-dir mpd-configuration-playlist-dir
-                (default "~/.mpd/playlists"))
-  (db-file      mpd-configuration-db-file
-                (default "~/.mpd/tag_cache"))
-  (state-file   mpd-configuration-state-file
-                (default "~/.mpd/state"))
-  (sticker-file mpd-configuration-sticker-file
-                (default "~/.mpd/sticker.sql"))
-  (port         mpd-configuration-port
-                (default "6600"))
-  (address      mpd-configuration-address
-                (default "any"))
-  (outputs      mpd-configuration-outputs
-                (default (list (mpd-output)))))
+  (user                mpd-configuration-user
+                       (default "mpd"))
+  (music-dir           mpd-configuration-music-dir
+                       (default "~/Music"))
+  (playlist-dir        mpd-configuration-playlist-dir
+                       (default "~/.mpd/playlists"))
+  (db-file             mpd-configuration-db-file
+                       (default "~/.mpd/tag_cache"))
+  (state-file          mpd-configuration-state-file
+                       (default "~/.mpd/state"))
+  (sticker-file        mpd-configuration-sticker-file
+                       (default "~/.mpd/sticker.sql"))
+  (port                mpd-configuration-port
+                       (default "6600"))
+  (address             mpd-configuration-address
+                       (default "any"))
+  (credentials         mpd-configuration-credentials
+                       (default '()))
+  (default-permissions mpd-configuration-default-permissions
+                       (default '(read add control admin)))
+  (outputs             mpd-configuration-outputs
+                       (default (list (mpd-output)))))
+
+(define (mpd-permissions->string permissions)
+  (string-join (map symbol->string
+                    permissions)
+               ","))
+
+(define (mpd-credential->string credential)
+  "Convert the USER of type <mpd-credential> to a configuration file snippet."
+  (format #f
+          "password \"~a@~a\"\n"
+          (mpd-credential-password credential)
+          (mpd-permissions->string
+           (mpd-credential-permissions credential))))
 
 (define (mpd-output->string output)
   "Convert the OUTPUT of type <mpd-output> to a configuration file snippet."
@@ -110,8 +139,14 @@ audio_output {
   (apply
    mixed-text-file "mpd.conf"
    "pid_file \"" (mpd-file-name config "pid") "\"\n"
+   "default_permissions \""
+   (mpd-permissions->string
+    (mpd-configuration-default-permissions config))
+   "\"\n"
    (append (map mpd-output->string
                 (mpd-configuration-outputs config))
+           (map mpd-credential->string
+                (mpd-configuration-credentials config))
            (map (match-lambda
                   ((config-name config-val)
                    (string-append config-name " \"" (config-val config) "\"\n")))
@@ -143,10 +178,10 @@ audio_output {
              #:environment-variables
              ;; Required to detect PulseAudio when run under a user account.
              '(#$(string-append
-                   "XDG_RUNTIME_DIR=/run/user/"
-                   (number->string
-                     (passwd:uid
-                       (getpwnam (mpd-configuration-user config))))))
+                  "XDG_RUNTIME_DIR=/run/user/"
+                  (number->string
+                   (passwd:uid
+                    (getpwnam (mpd-configuration-user config))))))
              #:log-file #$(mpd-file-name config "log")))
    (stop  #~(make-kill-destructor))))
 
-- 
2.26.2






Last modified: Tue, 28 Apr 2020 11:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.