From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id SFTRGU8LeGZBlgAA62LTzQ:P1 (envelope-from ) for ; Sun, 23 Jun 2024 11:47:27 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id SFTRGU8LeGZBlgAA62LTzQ (envelope-from ) for ; Sun, 23 Jun 2024 13:47:27 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=wolfsden.cz header.s=mail header.b=JVyjcB90; dkim=pass header.d=wolfsden.cz header.s=mail header.b=QZpQ+F2C; dmarc=pass (policy=none) header.from=wolfsden.cz; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1719143247; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=v5xxun7sSuzqybyGMZmS53zjiayOqNw4RTuRQV1Vwio=; b=ZvtjOowV0Xn1ZHg0CGvX4bblVaYumUZrnxDD+WTgkwbcdBO3mKHUEN2vz9NPRbZQ8yr9aj 3W2ZKfbceh+oWG3CdlSgqdeSXdlR3CjlYzD1AfCWCXnZkbU/CwpEhvJeHighN70YOEFd2V 8n/vvlsTDayAzWAAUJUu7AVbxKAHdEC77Uw8btDYoKt6gHIfBy8jlrgZLKWZmOLCVFlvSf i5WKrm1FaxEWgrBE/2kkNJzHj7rtVbtQzbq+NBw21Atrjc7nzJnRB0sxyt0sGeDYKeGIaN Cem2XU4wiU2ZGFir5R1m0GNcffC3JSy2EOT66vbMElIqWxqeNKiUePBJqC2tiw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1719143247; a=rsa-sha256; cv=none; b=d7vJRUM0PVhxrX0gvRibi0MKHjUGJIBE1EO3BkbEvKxPEoXea1JQYlo1ycE2yo83wA9f3M GfVUw3IVvbgUbuYwHmw5kULy/IYj2iNvqnAbv5nBkLf4vGB0Ni2J2zh8nZBL9D3TID+G1P t8Xn9KMbRKniZhvJzPUx3KBKjkF3+dUGBZpDl6NKYek6p0HVWplze43lAuWn/xr7xYWWwj txRIqNSiNtq0j2oBRcuMLFfvNMVu4+YZUBzdqwT1IFYTz9doaJM8Xhhv0bz1/UpHBpY4c0 45N7llaJKNyexM+786Vnh6H3bK30Tb+bs8CUngwFw6qsfcuV/4lKhNdI9vd8Nw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=wolfsden.cz header.s=mail header.b=JVyjcB90; dkim=pass header.d=wolfsden.cz header.s=mail header.b=QZpQ+F2C; dmarc=pass (policy=none) header.from=wolfsden.cz; 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" 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 28F6C1DA8F for ; Sun, 23 Jun 2024 13:47:27 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sLLgE-0000Wl-Vo; Sun, 23 Jun 2024 07:46:47 -0400 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 <~@wolfsden.cz>) id 1sLLgD-0000WF-3w for guix-devel@gnu.org; Sun, 23 Jun 2024 07:46:45 -0400 Received: from wolfsden.cz ([37.205.8.62]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <~@wolfsden.cz>) id 1sLLgA-0001VU-MI for guix-devel@gnu.org; Sun, 23 Jun 2024 07:46:44 -0400 Received: by wolfsden.cz (Postfix, from userid 104) id C97C729E3F6; Sun, 23 Jun 2024 11:46:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1719143197; bh=I1u+Br47/cF1Eu04TNQs02mBjFfZJB5GCLt7DCIl2kU=; h=Date:From:To:Subject; b=JVyjcB90mTe09lpt4VT2NngjUFJp+VJjqbIydz4FAb21ggn4nEk6knV0hDMAExyBW r95pZSHA5mRNgDAT+40oMk/YD+MEh5Qm98kZF9bSH+ZDGmQkDAOTl+B634uqkO0sdr eYQOyvQrSQ94sIoTUH7Fz9e9NHSuNDmdAzOSoOMoPo59CaWUahrf5c+lGFhpHt2Uh3 39dR8t34x34WuU4GEe9vVz6Eqn0t8OIHONvra0bIhqTXG7eqwafDt6eWQq6fkbxcHv ZX4ric3j/RFvulDw1YrmNOXcrxHWEl92ftE91UtV/fE88RfYgj7fDpLzBBdWbVAAIN IcALP8QpTHpwEIPAIp3vmQegKdOYcP1V5V1u6tTDV8bGIqmtnl6FKioA2Iw3CwIw1K X6jdpt8fbZhS7lP4WceIHPXm0WEFPvG66a9zbA6938Ya441+wT2DVacr5BxLRsV7H5 56MhDTu6QoHKhwSfxGfIOpOeMPIY41B3mYdm9sYI1jxC1clwO+2qPgV8X1PMJeS4D6 aB736NV4rB8KGr65HYdRTraBY4wVEu3iR7YhNi/RMNXJwEItRb0ABxIWgoQzxocaH6 atxkQW5j3KoiVSlk7mquKyfBXLkWrkXI+UZo83/MdUmLiqUXRO7xDlmiR16tvxNd5/ OZkP2wW92c8QIReXsROrFt7k= Received: from localhost (unknown [128.0.188.242]) by wolfsden.cz (Postfix) with ESMTPSA id A55E429FEAF for ; Sun, 23 Jun 2024 11:46:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1719143195; bh=I1u+Br47/cF1Eu04TNQs02mBjFfZJB5GCLt7DCIl2kU=; h=Date:From:To:Subject; b=QZpQ+F2CFCg/rBfHl6ngD4apdiGyjCuKCCtss1SBEDmQpwdgKMI6tgts7YnP7Ja2A Yv37zZHGRyY+awpHh39BS+aYGQep3IzW6K8BgAVx2CGlV5UxYReyeGDXQb8WZGbj+X zK4UBw4ZxyHUUy6GXSezYGTgGeVuJxF3rtkJ67VM5PAm1y46o9+E5ktlAI5Gg4t22y MJfjCH5F0g6kCX6H8qSEfNzsDgp2JEZR0Tl4KQPy9F0i8U+2xbdsXRnMyJIDCAqU8p GFppoj7mgsuyjDILxnywvYFiShEt/Yq7vWzx40938KXCU+6Rtac3URYnfQFwD82H14 PRzpRi6G6pd4IichoiEihkv5UO9aZPCUPhSDCGIcUdwsWfQnmFwN4hXpcLURmlZY12 /S8A5xbbx/PqOx2h9n71BiIR4AGEdATWLS4l+JcCg03UavtilsSJ0udXQrRjSOZ4LN thRO8itOb5OUrOUG9m0VgLgULDR3CsZiKtO3++4BQBjvkl4jfWB3xGkDNpiPKp9Kxf bLe3nyfUJAqMPD6em0eFHYuKEk3M9uQttWLsFhngBu+cHzNISgKpojv3S9KuGV0E/A KQ2IGLn0R+SOAl1lyxxbLevENzIfZyW7pl0WzSxzZmEZ3XZTLh+TtwRk1yLXPy5mAv rIFsu95ijFani99zQ73r4GqU= Date: Sun, 23 Jun 2024 13:46:34 +0200 From: Tomas Volf <~@wolfsden.cz> To: guix-devel@gnu.org Subject: Proposal for removing some serialization limitations of define-configuration Message-ID: Mail-Followup-To: guix-devel@gnu.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="PMc6yxdEwJRaXqko" Content-Disposition: inline Received-SPF: pass client-ip=37.205.8.62; envelope-from=~@wolfsden.cz; helo=wolfsden.cz 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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: 28F6C1DA8F X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -11.53 X-Spam-Score: -11.53 X-TUID: goqyJ7hp6WGx --PMc6yxdEwJRaXqko Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello, I am trying to define configuration for my port of OpenBSD's acme-client, and got bit stuck with limitations of the define-configuration's serialization. First let me describe my problem (maybe there is a solution already). I want to generate this piece of configuration: authority letsencrypt { api url "https://acme-v02.api.letsencrypt.org/directory" account key "/some/path.pem" rsa contact "mailto:who@knows" } I have put together this configuration for it (for now let us ignore that it will not know how to serialize the values, it does not matter): (define-configuration acme-client-authority (name symbol "The name by which this authority can be referenced.") (key-file string "Specify a file used to identify the user of this certificate authority.") (key-type (symbol 'ecdsa) "Key type to use as a symbol. Supported types are @samp{rsa} and @samp{ecdsa}.") (api-url string "Specify the url under which the ACME API is reachable.") (contact (maybe-string %unset-value) "Contact URL that the authority can use to contact the client for issues related to this account. Optional.")) I realized I have two problems I do not know how to solve: 1. I need the serializer for `name' field to wrap the output of other serializers. 2. I need to serialize key-file and key-type as one (since they belong on one line). Now, are those possible? If yes, please tell me and feel free to ignore rest of this email. I did not figure out how to achieve those except by a custom procedure: (define (serialize-acme-client-authority authority) (match-record authority (name key-file key-type api-url contact) #~(simple-format #f "\ authority ~A { account key \"~A\" ~A api url \"~A\" ~A } " #$(symbol->string name) #$key-file #$(symbol->string key-type) #$api-url #$(if (maybe-value contact) (simple-format #f "contact \"~A\"" contact) "# contact not set")))) This has the obvious maintenance issues though, so I think it would be nice to be able to utilize the existing serializer infrastructure for this, therefore I would like to propose two changes: 1. Add OPTION* `(wrapper BEGIN END)', where `BEGIN' and `END' would be procedures with arity of 3 taking `field-name', `value', `record' arguments to be called before/after all other fields are serialized. If multiple fields are marked like this, the order is unspecified. 2. Allow serializers to optionally take 3rd argument `record', passing the record currently being serialized. The 1. will allow to produce `authority NAME {' in BEGIN and `}' in END. The 2. will allow me to set `empty-serializer' on `key-type' and retrieve its value using `acme-client-authority-key-type' while serializing the `key-file' field via the (new) `record' argument. And it is fully backwards compatible. What do you think? Would these extensions make sense? Thanks for reading and commenting and have a nice day, Tomas Volf -- There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors. --PMc6yxdEwJRaXqko Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEt4NJs4wUfTYpiGikL7/ufbZ/wakFAmZ4CxoACgkQL7/ufbZ/ walcTw//aBhTsh9e3TDgqGWz6Rdv1kCpEAA+x3aFKHLMfGpb+iLY23gSbxy1yjKN vkYhpzfkfFtH5kiCTiS4FBadhSlQXSlyFKTXHMv8erU5+ccOp0l4PNrP3//WYWS1 eqSmmufcW6aFloSXlg0GswtKGFA3CxlKIaZJMgQM9J+D5P+xtbsqfonxu1r8dFmu Nw85+bsneQ5GW3T7hNTsrJU3gssglEFpHHOVCPaG04iz6dS4VJ8+yy+3tijD8ocM Wtac7URmGzu8MCsliLu+Al3i7Ln4ac2xOt1MDTTsKAOh/Kf1kuN7aMMAeoJlJjXK cl7wPeOUg3ZJxtqzSIralLBnAtKMpLsZy+KCF93c0ndDe+7hJBQ7sq9C/+cAPULb pJB4M8hIjgto2bAp0sGVpRDv4Cs+dfle5tO1mrodYNwzDe/sKVZ+KHiysjZfUFdf eYCjOs7jyaSlWXB8I3I9UyrNOtNE+LNYJJU1TM7IYGC5rRbY+nTNf8hEwG7m1BXO 2jwQBadqyS0uqjdlmHNGKpS+UFzhFMhw49kFRv+WzPC43tcX4LSwFWbmeae1MlZD 3ExWw28HcFE31EmdYDC4D4972AyscfjM9xCBwFPXhn4AiA4jb8czf25mbzn3N8OP oEY/qaq9Qe2R4SuRzdIwZrjsicVytjYKdBVSeHSdjzrkKcxsyDE= =+cPy -----END PGP SIGNATURE----- --PMc6yxdEwJRaXqko--