From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id cEokA4Zf2mXzDQEA62LTzQ:P1 (envelope-from ) for ; Sat, 24 Feb 2024 22:28:38 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id cEokA4Zf2mXzDQEA62LTzQ (envelope-from ) for ; Sat, 24 Feb 2024 22:28:38 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; 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"; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=illucid.net (policy=reject) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1708810117; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=e22iJfnWIh4U6SpsslfZhj4rfK3qhl0xIgqg8DTztUw=; b=aV2mT/apF0BWuxM+7OBciKxZOql4BIalDgDts+BVAqvxhfKtfahBaJFL4tKCM+YS8DR9eY Nsywe6eeSefSBvUoKcC6/3QPGscixSwHf02NlZnoWdxmCvxK9nkSxUXbFkR73hOlrANxXD 8QZ7RvvF7eP2eYicG1uq4ydqw34t9s9Npx3OkXS4A4FGwizFKO68rLWMBr17JYzeDE9r/l cmlOA/Mh34kFKbFqJG+RcgzbkjaGY+kpoClArGAhtx9l3VTyJyLuOMuZnt83W8Soz6Sdlq BudLOExMzhF/a8VtKx+QPKzPiL1Zwu1fqoKVi6/fYYisLlQ6pRtbtBs/2MqEjA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; 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"; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=illucid.net (policy=reject) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1708810117; a=rsa-sha256; cv=none; b=Fqcmu7SxAElYVLBEUuB0H6NONFIxoTRKyQUQCari8qtqXPLkuMlbLfvFPDQNzQ+qsayO7a qORZ4e30S2BorbdP+wBfhrE7BSB9aU5qOoABOcNDZK2g72aS3kFO709vXxOGiTsOBFE3sX o8vsKTYgIdeXJBo+FQpdUiWA1DiO1uMSyzHhwpAgwqTYBQWK0G8CoQAAlrLVyn4u+oAYn+ ec5Bz0L8fhn47YDnmTFuF++Me/Y3X+NfB2K9RzY/P9dhAflU35+AL2DNnKX1KYplmpnxCE boDlBRMldoB1MxYWDaHwD6c3fKbR2qkXbOSI0dytHpEZoCXJQu5BqBXgDyCqrQ== 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 C3716402AE for ; Sat, 24 Feb 2024 22:28:37 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdyw1-0006AV-EF; Sat, 24 Feb 2024 15:47:49 -0500 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 ) id 1rcH1k-0004AZ-Bo for guix-devel@gnu.org; Mon, 19 Feb 2024 22:42:40 -0500 Received: from fout5-smtp.messagingengine.com ([103.168.172.148]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rcH1i-0008Vw-5l for guix-devel@gnu.org; Mon, 19 Feb 2024 22:42:40 -0500 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfout.nyi.internal (Postfix) with ESMTP id 4B9BD13800E3; Mon, 19 Feb 2024 22:42:37 -0500 (EST) Received: from imap44 ([10.202.2.94]) by compute5.internal (MEProxy); Mon, 19 Feb 2024 22:42:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=illucid.net; h= cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1708400557; x=1708486957; bh=e22iJfnWIh 4U6SpsslfZhj4rfK3qhl0xIgqg8DTztUw=; b=TtD1ZIL8gdCWcoEMdRHQr7YOQj XEdrrNBwzvxIIMt8IhTF+u5Z9Vo7Kk+rRgm7XWo9TzZkCkQb0f3c3M+PI6JEQhmk E5D1HxTdS61XaYpqjIipOQD7QnKZJB+M0VC5KNglEO7TTb+T5MnOXvojzLY7Ql07 ITXR9AstSfBRJn8zSy3cYFcOPTQDcCfWHl4AT7P9ZCtT5ZhBTUZNoT0gzqLE+X8O ka3AjTrOb0/QEm6NqPmyppCk4fj8JjfdbqJgQGxIpsyAJ8KIAVlE6lhgRK43Y2lD UCqPPdLWWg4zcR5+FlvSiGC9+K43bPEnkVE5rYmILOG/tad7EzpXDJ2hQJ5w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1708400557; x=1708486957; bh=e22iJfnWIh4U6SpsslfZhj4rfK3q hl0xIgqg8DTztUw=; b=OuQe5QDJ4QoBnoAcV2giuWxCkpGOCQe9eV7BjS7XgcPD 2XLi2xVun6SsaUI2nIMqIfXY+qIMcO/+dmJ80jSgh4o3cRFo/hBlIPNLIRB5QPie yI7JoxbYzlnGcFty4UAbVzTFntFJ6ibv21jrw8Wxok2OLgiPtydcMvYRtXQZ47Y3 YDFsotNTT4k7t+VjN3XUuRMvJhrDA2OAUJEphgL3jL6YpVaCAnuz3tGOlbdZMNVA 5DunTjgtcwU0BVyyHSAG0NDUOhadFFdBZBK803xbxXryYH1jBuwW8SOOUL0+cyLL zQj4tI8zv+zVyF+RhT2qmzgC4HotUF/c4cslnYZyyg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdelgdeivdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpegrnhhtlhgv rhhsuceorghnthhlvghrshesihhllhhutghiugdrnhgvtheqnecuggftrfgrthhtvghrnh epffejtdekhfdufeekgeejgeeufeeiteevgeegvdegleffvedviedutddtiefgleejnecu ffhomhgrihhnpehgihhthhhusgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurf grrhgrmhepmhgrihhlfhhrohhmpegrnhhtlhgvrhhssehilhhluhgtihgurdhnvght X-ME-Proxy: Feedback-ID: i7f19465a:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id BC97B36A0076; Mon, 19 Feb 2024 22:42:36 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-153-g7e3bb84806-fm-20240215.007-g7e3bb848 MIME-Version: 1.0 Message-Id: <4fcba329-e92b-470c-910d-d77800af1488@app.fastmail.com> In-Reply-To: <87plwrj3w9.fsf@rdklein.fr> References: <1a7168a5-5207-4dfa-ac12-b3fed841580b@app.fastmail.com> <87plwrj3w9.fsf@rdklein.fr> Date: Mon, 19 Feb 2024 19:42:16 -0800 From: antlers To: "Edouard Klein" , guix-devel@gnu.org Subject: Re: A friendlier API for operating-system declarations Content-Type: text/plain Received-SPF: pass client-ip=103.168.172.148; envelope-from=antlers@illucid.net; helo=fout5-smtp.messagingengine.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, WEIRD_QUOTING=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 24 Feb 2024 15:47:48 -0500 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-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -3.36 X-Spam-Score: -3.36 X-Migadu-Queue-Id: C3716402AE X-Migadu-Scanner: mx11.migadu.com X-TUID: FFWmeTJTzL9r Oh, thank you! Don't study too closely-- I'm quite the novice myself, having come upon your work in search of better solutions, and the drawbacks I described are rather notable; but I appreciate that you see what I was going for. (I'd be much happier with it if I could interrogate `(guix record)` structures for the `plain | thunked | delayed` distinction and hide that from the user, as that's what really prevents me from recommending wider use, but understanding of the module eludes me.) On Mon, Feb 19, 2024, at 5:53 PM, Edouard Klein wrote: > This is awesome. I need to study your macro to understand how you wrote > it. I've only written a handful of macro in my life, and came to lisp > via common lisp, from which I've learned quite a lot apprently bad > habits, so I'm lost in scheme-land. > > I'll study your system, thant _you_ for your reply ! > > Cheers, > > Edouard. > > > antlers writes: > >> Hi! >> >> Just wanted to say that I really admire your take on end-user service configuration in the Beaver Labs channel. >> >> I gravitated towards composing functions over `operating-systems` myself, though >> my config is probably only ""notable"" for the moderately-cursed `modify-record` >> macro that I use to derive/configure/wrap the services[1]: >> >> ``` >> (define (os-with-yubi parent users*) >> (modify-record parent >> (groups -> (cons (user-group (name "plugdev")) <>)) >> (users -> (map (lambda (user) >> (if (member (user-account-name user) >> users*) >> (modify-record user >> (supplementary-groups -> (cons "plugdev" <>))) >> user)) >> <>)) >> (services => (append <> (list >> (service pcscd-service-type) >> (simple-service 'u2f-udev-rules udev-service-type >> (list (specification->package "libu2f-host"))) >> (simple-service 'yubi-udev-rules udev-service-type >> (list (specification->package "yubikey-personalization")))))))) >> ``` >> >> >> It's like if `modify-services` was generalized over any kind of record, but >> instead of using pre-defined verbs like `remove`, the `body` component of each >> `(field-name -> body)` clause is wrapped in an implicit SRFI-26 `cut`-like[2] >> form to create an anonymous function that's applied to the field's value. It's a >> super leaky abstraction because I use a different symbol for `->` depending on >> whether that record-field is a plain value, a thunk, or a `delay`-ed form (and >> it could be implemented more efficiently), but it greatly reduces the length and >> indentation level of repeatedly nested, inherited record variations. >> >> ``` >> ((compose os-with-yubi >> [...]) >> [operative-system]) >> ``` >> >> I only wrote a handful of top-level `operating-system transformation` functions, >> and IIRC I only composed them at that top level; I think the way that you've >> broken them up into smaller forms and composed them out of each other though >> deeper, standard-functional composition gives you that same additive benefit >> over would-be nested forms, with each definition roughly matching up to one my >> "anonymous" invocations. >> >> What I still dwell on is whether there's a way to further minimize the >> code-volume of including additional functionality (as was pondered in a prior >> response, and as `modify-record` does in obsoleting `modify-services`'s verbs), >> and how best to avoid order-dependencies and expose inherit >> inter-service-configuration dependencies and conflicts. Tropin's RDE uses an >> emacs or systemd-esque `provides`/`requires` system which is satisfying, but >> introduces implicit standardization on the symbols associated with software >> roles and builds a significant graph of them, which I feel adds to the "bulk" of >> the (still very elegant) solution and embraces the need to wrap every service >> and transformation into their cohesive system-- that's part of what's kept me on >> plain Guix with my bandaid-solutions (in the spirit of learning the standard >> approach before exploring larger systems built on top of it). >> >> Anyway, I like your take, just fount it today and got to thinking-- thanks for putting it out there~ >> >> 1: From: https://github.com/AutumnalAntlers/old-guix-config/blob/main/modules/antlers/systems/transformations/yubi.scm >> 2: Like `cut`, but deeper: see the `<>` symbol nested deep within in the `users` clause of the Yubi example.