From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id qD2OE5Qst2NghAEAbAwnHQ (envelope-from ) for ; Thu, 05 Jan 2023 21:01:24 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id sKJ2E5Qst2NvnAAAauVa8A (envelope-from ) for ; Thu, 05 Jan 2023 21:01:24 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 46ED13D68D for ; Thu, 5 Jan 2023 21:01:23 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pDWQ9-0008Di-8d; Thu, 05 Jan 2023 15:01:02 -0500 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 1pDWQ4-0008D6-NT for guix-devel@gnu.org; Thu, 05 Jan 2023 15:00:56 -0500 Received: from mail.arctype.co ([138.68.9.245]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pDWQ2-0006XD-I4 for guix-devel@gnu.org; Thu, 05 Jan 2023 15:00:56 -0500 Received: from authenticated-user (mail.arctype.co [138.68.9.245]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.arctype.co (Postfix) with ESMTPSA id DEB7913B184; Thu, 5 Jan 2023 20:00:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=arctype.co; s=mail; t=1672948815; bh=U2CgnIMhijNEWyUVuvQqci33o+caWnUVV0fF6Q0FWp8=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From; b=gU06DzXC0alQWLrsPl/cVYXPVPvI0jbX49QotWZzQWrC1XQ4Drm4MKCzejibjmybE czkRDWWKE+8eHH4xeeuRDx4GDLf586jytXT+j5Sy7dqz3Ib7HERHcisxeNGodi/g4L vsxa35kebxAuIgNmnTv4Trbt1Pe2ovxf7C1eEyNT3OR6YTXqHKQN0f+idMp/Fm3PXA gTsj4AvpKwVUvCMfUoIImSF/czU0/+y3UXwCxQbe+pOxXIU2Bo3+q3e4bfUqL6wA4t 5omGqEaP64112IVqqEHYBfRK9pOMc0yEcYkozOOXPGy/n5pNPp/vNQhV4dzd9ODwMi gEHQZUTgAi4gg== Date: Thu, 5 Jan 2023 12:00:09 -0800 (PST) From: Ryan Sundberg To: mirai Cc: guix-devel@gnu.org Message-ID: <06384d87-f628-4b78-af7a-1ba199b98e85@arctype.co> In-Reply-To: References: Subject: Re: Expanding service procedure to accept additional arguments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Correlation-ID: <06384d87-f628-4b78-af7a-1ba199b98e85@arctype.co> Received-SPF: pass client-ip=138.68.9.245; envelope-from=ryan@arctype.co; helo=mail.arctype.co 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, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1672948884; a=rsa-sha256; cv=none; b=Moj0Vkm/oWadGCHuMSzOqbRw80b/7pWfSHUC6ZeQGLuEHZD1e2JkRknAahKfnP0N5qC6Vt SjCzEeZUaSo8PV1IpYKp5QrQ5MEfVJuDQQ+ViQA++hSPs/SWZ47LfR4jBYMtcZrzfPxvW+ L0rrcgPhF+hpckV2ehYinb6IjbN8ejzIMJpoaKmjMBjYThqEvTGrsHVSSXX9YP9tQBTuB+ SSxhgIpeDdqYN8jduHJCT1BgK+pkTwSFm/hjvfYDn0cg/Y+AbtxPpXSecqUJYnr/mMY/EF 4HYHVXukZUz8w8k6WfXYLXhvSdbYgApuLvoI1v9uHdJOa0e0wErl3tvgbn8zag== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=arctype.co header.s=mail header.b=gU06DzXC; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=reject) header.from=arctype.co ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1672948884; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=U2CgnIMhijNEWyUVuvQqci33o+caWnUVV0fF6Q0FWp8=; b=gkwWcknT0h4EqPG+a4xS4okNWGEzVLM5ACvVXlxBCoEzKPLhNI0+3XdHaN8RWWNH9+MsDF QF3P0dBoqM9pfQ4PW2ygsunIX/k6CdA5Fbgb1ns8yWzSODg/jPyYGJhzuf//x+oBFIrGQy d0oBEte4PYbGBbUN6r9/xDGFyOMRo/J0h1baIsKafBMWbzhMtijtaI15cX5n/s1+7LI0AX 2riJXVTZW4m2S5Ki6ysd48caErXETdKTx/ZbAVCXPMn6+9PYRFk1UCALNP8QsaBqagO2Ou u+Qovo9X36RRNGLl416u99aHeuoutZ+eBUBHFYrSCobFHQZGQj5hplKXgDPaRw== X-Spam-Score: -7.56 X-Migadu-Queue-Id: 46ED13D68D Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=arctype.co header.s=mail header.b=gU06DzXC; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=reject) header.from=arctype.co X-Migadu-Scanner: scn0.migadu.com X-Migadu-Spam-Score: -7.56 X-TUID: yVuF+TXhI9cN Hi Bruno, I have written some useful macros for transforming services as you describe= here. You may find them useful: https://lab.arctype.co/poseidon/poseidon-os/-/blob/master/poseidon/services= /base.scm Sincerely, Ryan Sundberg Dec 28, 2022 8:48:15 AM mirai : > It is occasionally desired to have a service depend on additional shepher= d services > than the defaults listed in their definition. >=20 > Examples where this can be seen is the shepherd-requirement field provide= d by > nginx-configuration and opensmtpd-configuration, but these fields are rec= ord-type > specific and not available for the other service types (unless patched in= ). >=20 > An alternative to patching the original record-type is to define a custom= service-type > record-type and inheriting it which is somewhat clunky for what amounts t= o a setup-specific > single line change: >=20 > --8<---------------cut here---------------start------------->8--- > =C2=A0 (shepherd-service > =C2=A0=C2=A0=C2=A0 ... > -=C2=A0=C2=A0 (requirement `(...)) > +=C2=A0=C2=A0 (requirement `(... ,@shepherd-requirement)) > --8<---------------cut here---------------end--------------->8--- >=20 > Another type of extensibility that should be considered is the capability= to add extra > service-extensions to existing service-type records. > These can be useful for setup-specific (i.e. not applicable in general to= be included with Guix) scenarios, > for example, to add an extra activation-service-type extension or have a = special-files-service-type > extension that the service-type usually does not have. >=20 > The current approach that I'm aware of to achieve something similar is th= rough > simple-service, drawbacks being extra boilerplate code and a "disjoint" s= ervice > whose connection to the "parent service" is not immediately apparent. >=20 > --8<---------------cut here---------------start------------->8--- > ;; Ideally this should go in radicale-service-type > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (simple-service 'c= hmod-radicale shepherd-root-service-type > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 (list (shepherd-service (requirement '(user-homes)) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (p= rovision '(radicale-home)) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (d= ocumentation "chmod g+rwx to user 'radicale' home.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=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #t))))) > --8<---------------cut here---------------end--------------->8--- >=20 >=20 > Instead, what if the service procedure could be changed to accept optiona= l keyword arguments? > Then one could express the extensions and dependencies as: >=20 > --8<---------------cut here---------------start------------->8--- > (services > =C2=A0 (service foo-service-type > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #:requiremen= ts '(networking nscd smtpd) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #:extensions= (list (service-extension bar-service-type (lambda _ ...)) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 (service-extension activation-service-type (lam= bda _ ...)))) > --8<---------------cut here---------------end--------------->8--- >=20 > Thoughts? >=20 >=20 > Regards, > Bruno