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 Kn5zEYCwUmGwDgAAgWs5BA (envelope-from ) for ; Tue, 28 Sep 2021 08:04:48 +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 YGp0DICwUmEVWQAA1q6Kng (envelope-from ) for ; Tue, 28 Sep 2021 06:04:48 +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 5F3E832972 for ; Tue, 28 Sep 2021 08:04:47 +0200 (CEST) Received: from localhost ([::1]:37832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mV6EQ-0001U0-D7 for larch@yhetil.org; Tue, 28 Sep 2021 02:04:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33338) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mV6Dd-0001S2-CA for guix-devel@gnu.org; Tue, 28 Sep 2021 02:04:01 -0400 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]:33469) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mV6Db-0005zy-7O for guix-devel@gnu.org; Tue, 28 Sep 2021 02:03:57 -0400 Received: by mail-lf1-x12f.google.com with SMTP id y28so87404820lfb.0 for ; Mon, 27 Sep 2021 23:03:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop-in.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=AdyQwcowXoTPLS2k+yAypqmP7OKrzc9ILf3EywC2yj8=; b=hFPbqT7uTn71uJnIsgRpzTXzuzH9dYw34EdBaP48D3Ec9cJJXWMG47JI6scwRoOmGM LAB8IIPozRBfB9CUDBHLjC+OTfbSMUh6P5eN/YVTikoR3rtreH4KbVyr3Zgm1BAdYPYb WMbEBZmdQy7kzqK3CVePIvGtHyoR5w0npTbjjkj811vI72+0ci9ztBhmMGi2pHRR5aT5 Qcvt7PMtJx/1bWaXZkgd+b3i60wAFJXZdAcciuMa2QHDkcOVXsD4KKJCejXsW+P0baGv 5Lm1ZyAiYka9lNkq/53hfC9RkMSbWvDqbpZKeJcyq6Zaf8YupuJnqSDU2Tk4rgnuqu4M ctpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=AdyQwcowXoTPLS2k+yAypqmP7OKrzc9ILf3EywC2yj8=; b=H60LFE5fYezjpEKfgj/HxUt+AxVfRR288E8C5/MbBAFO5GmYLxGXLOPqI7Je/FeKAt +dbX55Wrwz26cjxbSccxrLZhfNz3obF1zPDGl7Z6NmVBpZBqWcME6tGaUykfY7jwbPg/ NMgKx5a2FOgOb7u0xjxMy++XpA5w/si4KwLUc9yun+OWwspbDcVReFqomaw/L2hiq2eY 0Rv6lh60K2ovmV0FiJxFbQqQXjUo/AagZVIWb7UBQ12Eq7A9SsZYU/s6p+DmYkQGtWec 4DsEa9APyLnGKH90OJ+Mf7+mZxE9woGlxu2XsiuVj1SJyjy7CZ/EdnGrFhdg0sTytwL8 8gNQ== X-Gm-Message-State: AOAM530FmNew/4ySYz497WViDp3ljZ9gOQJk+BwKi5TY2lgTlBfkdSn2 WRyR5uQf4HUjkOQTxi4DOMSfBA== X-Google-Smtp-Source: ABdhPJz4Z9T3kATfib49fbvbPqUik3dx3F9o44SDCGlp+rIdIKOVMT3eXQO8gjY9ggcawSrYv6Hj4g== X-Received: by 2002:a05:6512:3096:: with SMTP id z22mr3842350lfd.167.1632809030292; Mon, 27 Sep 2021 23:03:50 -0700 (PDT) Received: from localhost (109-252-93-92.nat.spd-mgts.ru. [109.252.93.92]) by smtp.gmail.com with ESMTPSA id f37sm1807436lfv.214.2021.09.27.23.03.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Sep 2021 23:03:49 -0700 (PDT) From: Andrew Tropin To: Maxime Devos , Xinglu Chen , Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: Code sharing between system and home services (was Re: On the naming of System and Home services modules.) In-Reply-To: References: <87tuiajdv1.fsf@yoctocell.xyz> Date: Tue, 28 Sep 2021 09:03:46 +0300 Message-ID: <87lf3hgrst.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Received-SPF: none client-ip=2a00:1450:4864:20::12f; envelope-from=andrew@trop.in; helo=mail-lf1-x12f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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 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=1632809087; 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=AdyQwcowXoTPLS2k+yAypqmP7OKrzc9ILf3EywC2yj8=; b=udreAU16PqRPf7uGL3ZB5TQvufpXgdWCMEZoLAk+ehqoSd6PDUa+vBRdfH8nmjsIJ7p0Fw Acg/R9Y9D6et52Zz8HYiWbMTnJYZN17Tt/Gxug4DGr/ckEA7DumKowFyWeuN/rYXouhYJD sktTvefEdPzdrg0ZYviq0LtaMXTtmaLjUqFHkQ+T2pbkU1aj498hALpoHXE4tqXnOqNuZH k/90IyJGT/IgMeo4V4UfctRYeAD21Szr+pzJA4L/xc+Fj41sHFGRbyI1vQglcceWFWmDLq tfdmX1TT4GLW0b6C98Wbr5UCNtX66wEvI5IndEnvkJaMUmx4qEEvcSqqscW/kQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1632809087; a=rsa-sha256; cv=none; b=T+kKBofdLi0Bvgn4WrJu5HXOfwqLyeyaVI9/p59wQs73CUw4HVwH+Jb/a0rFPPCHlEqE38 13LrkQE7LJxuayzjOEVqgsOIl6es5DKm5YDZlBaJQOpeYxOwMmSJVQwET8dwwH32gv/L6R RDw9Pmr1tAmOXFZZbIOxH8tlA3fw2bONWi3jSgSD7BiIjdQKllUqwBqLUa699DEs6dnwrK 2F0G5e8ARf+9IJEd7xZN3Dtt6GD/dZtw6jR0DHRLk+88n6t7CvWlhP45najGhn4jWvPcJm 1vKOPHncwE86bSZDA3aFKo8w/IWlJvQ0XhxrE7Mmz9HIrKTvVSigHWacsla2uw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=trop-in.20210112.gappssmtp.com header.s=20210112 header.b=hFPbqT7u; dmarc=none; 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.19 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=trop-in.20210112.gappssmtp.com header.s=20210112 header.b=hFPbqT7u; dmarc=none; 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: 5F3E832972 X-Spam-Score: -3.19 X-Migadu-Scanner: scn0.migadu.com X-TUID: 9W6ty0x9/GF4 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2021-09-24 16:03, Maxime Devos wrote: > 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 H= ome; >> > > 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 hav= e 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 s= ervice >> 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: = it >> > 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 ma= intain. >>=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 conf= iguration 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 = types: > > The record type with all fields common to the home configuration and syst= em 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-con= figuration? > are common-syncthing-configuration?. > > Greetings, > Maxime. It can work. Good idea. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmFSsEIACgkQIgjSCVjB 3rD2WQ/8C0W6GR/dSVi7YRsnGVF59WB8aLIr2ef3OLn3gIYZr0K+vK6JhPxatX90 am0NN+55qViEZ8OBdELJnN3Thmo6NcQWenCA+um20XWvPDXywjz7u6XFKjoz1StW gZ9GVUMBUVa1iAWA8UOpBPH6ryQbrf3zwFOFZ+irbbudybADf+7NDbFcWmKcvKOy 6xX0MxyLOfP/suPsKYc6Co0ARTOCf27d/Ua+SYH9bktrS3AZn+lu+n0L3E/aQBtH 5x8xhO4blyM7ay+BLtXNrkdou8IHNIXMw867VyVMIzxh3Xm/D5tqaulNA7jG49qM TNZI0bXqkZI2VbyhG/hiRQnFIm0MQwmtG96RYygMjPjSHGPH+wSNDrSWnZsatXor 4cVZjHOB8x5iVPZae/4aDwRkwUHPUzbuVxD4pMm/VSHc+q9qi5gg+oA+m/FJu7RP WT0w7aAfP3azf2vrx/yM4F0RY7Av3iPMJ0uN16bi0aM9GJVZkYY8CaqWY/faKhth 9X6Bc+g+Nx+KWn8U8eowiY5VWZ+COwH/h7xdcOOCxi+DUbey5EPRyAPIpnE6iMFX tKzlU313pi8jAYQAgbQoNkjmmbfumHV0F4kaaaldwerBwdtLAwR2ieNajWmmWWnR OxXWH9g8WwUFQKAgRbn7AUXUGdMtaTugBWskdwLbAG26gdKrAWk= =dzED -----END PGP SIGNATURE----- --=-=-=--