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 mKr+GKg3YGHyIgEAgWs5BA (envelope-from ) for ; Fri, 08 Oct 2021 14:20:56 +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 0AurFKg3YGFeDQAAB5/wlQ (envelope-from ) for ; Fri, 08 Oct 2021 12:20:56 +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 F2E9029847 for ; Fri, 8 Oct 2021 14:20:55 +0200 (CEST) Received: from localhost ([::1]:44030 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYort-0001rV-J4 for larch@yhetil.org; Fri, 08 Oct 2021 08:20:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51704) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYoO2-0003Fw-Pq for guix-patches@gnu.org; Fri, 08 Oct 2021 07:50:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37869) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mYoO2-0002NT-HK for guix-patches@gnu.org; Fri, 08 Oct 2021 07:50:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mYoO2-0001Lc-G6 for guix-patches@gnu.org; Fri, 08 Oct 2021 07:50:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50967] [PATCH 13/14] home: services: configuration: Support file-like objects. Resent-From: Andrew Tropin Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 08 Oct 2021 11:50:02 +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: Oleg Pykhalov , 50967@debbugs.gnu.org Cc: Oleg Pykhalov Received: via spool by 50967-submit@debbugs.gnu.org id=B50967.16336937595104 (code B ref 50967); Fri, 08 Oct 2021 11:50:02 +0000 Received: (at 50967) by debbugs.gnu.org; 8 Oct 2021 11:49:19 +0000 Received: from localhost ([127.0.0.1]:49408 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mYoNK-0001KF-Nw for submit@debbugs.gnu.org; Fri, 08 Oct 2021 07:49:19 -0400 Received: from mail-lf1-f51.google.com ([209.85.167.51]:40766) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mYmlZ-0002Wh-0c for 50967@debbugs.gnu.org; Fri, 08 Oct 2021 06:06:13 -0400 Received: by mail-lf1-f51.google.com with SMTP id y15so37130930lfk.7 for <50967@debbugs.gnu.org>; Fri, 08 Oct 2021 03:06:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=WEyxwqhBh56TRp7f/wGRtDMYz+bjq7qR0h4e4cxtyHs=; b=DNpW2Z3yck9H0xmKCp872p3t+S6brAbV1ZdWp/NeoEDq0rhzos0pPsA2GjZMesChvr G2D2tEhoRmu8a6/recJka4nyk2dx6SxBM2eMSSgiw58D8nHvaYNaAtV/AvhUW66H7CJj TohiQ1dl9e9goXldoGQ9nRs81ELeBgKKvctAKWFdQrDwnlZrbfPj/IuBneApQBb03bM8 mBzQ9JO+U6ZcUUQXuO4mwYwZz5ZJN0DRhxazFVpJ6hS6cnaOhanDP3yEJxKupTiiehEJ 8F4oM5W5YHJDUNl+4ppBz6QKlo5nxt5vzMRv3QxQyMGtSusx/c/Wl8MKZ7rQ3ICzClIu HfRg== 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=WEyxwqhBh56TRp7f/wGRtDMYz+bjq7qR0h4e4cxtyHs=; b=WKMgH9Je3gH221U8jErIphXHcR00HVzBfl/cvXcSTAmNhSrQeF5Gws2DlLswGN475+ k2Mk5uWqsKNRi+0z47ogOoEN9yxgQ4X5lLIftQ7FKEJwHGltMHg0fR43ibS1eTE5C5zE KsaZGQKujnHI8GYgbPLYQ2uI4CYbkL6RBE+uBCm1I0GX9Auq70w+lZgxhOrlPWyQA/MK BMUzXFwI4BvE5qOmFfpT8jzpPXfT77ZMJjyhAYz9Q5n1Cfd3b3IRC+xN69WxIdYFkM28 MptEU3f7iWIEyxRBYyJgevEg68OBVlEPguhHEmmKXs2765HV6c0AyJ1M0pRA3jtelCq9 6JyQ== X-Gm-Message-State: AOAM531X403FItrAkhhQ/uOArUjG5+OZdeZzPYLCZNH0k53Dh+NUAFpS TOcKx5GEZ8iRAbVlCiJaqDo= X-Google-Smtp-Source: ABdhPJzpFty+IzdUh8l0Xa82VDa38+Afl8ZPiqFs34TfZKSCcAYwYISllBgvBnfrVpOTLjMf+au80Q== X-Received: by 2002:a2e:6e0d:: with SMTP id j13mr2680492ljc.91.1633687566951; Fri, 08 Oct 2021 03:06:06 -0700 (PDT) Received: from localhost (109-252-140-132.dynamic.spd-mgts.ru. [109.252.140.132]) by smtp.gmail.com with ESMTPSA id d1sm245924ljo.42.2021.10.08.03.06.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Oct 2021 03:06:05 -0700 (PDT) From: Andrew Tropin In-Reply-To: <20211002163834.29583-13-go.wigust@gmail.com> References: <20211002163834.29583-1-go.wigust@gmail.com> <20211002163834.29583-13-go.wigust@gmail.com> Date: Fri, 08 Oct 2021 13:06:02 +0300 Message-ID: <87fstbhlv9.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Mailman-Approved-At: Fri, 08 Oct 2021 07:49:17 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Mailman-Approved-At: Fri, 08 Oct 2021 08:19:50 -0400 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=1633695656; 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=WEyxwqhBh56TRp7f/wGRtDMYz+bjq7qR0h4e4cxtyHs=; b=KP0r/BrGlEO3v0aCYutNo77pZmld2pfIwRbRVM6DS8EG27dYejc4ofLtARSTbDGNCif1/x I2MayVcBNrt2lQlFiPCEvz7b4ZN0g6EnAMKfH2wX85odVZt4pU6abS5es+GQreIJMgshac mBiBoUrQolZdYzmCoW9HXeo3Iom2CIDySDTcuDtgFcUctrVBYccC5nv3DzVoFferQBQlOJ ZonIlrjsEaYgdkBqXRbbSbaXexFRFJ/JqG4XAMO87ZPSWLDp1bPckVNqUeNQpkQAzllsHw dTpfSE0BeSxayauWVKzXUS9XKoKS1x+u8nn7PJGLNRg4oPdR4Nw9htueOPSESw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1633695656; a=rsa-sha256; cv=none; b=KcPHbL7q4ImmWZERGFCYXjnMDVImXWLQQFJdyuLcDZVNwyKk2AgqYZLN1ASkeDXVDqKUXm gnh9041eurtILMbvg1sXZ+w7fvOiOZZENAsZxGj8Jn/jvIeOWG3PTqLqAt8kALjFCcQcQ+ LMrr8Eff1l8BRXulicEDleVa4d2vBi0PU7czgpotV86c1hC9poCfnGuYCGypNNgfuCZc4O Zivm6qBMwZ+l+DYtRwEWKE+1/tHiXEGJ61/Tg1jfRPCgV5VfvMEboleGkzs7PWT512E6Di qJScMUctCRHrTW5tpX8w2StYG4rf8keMMuQl4quVpkSyU8GgcdEEUKsUWA11Zw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=DNpW2Z3y; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=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.59 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=DNpW2Z3y; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=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: F2E9029847 X-Spam-Score: 0.59 X-Migadu-Scanner: scn0.migadu.com X-TUID: AVRalBMNfFau --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On 2021-10-02 19:38, Oleg Pykhalov wrote: > * gnu/home/services/configuration.scm (interpose): Include content of fil= es. > (string-or-gexp?): Rename to 'file-or-string-or-gexp?' and check for file= -like > object. > (serialize-string-or-gexp): Rename to 'serialize-file-or-string-or-gexp'. > (text-config?): Call 'file-or-string-or-gexp?' intead of 'string-or-gexp?= '. > * guix/scripts/home/import.scm: > (generate-bash-module+configuration): Don't call slurp-file-gexp. > --- > gnu/home/services/configuration.scm | 14 ++++++++++---- > guix/scripts/home/import.scm | 8 +++----- > 2 files changed, 13 insertions(+), 9 deletions(-) > > diff --git a/gnu/home/services/configuration.scm b/gnu/home/services/conf= iguration.scm > index 5e7743e7d6..39db7a5693 100644 > --- a/gnu/home/services/configuration.scm > +++ b/gnu/home/services/configuration.scm > @@ -59,7 +59,12 @@ DELIMITER interposed LS. Support 'infix and 'suffix G= RAMMAR values." > (G_ "The GRAMMAR value must be 'infix or 'suffix, but ~a provided.= ") > grammar))) > (fold-right (lambda (e acc) > - (cons e > + (cons (if (file-like? e) > + #~(begin > + (use-modules (ice-9 rdelim)) > + (with-fluids ((%default-port-encoding "UTF= -8")) > + (with-input-from-file #$e read-string))) > + e) > (if (and (null? acc) (eq? grammar 'infix)) > acc > (cons delimiter acc)))) > @@ -79,11 +84,12 @@ the list result in @code{#t} when applying PRED? on t= hem." >=20=20 > (define alist? list?) >=20=20 > -(define (string-or-gexp? sg) (or (string? sg) (gexp? sg))) > -(define (serialize-string-or-gexp field-name val) "") > +(define (file-or-string-or-gexp? fsg) > + (or (string? fsg) (gexp? fsg) (file-like? fsg))) > +(define (serialize-file-or-string-or-gexp field-name val) "") >=20=20 > (define (text-config? config) > - (and (list? config) (every string-or-gexp? config))) > + (and (list? config) (every file-or-string-or-gexp? config))) > (define (serialize-text-config field-name val) > #~(string-append #$@(interpose val "\n" 'suffix))) >=20=20 > diff --git a/guix/scripts/home/import.scm b/guix/scripts/home/import.scm > index c977ec3861..611f580e85 100644 > --- a/guix/scripts/home/import.scm > +++ b/guix/scripts/home/import.scm > @@ -46,17 +46,15 @@ > (home-bash-configuration > ,@(if (file-exists? rc) > `((bashrc > - (list (slurp-file-gexp (local-file ,rc))))) > + (list (local-file ,rc)))) > '()) > ,@(if (file-exists? profile) > `((bash-profile > - (list (slurp-file-gexp > - (local-file ,profile))))) > + (list (local-file ,profile)))) > '()) > ,@(if (file-exists? logout) > `((bash-logout > - (list (slurp-file-gexp > - (local-file ,logout))))) > + (list (local-file ,logout)))) > '())))))) I think this patch requires more discussion and better to keep it outside of this patch series. Skimmed throught other patches, overall LGTM. =2D-=20 Best regards, Andrew Tropin --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmFgGAoACgkQIgjSCVjB 3rAViQ//bui0/CPZfJtHqydLQFolWIk1nBv7hhHx3MnL2vauudU84d+vHnU9FoIQ plfS3MneMwgTsqIGu1VFFzaPgbI/XiU8A2hSlcU9cxG8UnaITg5+rnIe017Qzvok WHlIEvq+U2NKB+Q8kQexlo4xQadxGqqDsgqyTGN4T6gyO5H+Tf01iah3AcZ4Rpzi 3/zOijcoUPJjfA+FSo1kPAvdnGW3t0k04JnHWPfp6AnyHlX5IbRXZuldhSKLB6VT xLQZZwMtQ9K5XYAmjdV0DRO2aeD3igrIP1no2n4BDPyARS1OrH2DoKYn4zk/HmVN gdN2jK1QzQqI+PVU3kXn4YJvoZZyXVVvjOsxHosIYQOrOhNHkR4RhGLbokcAWOhp wDi4hbv+FeBCDzxxjR2NWgbuwvPD2gey4+7mwLWoTIplk0P6WjMfGkxyG1DelGXi Qj0u/rpCJN9bmfB5AYCNYEVM7QN3P1yHDovmheWgIWNeePNCdTfFR4HZLp+Ur0lc s3+fqcRa0AiJiNCTWT/3oBpmZFqEqTvzj9O3FxTikMOiVdmV8AK9P8578fr33Q3j slKsHbKnkKtlzeXWv7KTDeROcWdLST/DmkI/egp2Hv8EQeDcfkeDwAyEpYEjV6rG /XHjv3YrpY3cgCLMg7xs9BE7UDTeVgx6qqATPJ29+wTPCcjJRew= =L/hd -----END PGP SIGNATURE----- --=-=-=--