From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id oHM1JXQZR2bwCwEAe85BDQ:P1 (envelope-from ) for ; Fri, 17 May 2024 10:46:44 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id oHM1JXQZR2bwCwEAe85BDQ (envelope-from ) for ; Fri, 17 May 2024 10:46:44 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1715935604; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=A5U1NuBOvUO+6U++/24FUSGpcd21QsWMGFC0ydQvFg0=; b=pRkfwFHwIUEHeW8rnoI39WMzqPXZROjoW2yTo9Ucg+UThHnDn42P++fAutWIju4CkMXkNx wXqfeIOhMidU/dCjVyPQnhlgrHliehpAaNJIgWKG8DAobKcbNMraXhV+BWTC8q0Zp766Al 9OmmjBZCJZj80w/cBbZLIo9bsoBhmJpyyzqBnMG/MqZ55//4SvdShAU8zteICaAK28X6sd /iJ1jLU+rNEmZUNxczARr+vvWf7yosv9NaraVLItN3hCEA0G9T30cSLxDIw/+ectuDxXei uwTEEHp+tfVJnmdEoBAghE/x/SuvW2Ur8a6qoFRCCXY9GY/dNcoIg/jOChaUkA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1715935604; a=rsa-sha256; cv=none; b=t3Ch27c1koAYtcoKpupW/Z9IrxlG3gdhPgrOgihokv+YsGl/I5LnYEBzCTLtDffBgLsC0d UETzb6+kihzFGd2A4mSNOoM/3Jsy0YiDVpf+hm2E1KsboX2OYGprTPzBXzJpcwzxo9Ae/X v0aEnWcmOC9TIIa5ZOzWNvZJmAgIxrWjZuLqR+SHYskYlH1JFzAhAEuxyyhU3PcHpOWUoJ mxubSHGNiknosVbrCmW2q9iJ9ggfT3GEr2kPCHxuOok6ow59vYiEH/MLUr5Nq66491ncHN dEl0qttA3IvcCqLM309HHVyqsGcmydRnlJA2L/tGnNU5WQwOE04jGQt6m9pwJQ== 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 162066F284 for ; Fri, 17 May 2024 10:46:44 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s7tEC-0007gE-9r; Fri, 17 May 2024 04:46:12 -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 ) id 1s7tEA-0007dy-EH for help-guix@gnu.org; Fri, 17 May 2024 04:46:10 -0400 Received: from [46.4.214.66] (helo=ns13.heimat.it) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s7tE7-0008Ph-VU for help-guix@gnu.org; Fri, 17 May 2024 04:46:10 -0400 Received: from localhost (ip6-localhost [127.0.0.1]) by ns13.heimat.it (Postfix) with ESMTP id 49F953028BB; Fri, 17 May 2024 08:46:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at ns13.heimat.it Received: from ns13.heimat.it ([127.0.0.1]) by localhost (ns13.heimat.it [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id czlUI-rYy2fQ; Fri, 17 May 2024 08:45:47 +0000 (UTC) Received: from bourrache.mug.xelera.it (unknown [93.56.171.217]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ns13.heimat.it (Postfix) with ESMTPSA id BB0793028B6; Fri, 17 May 2024 08:45:47 +0000 (UTC) Received: from roquette.mug.biscuolo.net (roquette [10.38.2.14]) by bourrache.mug.xelera.it (Postfix) with SMTP id E034D3244047; Fri, 17 May 2024 10:45:46 +0200 (CEST) Received: (nullmailer pid 20339 invoked by uid 1000); Fri, 17 May 2024 08:45:46 -0000 From: Giovanni Biscuolo To: raingloom@riseup.net Cc: help-guix@gnu.org Subject: Re: how to use a variable in a plain-file object? In-Reply-To: <77eb920ccc94157785c38a49db5bceb0@riseup.net> Organization: Xelera.eu References: <87le493g1o.fsf@xelera.eu> <77eb920ccc94157785c38a49db5bceb0@riseup.net> Date: Fri, 17 May 2024 10:45:39 +0200 Message-ID: <87frug3jyk.fsf@xelera.eu> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Host-Lookup-Failed: Reverse DNS lookup failed for 46.4.214.66 (failed) Received-SPF: pass client-ip=46.4.214.66; envelope-from=g@xelera.eu; helo=ns13.heimat.it X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: help-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Spam-Score: -6.97 X-Migadu-Queue-Id: 162066F284 X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -6.97 X-TUID: QKsOAr32f8Jn --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hello raingloom thank you for you quick reply! raingloom@riseup.net writes: [...] > Short untested example: > > (define name "Giovanni") > (define greeting-gexp > #~(begin (with-output-to-file #$output (lambda _ (write (string-append > "Hello, " #$name "!")))))) > > You should be able to use greeting-gexp in place of %my-file-object. I've tested it with this code: =2D-8<---------------cut here---------------start------------->8--- (use-modules (guix gexp)) (define var1 "var1-value") (define var2 "var2-value") (define %another-file-object #~(begin (with-output-to-file #$output (lambda _ (write (string-append "\ # This is an example configuration file # stored in %another-file-object attribute1 =3D " #$var1 " attribute2 =3D " #$var2 " ")))))) %another-file-object =2D-8<---------------cut here---------------end--------------->8--- And this is the result: =2D-8<---------------cut here---------------start------------->8--- [~/tmp] giovanni@roquette [genv]\: cat $(guix build --no-offload -e '(load "guix-ou= tput-to-file-example.scm")') "# This is an example configuration file\n# stored in %another-file-object\= nattribute1 =3D var1-value\nattribute2 =3D var2-value\n" =2D-8<---------------cut here---------------end--------------->8--- The output cannot be used in place of %my-file-object, right? AFAIU the solution is to use mixed-text-file as suggested by Tomas Volf yesterday in this thread. Happy hacking! Gio' [...] =2D-=20 Giovanni Biscuolo Xelera IT Infrastructures --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJABAEBCgAqFiEERcxjuFJYydVfNLI5030Op87MORIFAmZHGTMMHGdAeGVsZXJh LmV1AAoJENN9DqfOzDkSPwkQANzKiLq0uhs1VDycZN9WwXEuBAX991yo2TPsTY9a W4A5cF1WxiLIYigT9E+aeA39zZwnBr3fQrYbH8HKlEbtgRmmEwANLMl8O7paLYMU 1JVP8cRLAGGIcS2dudbro9p85Nl5OuhE/1lzyR10lXNys8UIoBCvDQZWkr1lPZD+ rWRKf7t0yrd4RLTDWINScbdekov4NtqKMYjwNsWEX4JANihigKVFzq2Ic9HHLBEB RRpHXY6mfYqJQRFdjzD+C6YctmH4cmHTv9gMvkMFB3vwEFbP2pguSAbyO1AQOxrZ Fyy8UYiis8RaprNcpU70/O1BCdAQhrIugothK8vq52WoGjnakpXkiqFwaJLF5YoL SDHS+sU4k2kR8CYFT+5lR2glTIuja2lheKNMcV+6Nj0ViEUz3pBqohRBCl5DWuUy GVzATkwRMIzDucJdXYgeWEmTMaJFOHV/rXGwe0ht5lwVEXsD1f1dlhAlBXY7mNvm F6h9oKne1gtj52eANyiDSYJWx44x0C9Cg0pu3fPkGV6XpcKpSgrqOxuUSjY0iFyW nhDnId/H16Lb8I8f6E2qYWGiGcFCyd1HRSQr/FC1rxIh40feUdtl7uBnJKEdMT+6 +jkJSsTknWpc6eGp6OjSj3TLCcjPyFFp1EZH4HmYcCmjLiuPWcdicnpGfAH7sW+j YQqD =1U2M -----END PGP SIGNATURE----- --=-=-=--