From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60631) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e76qo-0008Cg-27 for guix-patches@gnu.org; Tue, 24 Oct 2017 17:35:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e76qk-0003lS-TB for guix-patches@gnu.org; Tue, 24 Oct 2017 17:35:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:51656) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e76qk-0003lF-OH for guix-patches@gnu.org; Tue, 24 Oct 2017 17:35:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e76qk-0004Vo-Bo for guix-patches@gnu.org; Tue, 24 Oct 2017 17:35:02 -0400 Subject: [bug#28960] [PATCH] services: Add murmur. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <750375c6-8bc2-3e63-05d3-fd94635aa88c@cock.li> <873769qgq6.fsf@gnu.org> Date: Tue, 24 Oct 2017 14:34:23 -0700 In-Reply-To: (nee@cock.li's message of "Tue, 24 Oct 2017 19:19:53 +0200") Message-ID: <87wp3kmdr4.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: nee Cc: 28960@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi nee, nee skribis: >>> +(define murmur-shepherd-service >>> =E2=80=A6 >> Use the accessors instead. >> > Right, that grew way too big. I removed most of the match blocks. > I like having the short names when it comes to stitching together the > actual config though, so I kept that one. > If that's still a no-go I'll make another update with accessors. > > If the main problem here is the positional binding, is there a function > to match record fields by name that I could use instead? Unfortunately no. > It doesn't seem like it would be too complicated to write a macro for > this with the record-accessor procedure from srfi-9. Indeed. I figured something like this works: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> (define-syntax match-record (syntax-rules () ((_ record type (field fields ...) body ...) (if (eq? (struct-vtable record) type) (let ((field ((record-accessor type 'field) record))) (match-record record type (fields ...) body ...)) (throw 'wrong-type-arg record))) ((_ record type () body ...) (begin body ...)))) scheme@(guile-user)> (match-record coreutils (@@ (guix packages) )= (home-page) home-page) $6 =3D "https://www.gnu.org/software/coreutils/" scheme@(guile-user)> (match-record coreutils (@@ (guix packages) )= (home-page synopsis) (list synopsis home-page)) $7 =3D ("Core GNU utilities (file, text, shell)" "https://www.gnu.org/softw= are/coreutils/") --8<---------------cut here---------------end--------------->8--- We could use that for now. Eventually though, we should have something better in (guix records) that (1) computes indices and report wrong-field-name errors at expansion time, and (2) accounts for thunked/delayed fields. WDYT? If the above macro is good enough, we can add it to (guix records) with a TODO comment. That would already be better than the other options. > I also noticed a missing equal sign after rememberchannel in the > defaultconfig and added that. I noticed a couple of obvious mistakes: --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/gnu/services/telephony.scm b/gnu/services/telephony.scm index 0c30b409f..a305a1be8 100644 --- a/gnu/services/telephony.scm +++ b/gnu/services/telephony.scm @@ -240,7 +240,7 @@ Or set public-registration to #f"))))))))) (define (murmur-activation config) #~(begin (use-modules (guix build utils)) - (let ((log-dir (dirname #$(murmur-configuration-log-file config))) + (let* ((log-dir (dirname #$(murmur-configuration-log-file config))) (pid-dir (dirname #$(murmur-configuration-pid-file config))) (db-dir (dirname #$(murmur-configuration-database-file config))) (user (getpwnam #$(murmur-configuration-user config))) @@ -283,7 +283,7 @@ Or set public-registration to #f"))))))))) (documentation "Run the murmur mumble-server.") (requirement '(networking)) (start #~(make-forkexec-constructor - '(#$(file-append (murmur-configuration-package) + '(#$(file-append (murmur-configuration-package config) "/bin/murmurd") "-ini" #$(or (murmur-configuration-file config) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable This makes me think that it would be good to have a unit test. Would you like to try writing one now (see the examples in gnu/tests/*.scm), or do you prefer to leave it for later? In the latter case, please test the system to make sure it actually works (that can be done in a VM.) Thank you! Ludo=E2=80=99. --=-=-=--