From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id kHvqCcDaTWFdPgAAgWs5BA (envelope-from ) for ; Fri, 24 Sep 2021 16:03:44 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id +BWhBcDaTWHjcQAA1q6Kng (envelope-from ) for ; Fri, 24 Sep 2021 14:03:44 +0000 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 A749B38208 for ; Fri, 24 Sep 2021 16:03:43 +0200 (CEST) Received: from localhost ([::1]:42058 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTlnh-0006cT-HQ for larch@yhetil.org; Fri, 24 Sep 2021 10:03:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36136) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTlnJ-0006Xe-SM for guix-devel@gnu.org; Fri, 24 Sep 2021 10:03:17 -0400 Received: from andre.telenet-ops.be ([2a02:1800:120:4::f00:15]:59170) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mTlnG-0000yk-Fy for guix-devel@gnu.org; Fri, 24 Sep 2021 10:03:17 -0400 Received: from ptr-bvsjgyjmffd7q9timvx.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:aaf1:9810:a0b8:a55d]) by andre.telenet-ops.be with bizsmtp id xq392500M0mfAB401q39G1; Fri, 24 Sep 2021 16:03:09 +0200 Message-ID: Subject: Re: Code sharing between system and home services (was Re: On the naming of System and Home services modules.) From: Maxime Devos To: Xinglu Chen , Ludovic =?ISO-8859-1?Q?Court=E8s?= Date: Fri, 24 Sep 2021 16:03:09 +0200 In-Reply-To: <87tuiajdv1.fsf@yoctocell.xyz> References: <87tuiajdv1.fsf@yoctocell.xyz> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-0NyoSH+XbZpNYUac9Nj5" User-Agent: Evolution 3.34.2 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r21; t=1632492189; bh=3GZPhBOqFiGdWTWPVaSKJMeXbutYBLCuwXmmU9GQKjY=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=A6r2BCbC92kuofDTBPxOu2NPyuszgpdbYJmreLtgE5dIhYIBxSpX1BBlrAokEE/Kl mnF9Az6T9Pwubj0LpEVWLQebZS8BIyWmSyecON1kuFO3MT+vbqzrYGR12Q9xB8ltr6 RuiZjRKoSRIiTkJzxGmI3fx5FjhrKRthHqVnKZLgtXYL4/vNyp94Di1EnDEhgBgL/z YqLHlnfo/Gih6sLxTfsDVVwWntiKHk8e5t42qVB2/XuJsaYrhxITzu6Wgf0wrDu22I Dx7ARYC5ucuznhzOP73XEklXQokczA9zQtllYlbjGfCbvSYdkYXzSdIV8dOtnV/kB0 h2IcLFxSrt2rA== Received-SPF: pass client-ip=2a02:1800:120:4::f00:15; envelope-from=maximedevos@telenet.be; helo=andre.telenet-ops.be X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=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.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: guix-devel@gnu.org, Maxim Cournoyer , Andrew Tropin Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1632492223; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=3GZPhBOqFiGdWTWPVaSKJMeXbutYBLCuwXmmU9GQKjY=; b=nJYlQylnBpI79h84E5rfy4JB+LsGowO+8Qk8zNlZwwR/f/A7UXzF+n3BaS8jhUExq8krqv v3rvN/sl22jIdfkAajTXV/kpGqltXckG565T+CTuqgId681Un7PvrOjlEQ+wTCZpSlA28p /Sh9JGwI7bcKnyiw7bTJ7yBinqZ2SISIUAsS6jaPU3ShyO+6BfbfQNseYyLtQKxCC0AVd2 uc4rCT/Fia2zCOUo1O+CTj+HWT/odVK72idT2BpiZLfasKKq3lqY0BxjiazFfirwmT0q+6 iqZVlYu+dqp+5L3z0GdzWJHoHKtdJ+rImw5ITU2xc2Z5mpQEuucKH7LC+/3org== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1632492223; a=rsa-sha256; cv=none; b=H1vn5A3l5RAyWC/2NE77VTAb9A2DX8Bgh6svE9zdml3qnHPvmjbasNxXNKUSe3acCjKEu+ 7HYkjw+RDsGWAZuQf0Yf21lLSYTGBiWK4QEdqB2UY3HhiCtI5yS9r4jxCHcYtef2Qqic4W 8qPNof4ObHwgjo8ZVc/POXMnRmBXzJ0ogyz9v666fHu8q6OLK96YRgI5laPJvisaVComol buzuzhsIj3PwnwU2QbExmWEzFPTeuFLq3HpfvoFA55H97GzWH+SPuYpAYdRPyTrzICQOvH mkIj7q66b76la+YEUinR+ij2P4Egs24vabZlCgVtBbGQM3axTAHCZ1yyHWUkww== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=telenet.be header.s=r21 header.b=A6r2BCbC; dmarc=pass (policy=none) header.from=telenet.be; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Spam-Score: -3.69 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=telenet.be header.s=r21 header.b=A6r2BCbC; dmarc=pass (policy=none) header.from=telenet.be; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Queue-Id: A749B38208 X-Spam-Score: -3.69 X-Migadu-Scanner: scn0.migadu.com X-TUID: yh67TJAxBgYn --=-0NyoSH+XbZpNYUac9Nj5 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xinglu Chen schreef op vr 24-09-2021 om 15:35 [+0200]: > On Thu, Sep 23 2021, Ludovic Court=C3=A8s wrote: >=20 > > Hi, > >=20 > > Xinglu Chen skribis: > >=20 > > > Some services might be useful to have in both Guix System and Guix Ho= me; > > > for instance, Guix System currently has a service for configuring > > > Syncthing, and I think it makes sense to also have one for Guix Home, > > > this would mean that people not using Guix System (me :-)) could also > > > have Guix manage Syncthing. With the current approach, we would have= to > > > copy and paste quite a bit of code, and if the Syncthing service for > > > Guix System changes, then the one for Guix Home might have to change = as > > > well. > >=20 > > Silly question, but why do we need to have two different configuration > > record types in the first place? >=20 > The problem is that the configuration records for system and home > service don=E2=80=99t necessarily have the same fields. The Syncthing se= rvice > for Guix System has a =E2=80=98user=E2=80=99 and a =E2=80=98group=E2=80= =99 field, which is not really of > any use in Guix Home, as the only user would be the user invoking =E2=80= =98guix > home=E2=80=99. >=20 > > Sharing configuration between Home and System sounds important to me: i= t > > means users can easily move services from one to the other, which is > > pretty big deal. It also means we=E2=80=99d have much less code to mai= ntain. >=20 > Agreed, that=E2=80=99s what I would like to see as well. >=20 > > Would that be feasible? (Apologies if this has already been > > discussed!) >=20 > Since it might not make sense to have the same records fields for a > system service and home service, I proposed (in the mail you replied to) > a =E2=80=98define-configuration=E2=80=99 form that would generate a confi= guration record > for a system service and optionally one for a home service, without > having to maintain two records separately. >=20 > --8<---------------cut here---------------start------------->8--- > (define-configuration syncthing-configuration > (package > (package syncthing) > "Syncthing package to use.") > (arguments > (list-of-strings =E2=80=99()) > "Command line arguments to pass to the Syncthing package.") > (log-flags > (integer 0) > "Sum of logging flags.") > (user > (maybe-string 'disabled) > "The user as which the Syncthing service is to be run." > (home-service? #f)) ; not for Guix Home > (group > (string "users") > "The group as which the Syncthing service is to be run." > (home-service? #f)) ; likewise ^^ > (home > (maybe-string 'disabled) > "Common configuration and data directory.") > (home-service? #t)) > --8<---------------cut here---------------end--------------->8--- >=20 > It would generate and > . The only difference being that > doesn=E2=80=99t have a =E2=80=98user=E2=80= =99 and a =E2=80=98group=E2=80=99 > field. The 'parent' mechanism (rnrs records syntactic) 'parent' could be used here (after adapting it to define-configuration), to define three record ty= pes: The record type with all fields common to the home configuration and system= configuration ( + common-syncthing-configuration?) and the record types for the home and system configuration ( + syncthing-configuration? and + home-syncthing-configuration?). Using this mechanism, all syncthing-configuration? and home-syncthing-confi= guration? are common-syncthing-configuration?. Greetings, Maxime. --=-0NyoSH+XbZpNYUac9Nj5 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYU3anRccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7maFAQDKwdVRc0ukd/W3mvesmuEYvFzc +qjy1kha0zMLeosKFAEA8jYivpalQnZNSZVGPFnnoiKZCzfVHFZEcs/XBp98Mwg= =VHye -----END PGP SIGNATURE----- --=-0NyoSH+XbZpNYUac9Nj5--