From patchwork Fri Jan 3 17:35:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Wurmus X-Patchwork-Id: 19559 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 948B2179EA; Fri, 3 Jan 2020 17:36:33 +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 52A2C17979 for ; Fri, 3 Jan 2020 17:36:33 +0000 (GMT) Received: from localhost ([::1]:55244 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inQsC-0007GW-AZ for patchwork@mira.cbaines.net; Fri, 03 Jan 2020 12:36:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37598) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inQrn-0007A0-48 for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1inQrl-0003LL-PB for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:06 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:35442) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1inQrl-0003KT-JD for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:05 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1inQrl-0008HQ-FG for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:05 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38902] [PATCH 8/9] services: nfs: Allow gss-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:05 +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.157807294931745 (code B ref 38902); Fri, 03 Jan 2020 17:36:05 +0000 Received: (at 38902) by debbugs.gnu.org; 3 Jan 2020 17:35:49 +0000 Received: from localhost ([127.0.0.1]:41405 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inQrV-0008Fx-L2 for submit@debbugs.gnu.org; Fri, 03 Jan 2020 12:35:49 -0500 Received: from sender4-of-o51.zoho.com ([136.143.188.51]:21167) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inQrT-0008Fp-QV for 38902@debbugs.gnu.org; Fri, 03 Jan 2020 12:35:48 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1578072945; cv=none; d=zohomail.com; s=zohoarc; b=Iy6tSxlz35buNfWfOrcydPOkUlM4e4RYp7CXhL4m5m1tpNpl2qiZZ3iCgnY2nzcA9LyIMo0Oq4VI6huDwAHLLhPIL8iXr4aEMWGsjQv6AS04dd6S9mBjZEjS1KQb0FqgqHNceohDF6ErR/jbhdHCsP7jGuMX2fu4XfWheaHmD28= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578072945; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=zBhaiPmT62PdvWfauu6GmkOCrThg9Vf5IIgba+c5Ruc=; b=hobzP3f8qdO7s5AU4se6A36PXBOZKUzMREQ4GQKaaMQOA/HriEawI17e0VaQRm7iZdeGHxZC+Lu9QAjgQR8kEpdKg0MlKrT6EywvZzyTVPLnbKTVyD1WVlXKeYV/bhNHYkj8gFxuB088OkciOAP/TwEZ8hS05lB8PjkQw0xNELA= 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=1578072945; 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=zBhaiPmT62PdvWfauu6GmkOCrThg9Vf5IIgba+c5Ruc=; b=Jn6vogciL6VUCmntm6Rq5qss9vMLbwdUCt7AvGtktyn2G1EUmD8+gplzH3FVP0Xt Ay1Q2nva2hwt3ND4+NBJzmzDbRZT0pRUXSZ6Fo2SFCf94uGled4CAF7fCdnJ2/qxf+n cXtLjtXS+GI7tVV6vy1WxIZoIuvxSqEUaBDIL8pU= Received: from localhost (p54AD4FBF.dip0.t-ipconnect.de [84.173.79.191]) by mx.zohomail.com with SMTPS id 1578072943374249.066292277691; Fri, 3 Jan 2020 09:35:43 -0800 (PST) From: Ricardo Wurmus Message-ID: <20200103173506.9779-8-rekado@elephly.net> Date: Fri, 3 Jan 2020 18:35:05 +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 (gss-service-type): Rewrite using SERVICE-TYPE to add ability to extend the service. --- gnu/services/nfs.scm | 53 +++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/gnu/services/nfs.scm b/gnu/services/nfs.scm index 054dad08b6..cd7e8fab01 100644 --- a/gnu/services/nfs.scm +++ b/gnu/services/nfs.scm @@ -136,26 +136,39 @@ (default nfs-utils))) (define gss-service-type - (shepherd-service-type - 'gss - (lambda (config) - (define nfs-utils - (gss-configuration-gss config)) - - (define pipefs-directory - (gss-configuration-pipefs-directory config)) - - (define gss-command - #~(list (string-append #$nfs-utils "/sbin/rpc.gssd") "-f" - "-p" #$pipefs-directory)) - - (shepherd-service - (documentation "Start the RPC GSS daemon.") - (requirement '(rpcbind-daemon rpc-pipefs)) - (provision '(gss-daemon)) - - (start #~(make-forkexec-constructor #$gss-command)) - (stop #~(make-kill-destructor)))))) + (let ((proc + (lambda (config) + (define nfs-utils + (gss-configuration-gss config)) + + (define pipefs-directory + (gss-configuration-pipefs-directory config)) + + (define gss-command + #~(list (string-append #$nfs-utils "/sbin/rpc.gssd") "-f" + "-p" #$pipefs-directory)) + + (shepherd-service + (documentation "Start the RPC GSS daemon.") + (requirement '(rpcbind-daemon rpc-pipefs)) + (provision '(gss-daemon)) + + (start #~(make-forkexec-constructor #$gss-command)) + (stop #~(make-kill-destructor)))))) + (service-type + (name 'gss) + (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 (gss-configuration)))))