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 uCMpN/R+UmEkSgEAgWs5BA (envelope-from ) for ; Tue, 28 Sep 2021 04:33:24 +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 CEXfMvR+UmGjRwAA1q6Kng (envelope-from ) for ; Tue, 28 Sep 2021 02:33:24 +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 5B66730B51 for ; Tue, 28 Sep 2021 04:33:24 +0200 (CEST) Received: from localhost ([::1]:49784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mV2vr-0004Yo-JO for larch@yhetil.org; Mon, 27 Sep 2021 22:33:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33562) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mV2vD-0004Vt-1G for guix-devel@gnu.org; Mon, 27 Sep 2021 22:32:44 -0400 Received: from mail-qt1-x835.google.com ([2607:f8b0:4864:20::835]:37572) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mV2vB-0000rb-Cx; Mon, 27 Sep 2021 22:32:42 -0400 Received: by mail-qt1-x835.google.com with SMTP id e16so16040238qts.4; Mon, 27 Sep 2021 19:32:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=S/0E5TE9iyWPE3BUALu9M9BT6vDvsGpJqlOt+dKvseA=; b=Xvjmc23OhKiF0HfZ+Vybtw59fdd6gnB9Odi2dCrLMHe1HQOo4KABd93iDyX3lScMwH DIjQA/K7xs6x/5b83O7bURmRKhs7m7CYO/N5lWh0rF+MrPVij7ZDOY7fiQoujkQ7aPYe a+dtnr29lQu22yO4ivlbRiR5KXzdXvRTZ/Lvdhm3ezenjLvsj9xQSiGkg5ftzxngqJyF 4LSDr61+jvZle31m5hpEQRgDyRP9fSRyTms6yPqRrd0mSBUa5/qoHbax2aQAxiwPYhA1 c2S61SP7h5LUM2C6lWa7koUuQlC3QrypeEw8u2UPmQKqJf/nBj22YAi1cuqvgmZfl+nx 6Urg== 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:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=S/0E5TE9iyWPE3BUALu9M9BT6vDvsGpJqlOt+dKvseA=; b=L6ORESCp7u1xCP9TOvF5SFtLp0wIq7sPZaAbnfZmviwaHC1rBqunQioR4+ooUXlZ29 fgoGblNWsqWvHRCyrL11LYGwEHnc9n20SSD0GPCbZ/vIWUZTf+ppVNezFlYo1j/LODRP Zis929xuHqDyjalX0EnlKoj8buStXVduY3HZC8JWCReQ7tbHukOkLI3yixPklXKqer02 HRS3HR11Xz5Hk9Zz8Jy6SylXaFTMHJtNk5LW4vhnzLUy+xPtewNtl6wxVeyyN6l0V5tL SThFPlfEhLlpygEhpHHFDDtZ4lAPrFV4sLqadz8d7PSSsdE9hgPHTNxg5312XBi7RiuY C6oA== X-Gm-Message-State: AOAM530nUvYcXRE7xaRTz4NDwVv0ydv5V9V4KqBpwMfrsLlZbnW2xgSV 1vz1ziSxQZrgVVlABDnRm9o= X-Google-Smtp-Source: ABdhPJxg5zJhZYagNEN2rHCg7FOwqXgbIybE4L6VJ1Obev9BsUzrpMawNFJYspJkmwXccDbPm7t3tw== X-Received: by 2002:ac8:119:: with SMTP id e25mr3224651qtg.232.1632796360115; Mon, 27 Sep 2021 19:32:40 -0700 (PDT) Received: from hurd (dsl-10-149-239.b2b2c.ca. [72.10.149.239]) by smtp.gmail.com with ESMTPSA id q14sm13783813qkl.44.2021.09.27.19.32.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Sep 2021 19:32:39 -0700 (PDT) From: Maxim Cournoyer To: Xinglu Chen Subject: Re: Code sharing between system and home services (was Re: On the naming of System and Home services modules.) References: <87tuiajdv1.fsf@yoctocell.xyz> Date: Mon, 27 Sep 2021 22:32:38 -0400 In-Reply-To: <87tuiajdv1.fsf@yoctocell.xyz> (Xinglu Chen's message of "Fri, 24 Sep 2021 15:35:14 +0200") Message-ID: <87pmsth1kp.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::835; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qt1-x835.google.com 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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, 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=1632796404; 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=S/0E5TE9iyWPE3BUALu9M9BT6vDvsGpJqlOt+dKvseA=; b=XFk2P1JltaIhGXYZjR/vy8lrWM5gPA5323Ebb63XlDbKEMGd9/HeRntG8WX/HWKpiVHPim XjEdSucvqMVwVZZn58MxP/HYu1IsvxnvkX+PdTPZh9gPYTrm7BbFOv6YaVVC47nOQMguMH mDBCLCXzdoCPtuiG2QHZ3RqWoqOsljD/zHuBe9t0Dtv3cyeTf8BMeU8TN8QfpllhFuaWql 8Q78bvjOh+sIYm3mepRST2mD8BrFNAk3LGMBi57NtBcB7iGJ/+WesiAY2nTswrophbNtGN UiNUJqPlHVYlLe4mJqqRUgYZDd6RzsWez9mgnXJwL7NXP0CvNpD2L7RWiS/izw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1632796404; a=rsa-sha256; cv=none; b=JKFzBS+LsfaiNuZ/pcvUtPR0pxFoxE1bkZCl4TXhYjWM4Oaop6CaLGCbl/mxqRzmYA594a d9OgGcT4KMEviTMscRk9IO8g1JRyHEEBfan+R0rz11mi9swtxCnixt0fQ6B/2C69mHcT1S 5eQarjB/ZU4rmXbO1hj/0CHDo/PZv3sRiJiEJRmQ9XLcMnBJ0bw0CLRuLRdNs+hlMRh6NO mk1WM2u6mJZhCJ76+XA6su2d6h9NCEdZGR95+Ru7Dtj1KIkx9kR+ysmh5IyehyOsAJwLCL AX7GuUOiL4+cRqjKQwUjdX5qxEW2cxgmQRKBGsKpxGlPuUGY/vakr3fy6Ga4Kw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=Xvjmc23O; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=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: -1.69 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=Xvjmc23O; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=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: 5B66730B51 X-Spam-Score: -1.69 X-Migadu-Scanner: scn1.migadu.com X-TUID: Wetl+gkfnfuF Hi, Xinglu Chen writes: > On Thu, Sep 23 2021, Ludovic Court=C3=A8s wrote: > >> Hi, >> >> Xinglu Chen skribis: >> >>> Some services might be useful to have in both Guix System and Guix Home; >>> 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. >> >> Silly question, but why do we need to have two different configuration >> record types in the first place? > > 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. > >> 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 main= tain. > > Agreed, that=E2=80=99s what I would like to see as well. > >> Would that be feasible? (Apologies if this has already been >> discussed!) > > 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. > > (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)) > > 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. Interesting idea, although I'm a bit wary of adding yet more complexity to this already relatively complex macro. I'd favor the cleaner inheritance idea proposed by Maxime Devos. I wonder if some fields can even be masked or removed through inheritance or some other record transformation (haven't checked). > It=E2=80=99s probably going to be quite complicated, so it would be good = to get > some feedback/thoughts on it. Cc Maxim since he has done some work with > (gnu services configuration). > > Also, it=E2=80=99s probably time to properly document (gnu services > configuration) in the manual. ;-) Agreed! Maxim