From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id ALdDD47xTWEicwAAgWs5BA (envelope-from ) for ; Fri, 24 Sep 2021 17:41:02 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 2HkMC47xTWGsCAAAB5/wlQ (envelope-from ) for ; Fri, 24 Sep 2021 15:41:02 +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 F21393A4A1 for ; Fri, 24 Sep 2021 17:40:58 +0200 (CEST) Received: from localhost ([::1]:35730 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTnJq-00082B-39 for larch@yhetil.org; Fri, 24 Sep 2021 11:40:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34044) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTnJ4-0007yl-8a for guix-devel@gnu.org; Fri, 24 Sep 2021 11:40:13 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:38690 helo=mail.yoctocell.xyz) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTnJ1-0000WR-Qd; Fri, 24 Sep 2021 11:40:09 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1632498001; bh=v+9Mc75/1hjyS85yG+MBVBLDA6bJT4t265yr1vq2s24=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=dt6/osiFOdtrUzXU8z0JWezZloyBVzgzw9TR5WGvaNbanDYBVyTksvRfvREwRuaPQ ldy7F6Yf5wqkc9QTp0mBbQo7yeoLP1mJoMRFUGepwN9jTAz4WwhcgFte4WHKSQSdrZ nI3vRQONpolCHfeSouUQKjSDmV8CfrqfqL+ygyAI= To: Maxime Devos , 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: Fri, 24 Sep 2021 17:39:57 +0200 Message-ID: <87k0j6j836.fsf@yoctocell.xyz> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Received-SPF: pass client-ip=87.96.130.155; envelope-from=public@yoctocell.xyz; helo=mail.yoctocell.xyz X-Spam_score_int: 14 X-Spam_score: 1.4 X-Spam_bar: + X-Spam_report: (1.4 / 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, FROM_SUSPICIOUS_NTLD=0.499, PDS_OTHER_BAD_TLD=1.997, PDS_RDNS_DYNAMIC_FP=0.001, RDNS_DYNAMIC=0.982, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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=1632498059; 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=YF1gyux2WWxosl9vRwP1vpma6iMwkCEBtEhYHntY/dA=; b=BMNx4+VhjQRAUcABH9KJQOWfUZj0qq1RI+V28Rqxt1KnAkvs35CFYFsonXM6WjdJ8ADkbe cerHaI045jekbjRjbhdE4LJB+adpekfAqJzT88NbTmervs1CAuvsrOxLmSUzYOciAwM9W4 mb84qhIYmIXKdBQqbgvYw6bRt75sVCJ+G0ljO7gel6Peusr5rPtsnqnL1xlVnBX2YvIMfc CFddib1tr5bRfi7tJ2pzxFNzE904zPAnCYnoioliMO3OZmXbb0TiJ4bgn72XPVGMPPPxqe Xn/cSC39VF6EX2zCRH83jciNJ6+rzWMP83DIpJImG/jUQKk9g00orkDGaMlXqg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1632498059; a=rsa-sha256; cv=none; b=tMLyOEP+EKoId6fyyPJQ0PCJAnjTrtSjqfxfa2OWWNPnTYLP8jobgVBJCu5OydjRxBNrFT cTStVVShlNEIx5AGnbHL00pzZ1J54AE5OPko2L/w8UAKjCu1q2Rw0Ym0FRSejYq+vWKXeF XdL5VYipeR+8ZAE6WgMOOyiPcgzvET5m7Ey2CfEd4fD4OPJtmGa7jbybV4UYLu4ipRnmfn 2psYao7JibgriU8w1voizT/J7ZZ6MKqmDrsGlsu42U616wHXPW1yTFTZjLZbjOX9DfMYGv +8MgMQEiriLY2qX+NSR6kSGFU6Uw1sj+K8c9rIsqQqH/qmdBpIETRoKXDJFF2w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=yoctocell.xyz header.s=mail header.b="dt6/osiF"; dmarc=pass (policy=none) header.from=yoctocell.xyz; 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=yoctocell.xyz header.s=mail header.b="dt6/osiF"; dmarc=pass (policy=none) header.from=yoctocell.xyz; 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: F21393A4A1 X-Spam-Score: -3.69 X-Migadu-Scanner: scn0.migadu.com X-TUID: qfV3r7r4J6dn --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Fri, Sep 24 2021, 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?. I didn=E2=80=99t know about the parent mechanism; that could be an approach= to take. But since =E2=80=98define-configuration=E2=80=99 is based on (guix r= ecords), would it make sense to adapt (guix records) to (rnrs records syntactic) instead of SRFI-9 records? --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJJBAEBCAAzFiEEAVhh4yyK5+SEykIzrPUJmaL7XHkFAmFN8U0VHHB1YmxpY0B5 b2N0b2NlbGwueHl6AAoJEKz1CZmi+1x5TbkP/03Afx7PMH2glsTJqaRhB7heBvCO /gKVD4pbvuExtqD2BVXAF/V8ekTwMm9lx3j19LfCu2aUXDeGiJY2SMWZqX7/wDI3 Qw4u6zY8iubbyj+blRAEEloViMZEbVXkjFCYZKwK3OWezIBmjkt6CIdWrtRM9aWN WoLEnbIhPMCGqSrznBT4PBimr9umw/RRLpv/u6NRDH5JcHfFeBs6UXCkIgUlgxmW N5fpqOUl1syxOJobbrxHC9DOPrX0R3RjTEQnM+vISCGVIeTNPpZVE+ny4jux+BV0 7F6u1eD7voQ2O0Oovf3L3PTOsCu07z9e65TVsRnZH88gtQpNB4vfriBxyaeymfhE 8RYeMzwJqRN3WWGroqlEhd5MGImmkcWL8KK/wU9boPqCItuIZEJF9T7Ipx9R2/gy Sou7Bp5S8aMVf4vOganUH2GxRqUkmYtQoCzzyTQmCPqIZENZ5ivwMVA8IEuq8chc 4ecL1jIfn11ceMqeRAfZBzg4r/QL/EJNBtR3RHnf8UDVVmcKuiyQTa6TgJP6kuX2 ab+AKjfedp8kykaAuHddYco7bwU18KaJdsQqlgrAdKxNqzK/k2c90oCNpjaRx+R0 2vrRhiHYNPoVQGecNzgWJ2TqugEA0iJMBqeVPIdULPLQUqytSeOmYuZzkNvp22fo DSNiu3DB5sACLnp5 =Dd3f -----END PGP SIGNATURE----- --=-=-=--