From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 4DRcL4DrZ2EabAAAgWs5BA (envelope-from ) for ; Thu, 14 Oct 2021 10:34:08 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id IHwaK4DrZ2FoewAAB5/wlQ (envelope-from ) for ; Thu, 14 Oct 2021 08:34:08 +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 2085957E for ; Thu, 14 Oct 2021 10:34:08 +0200 (CEST) Received: from localhost ([::1]:59630 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mawBj-0006dw-9k for larch@yhetil.org; Thu, 14 Oct 2021 04:34:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48936) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mawBe-0006cG-Gw for guix-patches@gnu.org; Thu, 14 Oct 2021 04:34:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:51293) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mawBe-0004It-6r for guix-patches@gnu.org; Thu, 14 Oct 2021 04:34:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mawBd-0000Cg-UH for guix-patches@gnu.org; Thu, 14 Oct 2021 04:34:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50967] file-like objects instead of gexps Resent-From: Andrew Tropin Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 14 Oct 2021 08:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50967 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: Oleg Pykhalov , Xinglu Chen , 50967@debbugs.gnu.org Received: via spool by 50967-submit@debbugs.gnu.org id=B50967.1634200386717 (code B ref 50967); Thu, 14 Oct 2021 08:34:01 +0000 Received: (at 50967) by debbugs.gnu.org; 14 Oct 2021 08:33:06 +0000 Received: from localhost ([127.0.0.1]:34606 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mawAk-0000BU-Bu for submit@debbugs.gnu.org; Thu, 14 Oct 2021 04:33:06 -0400 Received: from mail-lf1-f49.google.com ([209.85.167.49]:34404) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mawAg-0000At-PG for 50967@debbugs.gnu.org; Thu, 14 Oct 2021 04:33:05 -0400 Received: by mail-lf1-f49.google.com with SMTP id t9so23414029lfd.1 for <50967@debbugs.gnu.org>; Thu, 14 Oct 2021 01:33:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop-in.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=oxGlqo7cAepNWPednt7Iq/eD5pDzGyzKwzjS6gtV0zQ=; b=2nOPBuUXoGGek3qJM5VXMXsee/c/JAbw/Ukowhtu1odrj3dzEyvgYQUdd+dZX+cRP7 DXbifB3tLBVlE/7FKuiiTo4pdgaF+hUVue1fBP9fuif6gm75giDxETAhCKPiQIPzQjXH 76VDyNTKctk375CppT8HHwUTMIH2/u8UVbqflNO1hJfTFOMb7pFwr4bfZw6v+kjTq836 daQRB4ZQNIsMIIRQYwfs06umtmxuRMXMix0emoI6FAI+xl0AQCNiTFov4/HhJJZRxZP+ 69ojhjkaGMv0Dc18KxMSIxHcq5n2mQFor4Nq2mkNHtSof7fSfnlr5IuULgnDB2JFIVsi X3SA== 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:in-reply-to:references:date :message-id:mime-version; bh=oxGlqo7cAepNWPednt7Iq/eD5pDzGyzKwzjS6gtV0zQ=; b=pkYNWcmTDD41639L4oYNtylsQxCVwFsXg70OTtnuNZjoqnjb4IU6i2XU8nyoYciFOo d3kSpyfjltchAXncF8U2F4aPveDkJEy6rBxKhKhDmVRsptUyf9Ksn5X9qBE/4wMZYBx/ fTiz1IUXpUJz3VuHkj7d39bF+hYJmrnQLa7hWbKpUgmouQagqW5P+DRjx6bE3oZ24/F8 +T5bm6afmwbFn2XdZ1/puN4aDDT5KKyjK7EsMlVoozKH0kpwzbH1u6E1w8dgGhhyAyMq ujT3ejewLN4XbXoMzsV8aUW2i5XykZ+JKgj/h5yTDmiCPEfKfpYmsA9IJuj0EcDlOwA/ bHGg== X-Gm-Message-State: AOAM532ksWzVme4p7mzxF1OnTtq9zBw5JtdIpMOiWjh8AfxJaCy5G8T0 87dBbOkzQZ/QjVYLDnuMmq9bRA== X-Google-Smtp-Source: ABdhPJxmFuaokaXcKDr7mt0H4Z4Y+JJP5zdWiRN/Bsz9PQ3lGZbA4S+sm/wmee5hm131Pk85CyBTCw== X-Received: by 2002:ac2:5e32:: with SMTP id o18mr3855063lfg.556.1634200376536; Thu, 14 Oct 2021 01:32:56 -0700 (PDT) Received: from localhost (109-252-140-132.dynamic.spd-mgts.ru. [109.252.140.132]) by smtp.gmail.com with ESMTPSA id x1sm167703lfr.83.2021.10.14.01.32.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Oct 2021 01:32:55 -0700 (PDT) From: Andrew Tropin In-Reply-To: <8735paz5hj.fsf@gnu.org> References: <20211002163834.29583-1-go.wigust@gmail.com> <20211002163834.29583-13-go.wigust@gmail.com> <87pmsnnukj.fsf@yoctocell.xyz> <878rz8q42z.fsf_-_@gnu.org> <87czoilgbg.fsf@trop.in> <87a6jk54ro.fsf@gnu.org> <87ily7hm4x.fsf@trop.in> <8735paz5hj.fsf@gnu.org> Date: Thu, 14 Oct 2021 11:32:51 +0300 Message-ID: <877degt39o.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1634200448; 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:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=oxGlqo7cAepNWPednt7Iq/eD5pDzGyzKwzjS6gtV0zQ=; b=E156FytdxmzJaEosns/Aj1vqRmU3tkSYBCeEeH9kAltiKDf94fRGMK7XOnhwWTZTb0u898 92p9DhiGzJrnChiFcHpz0CfWTrqdw4gA4vfd7iT2IrAu/lnphl+J8mJ2qyFmT5FGdumtDv TiZ6TAj5yIQU/fBHvv15AiVn9HZyV0ElRp8qDCkrwrqKuqVz9Le+XoIAToiiB0ph21kqTF F7C8XHwjN1yu/HrJuJcchJoWi09etmeC1jxrdTUVoiwBVSwpyPzjeZgQK/iTyRB10ZWBnO F7bvEYZB2Iix1RmmGF0zmmEljUP/rR7w5nQe06WEtz8z6H8mXwm6bzwq4o48FQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1634200448; a=rsa-sha256; cv=none; b=SQqU9XrItYjqjEXmrNyehuM7VjSeae57nI712wJ4F8/XUEbwTF5AVg2Srs69rEgWNwLhqF Y8wFjImhhurDmbY21FGlZrBvNW5sUQ/DTj7yV2lyPxzsO1wC2xa/xpSl5Eszk5jHuU4qEd jsiy4DHKNxoMfrYe/ZJyMPGvDl0Y+WQEvEKT3PUEgWbV4atc3+BSVKB7es+SHzeEkXGuWd kGllMrR38gj/szQviQfiU490qderVDGMDN6ExdX03cRaA6njZLPmvHKQeMyEj/5C0EQvsp WDhpnB0DMUAhu7XkWS008/CVPGhIfZ7APKo0ky2u1BK9uRJhMrn6e1lcIvY+5g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop-in.20210112.gappssmtp.com header.s=20210112 header.b=2nOPBuUX; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -0.91 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop-in.20210112.gappssmtp.com header.s=20210112 header.b=2nOPBuUX; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 2085957E X-Spam-Score: -0.91 X-Migadu-Scanner: scn1.migadu.com X-TUID: zjMUOCHlgi+O --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2021-10-09 15:34, Ludovic Court=C3=A8s wrote: > Hi Andrew, > > Preamble: Guix Home is now committed and there are bug reports coming > in. To me, that means our discussion needs to be focused on addressing > specific issues; we=E2=80=99re not going to redesign Guix services in this > thread. > > Andrew Tropin skribis: > > [...] > >>> Then that=E2=80=99s fine: you can have special code that emits those = =E2=80=9Csource=E2=80=9D >>> lines in .zshrc while still allowing users to provide their own >>> file-like object for .zshrc lines they want to add. Again, see how >>> =E2=80=98torrc=E2=80=99 is generated in =E2=80=98tor-service-type=E2=80= =99. >> >> From what I understand you want a separate bashrc-file, >> bash-profile-file and bash-logout-file fields to be present, but where >> the content of those files should be inserted? At the beginning/end or >> instead of the rest of configuration? >> >> We already can achieve the same result by providing gexp, which will >> read the content of the file-like object, a very small helper for that >> (slurp-file-gexp) makes it even easier to do. Such approach is more >> flexible and doesn't seem much harder. >> >> I remember that you had concerns about slurp-file-gexp, but still don't >> understand what exactly you are concerned about. > > Let me restate my concerns: > > 1. Users are unlikely to fathom what this does, given the name. It > will end up in user configurations, yet: =E2=80=9Cslurp=E2=80=9D? = =E2=80=9Cgexp=E2=80=9D? Sounds like a naming conecrn, I brought "slurp" word from clojure lang, but we can call it whatever sounds better for guile community generate-read-whole-file-gexp or anything else. Actually, we don't even need to have this wrapper to be present, just allow people to do #~(call-with-input-file file-like-object get-string-all) > > 2. =E2=80=98slurp-file-gexp=E2=80=99 returns code, as a gexp. Dependin= g on the place > where that gexp is inserted, it may or may not work. Consider: > > (define (foo x) > #~(frob '(#$x))) > > (foo (slurp-file-gexp =E2=80=A6)) ;d=E2=80=99oh! Yep, users can make mistakes, but it's not a technical problem, also, I see it quite unlikely to happen according to my experience supporting Guix Home users. > > 3. Use of =E2=80=98slurp-file-gexp=E2=80=99 and gexps in configuration = records is not > consistent with the rest of the service APIs (and I think we can > humbly recognize that those APIs have been doing the job for a > while already.) It's not actually true, there are system services, which accept a list of strings/gexps and state it in the documentation, some of them do it in a less exlicit way, but still do, I found that trick looking at system service and made it an explicit pattern for home services. I tried to extract and follow patterns from system services, but found them quite inconsistent, so I took a few of them and wrote a few on my own. To name a few: extra-options @ alsa-configuration extra-config @ nix-configuration extra-config @ xorg-configuration extra-content @ nginx-configuration extra-config @ httpd-config-file contents @ httpd-virtualhost To make guix services configurations consistent (at least new ones) I think it would be cool to have a `Writing Service Configuration Guideline` section. I can share the design descisions I've made for home services configurations and after a discussion it can end up in a manual section giving a clean guideline, reducing subjective preferences and increasing consistency. If you are interested. > > Let=E2=80=99s just to the (call-with-input-file file get-string-all) danc= e in > places where it=E2=80=99s needed rather than let users call =E2=80=98slur= p-file-gexp=E2=80=99. > This is roughly what the =E2=80=98tor-service-type=E2=80=99 example I gav= e does. > >> I'll write a few examples of service configurations and rationale behind >> the design descisions for that next week, to make the discussion more >> practically oriented. > > People are starting to use the tool and to report bugs. So, > unfortunately, we have to sort out interface issues quickly now. > > If some of the things being discussed turn out to be too complex to > address under those time constraints, we can consider taking them out > until we have a better idea on how to address them. > > How does that sound? > > Thanks, > Ludo=E2=80=99. =2D-=20 Best regards, Andrew Tropin --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmFn6zMACgkQIgjSCVjB 3rAFmxAAhWoc6Fs4B3yuXz6iCvSiZiYFd0+/MR4EW3rCwKzaSFTMiojRGu0C0U6D yhvUFbzghc2g+HOdzLicLzFB5JPnCmOWnCtU6p1cKJVJfgSwIiKrYAoy7hXBpued NnwIFZsfclCywgs5AQ/Tus4lrSX+wkw0dfbTUTDjTyKYxQlMXH0EchBX4G6X/qNW CWqsBw0nnmWBfuPfS+Y2Y/o5x836eBIhlFfw5yBD9uH/7/ezD3XtxXmJASj0cDVK ZMIHOJ5Q1oohWdxVGKLZA8fOn1G0W/wTUUVrJ6gFwt+cRtIPEk+KHoH6sDI2fpBb +UZncqcd7s+cY4qAsPO2Vbn5WQen1mZZu/MpxDmwW+deU3STVCiD/bsOK27NTlnc u5w1CTMrZoRT4wlgy3eul6I5rPpJ3XGSJ+DlGADluDeiOn94bK2pvpwBmL4VxGy8 LC1z4whF9nvKqTbRcVfx4JHS0jNiMmGQTpZUwQu6qc9vFMKbl4agHbwGy5KpkcCA N6+P2MXXy/02H9rtG18xXHE2QzrEkDPY0PgdXBtGkXwNuYVEOM7wKj+7xnh22jVE G3UGrwNlG5ToPavLnYiUzQmfMvtSALYQq4t504ndZJtKBF/KoHEnqc2ORTl8Wovh VCF/FSg74jphE/2LZ6fgdx8L4j5OxBNdrKg+vhaJq3zzV81U+98= =N8EQ -----END PGP SIGNATURE----- --=-=-=--