From patchwork Fri Jan 3 17:35:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Wurmus X-Patchwork-Id: 19558 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id E36B6179EA; Fri, 3 Jan 2020 17:36:32 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id A894117979 for ; Fri, 3 Jan 2020 17:36:32 +0000 (GMT) Received: from localhost ([::1]:55242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inQsB-0007Ft-LQ for patchwork@mira.cbaines.net; Fri, 03 Jan 2020 12:36:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37407) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inQrk-000777-W9 for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1inQrj-0003AP-Le for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:35437) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1inQrj-000398-H0 for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1inQrj-0008Gp-CR for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38902] [PATCH 3/9] services: nfs: Allow rpcbind-service-type to be extended. Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 03 Jan 2020 17:36:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38902 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 38902@debbugs.gnu.org Cc: Ricardo Wurmus Received: via spool by 38902-submit@debbugs.gnu.org id=B38902.157807292931654 (code B ref 38902); Fri, 03 Jan 2020 17:36:03 +0000 Received: (at 38902) by debbugs.gnu.org; 3 Jan 2020 17:35:29 +0000 Received: from localhost ([127.0.0.1]:41390 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inQrB-0008EP-Aa for submit@debbugs.gnu.org; Fri, 03 Jan 2020 12:35:29 -0500 Received: from sender4-of-o51.zoho.com ([136.143.188.51]:21152) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inQr9-0008E9-Q7 for 38902@debbugs.gnu.org; Fri, 03 Jan 2020 12:35:28 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1578072925; cv=none; d=zohomail.com; s=zohoarc; b=XO9vfyDOP21NnDwzzvs7I2wB3rcSROmp1Cs+6DwbqFWbZLy9oFZLRFaDWBGwxY9FD0vTkTjxYw3r3ptmvk8HQ0Uo2WU+DaVpyrCKGRGMcBsB1P9ZoxzeYVxt7CLZthVdGeKt1lkIrPwVEjIVENct6yTnk07yAuQ3rMlJotIrWl4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578072925; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=o4My4sRhsNLyOe9QG+vg2+k5MYXQHMdSdnPgCsW5Nos=; b=QvMu3qDAS89W3rR6qP9hRUfFbKktgVymwSZpml+swqjc2EjB3d47SYjahvw2kUqZI6GqTuEnHljeDrFBqce+U1OD1FMfIXDQ+vlK6owxBQJrq+YrKcyGMU0Vb7Rmq9WtkkstsTtVurDcUPHGUTAM71DJrq1zD8l54C3qaIdhl7E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1578072925; s=zoho; d=elephly.net; i=rekado@elephly.net; h=From:To:Cc:Message-ID:Subject:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type; bh=o4My4sRhsNLyOe9QG+vg2+k5MYXQHMdSdnPgCsW5Nos=; b=MKZdYXh4zrfYriCrR3Ah3b2GjDrN9ES7E43K93BZgf8DcRsPN42Nv6wSfkccTgAG 4f9i7X11M24bkS7GtN45THowypuU+BD+VTAfzrKykAc2bfKHtuaL0Odpyxrwo23Jp4c GxxuW9qTGIVUph4qFcMG8/iGBu2Bq7MPKLTF3N0A= Received: from localhost (p54AD4FBF.dip0.t-ipconnect.de [84.173.79.191]) by mx.zohomail.com with SMTPS id 1578072922622931.5578194081803; Fri, 3 Jan 2020 09:35:22 -0800 (PST) From: Ricardo Wurmus Message-ID: <20200103173506.9779-3-rekado@elephly.net> Date: Fri, 3 Jan 2020 18:35:00 +0100 X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200103173506.9779-1-rekado@elephly.net> References: <20200103173506.9779-1-rekado@elephly.net> MIME-Version: 1.0 X-ZohoMailClient: External X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/services/nfs.scm (rpcbind-service-type): Rewrite using SERVICE-TYPE to add ability to extend the service. --- gnu/services/nfs.scm | 47 ++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/gnu/services/nfs.scm b/gnu/services/nfs.scm index 834e94a800..0681e764ec 100644 --- a/gnu/services/nfs.scm +++ b/gnu/services/nfs.scm @@ -56,23 +56,36 @@ (default #t))) (define rpcbind-service-type - (shepherd-service-type - 'rpcbind - (lambda (config) - (define rpcbind - (rpcbind-configuration-rpcbind config)) - - (define rpcbind-command - #~(list (string-append #$rpcbind "/bin/rpcbind") "-f" - #$@(if (rpcbind-configuration-warm-start? config) '("-w") '()))) - - (shepherd-service - (documentation "Start the RPC bind daemon.") - (requirement '(networking)) - (provision '(rpcbind-daemon)) - - (start #~(make-forkexec-constructor #$rpcbind-command)) - (stop #~(make-kill-destructor)))))) + (let ((proc + (lambda (config) + (define rpcbind + (rpcbind-configuration-rpcbind config)) + + (define rpcbind-command + #~(list (string-append #$rpcbind "/bin/rpcbind") "-f" + #$@(if (rpcbind-configuration-warm-start? config) '("-w") '()))) + + (shepherd-service + (documentation "Start the RPC bind daemon.") + (requirement '(networking)) + (provision '(rpcbind-daemon)) + + (start #~(make-forkexec-constructor #$rpcbind-command)) + (stop #~(make-kill-destructor)))))) + (service-type + (name 'rpcbind) + (extensions + (list (service-extension shepherd-root-service-type + (compose list proc)))) + ;; We use the extensions feature to allow other services to automatically + ;; configure and start this service. Only one value can be provided. We + ;; override it with the value returned by the extending service. + (compose identity) + (extend (lambda (config values) + (match values + ((first . rest) first) + (_ config)))) + (default-value (rpcbind-configuration)))))