From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id MCgVEFqPY2XzDwAAauVa8A:P1 (envelope-from ) for ; Sun, 26 Nov 2023 19:32:58 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id MCgVEFqPY2XzDwAAauVa8A (envelope-from ) for ; Sun, 26 Nov 2023 19:32:58 +0100 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 E0B3612310 for ; Sun, 26 Nov 2023 19:32:57 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=B+WtWohw; 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=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1701023578; 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=ANFazL6fxXPOOl8bMQXFuep1L5xYddwYOij2V4v1+Wg=; b=gVeL06TdQiC+t0x3uyYmshqbVJeXPJnZbvuHZ9iXC641Fgy32dTc55TFzRC8OBwDEjcPHO mRIgvU8aTN9fUaMmOQ4segCA1paA68Gk7RQFcn77mUphh8JfRAryqaplsEqlafXcTm35DY fCB/mz7rLpdYp6wrFFZOSeX+SGa59a0FK6JVeh/9UFNGspAjaugITcwSH91KyXu404BgcW MASLMO5jCvEWzjp6x0vsOZuc7lOs76vXkeb6fHzGQw9SXcHGUY+CbJ37hvJ3S22Uj7ejT7 vUJaw78FiIEuJQ2cxxhln55taL13Vr/R2TbJ6R2gOriVKwNr/HnvG+J1Ej6w0A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=B+WtWohw; 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=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1701023578; a=rsa-sha256; cv=none; b=G9eq1IvcxRvsJF5/J4B7rbDNa3pjjmwO/v8JLzbSZyfBHwFt4e6qppRnSHl5VjIIAMbHYR Xh5xQ/UeP/T4WwAOf5h9DAbdgULFBXLpSNfsJGQeyxkwJvsWZi6HeXhrFQx3myryg4D6dO qx1Ck72FytgwiotBEtCcpnLU0GPCAM65FsDRDeKEJ9o1xfWhQFVAQKPPfQm/yOj2zyslj/ zYTaePTqPpo3cuFGU/jf6g7SaYbEVemGiAfwg2tqP1eSAcf1bbTwf/shqUS8jT8vmD5z8A xP9QboWOwfP8Y5lzMzp9VI2PlMDh8il6AypI+tSpN80CYQooQ6wgiVuu001+5w== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r7JvU-00011j-Uz; Sun, 26 Nov 2023 13:32:18 -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 1r7JvS-00011P-7f for guix-devel@gnu.org; Sun, 26 Nov 2023 13:32:14 -0500 Received: from mail-lf1-x144.google.com ([2a00:1450:4864:20::144]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r7JvQ-0003Dd-C6; Sun, 26 Nov 2023 13:32:13 -0500 Received: by mail-lf1-x144.google.com with SMTP id 2adb3069b0e04-50ba75e33f3so2209533e87.2; Sun, 26 Nov 2023 10:32:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701023528; x=1701628328; darn=gnu.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=ANFazL6fxXPOOl8bMQXFuep1L5xYddwYOij2V4v1+Wg=; b=B+WtWohwh50Qtb9cN0AS6Kk+1ZCFY+CzSFgraCYuILfeAA3rU/vu09DZm5J4R3pKO5 AdjS13LSbFbwSmVnxuDWli0XufUNNDt26G1ajcaL5s3V/Hq5+e2WnfmuhxT52YU0a2L3 3wof8rOlp6hsQpLi/AWLic0o+yKi+90lCvH5ytK/80sIa9Xt+XQa0/4izA18TO9lmrsf sz2Pxu2EJP5Hf2AJSF3iiw1wtqDbhZNQlmx5HzCcXS4Yc2OGhfOjnfxkaBhXJrmmOTgp o/qkI4B3e2OArwZFYfeRrCpgmA7Moi+mTOPdFveVOi/Ad6khX5Aa8qmYg+wBvhRIwiRy ot7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701023528; x=1701628328; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ANFazL6fxXPOOl8bMQXFuep1L5xYddwYOij2V4v1+Wg=; b=MLRre2UaZgMrTRxoOcZC938pvcoLh2Pz4VSNJ3EfK/OOE0hOryGDCjGBJpE/r2jI72 GhmDT+tvG1kbxDbmTx3IDCcB9tpihlJX/iVLPBSVInZW5cxLV0hvF5WC5M7q71xB4aOi O39eQSVAnQ8Y+StwOFEkKdgxJSO0M2uEqY03JR9fvVW5n1n/+sgNsCUDdicsXc7tGiY1 /j2nFw2UW+/t64YOrJ6mkqi0c7trviR8Y0S2D8lO9Gi4Se6Kh1Uf4kT2iWop6wRrH6NO x03B+szUoBlx/sw/dVKTIv+aGVi+OjUfhpV4WyqJRp/TuzmngKPmSvVhNKPuuMtSjcm1 zaQg== X-Gm-Message-State: AOJu0YwDRwb0Iq9k0BsxgdD5V+RUEXpQHJqN4sao1FRF2p7o6D/MN/j5 QIu6WyR378i0f+lFj6MUkYxZtLwOW+yBLA== X-Google-Smtp-Source: AGHT+IFCO+4uZZFY4Y1b866iATMt9KlylhdUgFgEDMSWJ/Bkegk7UUjrhHH7rRn2VeFCViJ7yO2U5Q== X-Received: by 2002:a05:6512:e89:b0:50b:a692:bb6e with SMTP id bi9-20020a0565120e8900b0050ba692bb6emr5302470lfb.24.1701023528300; Sun, 26 Nov 2023 10:32:08 -0800 (PST) Received: from lumine.fritz.box (85-127-52-93.dsl.dynamic.surfer.at. [85.127.52.93]) by smtp.gmail.com with ESMTPSA id eg48-20020a05640228b000b0054b73e35ebdsm5743edb.24.2023.11.26.10.32.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Nov 2023 10:32:05 -0800 (PST) Message-ID: <33976deaf13ce785edefa6ac1b3610054dd4a031.camel@gmail.com> Subject: Re: Syntactic Diabetes (was Re: A friendlier API for operating-system declarations) From: Liliana Marie Prikler To: Edouard Klein , Attila Lendvai Cc: guix-devel@gnu.org, Ludovic =?ISO-8859-1?Q?Court=E8s?= , Josselin Poiret Date: Sun, 26 Nov 2023 19:32:00 +0100 In-Reply-To: <8734wsqwrh.fsf@rdklein.fr> References: <87wn377rst.fsf@rdklein.fr> <877cm6reum.fsf@rdklein.fr> <52c2337b277721108e5e7cdd6ea32e37e3c20628.camel@gmail.com> <8734wsqwrh.fsf@rdklein.fr> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::144; envelope-from=liliana.prikler@gmail.com; helo=mail-lf1-x144.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, T_SCC_BODY_TEXT_LINE=-0.01 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: E0B3612310 X-Spam-Score: -9.44 X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -9.44 X-TUID: A+n/TcyWez/t Am Sonntag, dem 26.11.2023 um 17:49 +0100 schrieb Edouard Klein: > Thank you Liliana and Attila for the swift and actionable feedback :) >=20 > Below is a revised proposition. >=20 > Here is a minimal working example of an os declaration: > ------------------mwe.scm--------------- > (use-modules > =C2=A0(beaver system) > =C2=A0(beaver functional-services) > =C2=A0(gnu packages version-control) > =C2=A0(gnu services web) > =C2=A0(gnu services telephony) > =C2=A0(gnu services ssh) > =C2=A0(gnu services base) > =C2=A0(guix gexp)) >=20 > (-> (minimal-ovh "osef") > =C2=A0=C2=A0=C2=A0 (instantiate nginx) I do wish you spelled out service. Also, instantiate takes as much characters to type as add-service. > =C2=A0=C2=A0=C2=A0 (instantiate mumble-server > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 (welcome-text "coucou") > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 (port 64738)) > =C2=A0=C2=A0=C2=A0 (extend openssh `(("alice" ,(local-file > "/home/edouard/.ssh/id_rsa.pub")))) > =C2=A0=C2=A0=C2=A0 (modify openssh > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (passw= ord-authentication? #f) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (allow= -empty-passwords? #t)) > =C2=A0=C2=A0=C2=A0 (remove guix)) > ------------------------------------------------------- >=20 > To see the value of this syntactic sugar, try to replicate this MWE > with the standard syntax. It's not horrendous, but it *is* off- > putting to many newcomers to git, whereas this sugary piece is more > readable for them (sample size of 1, p=3D0.00000005). Well, that'd be=20 (let ((base (minimal-ovh "osef"))) (operating-system (inherit base) (services (cons* (service nginx-service-type) (service mumble-service-type (mumble-configuration (welcome-text "couocu") (port 64738))) (service openssh-service-type (openssh-configuation (password-authentication? #f) (allow-empty-passwords? #t) (authorized-keys (minimal-ovh "osef") (lambda (base) =E2=80=A6)) On that note, we also have extend-openssh-authorized-keys for the use with modify-services. > Here is the revised functional-services.scm, not yet commited and > pushed, and only lightly tested in local containers, but not in > production: >=20 > Advice and comments welcome :) >=20 >=20 > ------------functional-services.scm-------------- >=20 >=20 > (define-module (beaver functional-services) > =C2=A0=C2=A0 #:use-module (gnu system) > =C2=A0=C2=A0 #:use-module (gnu services) > =C2=A0=C2=A0 #:export (instantiate extend modify remove)) >=20 > (define syntax->string (compose symbol->string syntax->datum)) >=20 > (define (service-configuration stx service) > =C2=A0 "Return the syntax one can use to refer to xxx-configuration for > the given > service" > =C2=A0 (datum->syntax stx (string->symbol > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (string-append > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (syntax->strin= g service) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "-configuratio= n")))) >=20 > (define (service-type stx service) > =C2=A0 "Return the syntax one can use to refer to xxx-service-type for th= e > given > service" > =C2=A0 (datum->syntax stx (string->symbol > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (string-append > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (syntax->strin= g service) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "-service-type= ")))) >=20 > (define-syntax instantiate > =C2=A0 (lambda (stx) > =C2=A0=C2=A0=C2=A0 (syntax-case stx () > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 [(_ os service-name) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (with-syntax > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ([service-type (service-type s= tx #'service-name)]) > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #'(begin > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ((lamb= da (x)=C2=A0 ;; It is wrapped in a lamba to make sure os > is > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 ;; evaluated once only. It it wasn't in a labmda, > whatever > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 ;; form os is in the calling code would be repeated > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 ;; multiple times, and so if the form was e.g. (some- > func > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 ;; os), then some-func would be called multiple times, > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 ;; which may not be desirable. Isn't it also wrapped in a lambda, because -> is a threading macro that takes functions rather than syntax? Cheers