From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id IO4PAE8xRmadUAEAqHPOHw:P1 (envelope-from ) for ; Thu, 16 May 2024 18:16:15 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id IO4PAE8xRmadUAEAqHPOHw (envelope-from ) for ; Thu, 16 May 2024 18:16:15 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=riseup.net header.s=squak header.b=sZ2rSylB; dmarc=pass (policy=none) header.from=riseup.net; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1715876174; 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=mfxR1gCu6cqV8zgSY+OXYMAcBz/IbfVj6x05fLt3B1s=; b=oOZEGep3bZaO7zhiT3BUamU+FZWjeUfI1eXq4Lwjt006jEybIgO4nK3egd0dhFM+kGqPDg rjCgMTdT9BTwgv9WLLLU/Yn3Cg0/mf+sqQa2FisyN3+JxQpSu9WC2vwj8C5tl6ppmSUt7Q Rw8pDJjPDW5TcasH0qQotH8poXm175PiyrVWdsviOdoxmiGN+UyJjOdyc+SdRlttiTgxxr BvmjS81wHVYnNNm/tAFcUKkFTyXrd4RHC8giUDy4Mst6Oy/loNFbSrRprNQ2z8Y1r23nkI qG6DyKUB/xbpz0ndpaLJOQeVznUine5z5o0tu3OeIWgL0FjXGeasMqY1iMt2XQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1715876174; a=rsa-sha256; cv=none; b=WPIj5lj0L/HeaRMN2oql9RvFRhLPCK2JJlOWF/EKtUuZN11yjelB6xVHGMXnCckiNREcLV OmYAZry/K9YCjA/rv8qlWUTKaJFXoXpq6mF2aAaKSGZbE0qddzuvkwq6DxwrhYHlC75hEs NFPEdnBeah5L7HyGm8lzVuZQkjCoMmX3ReszLZ/umiBM2W+c5TA9YVXaVgiXZaYi1olZBB +UWjxDED7D4xc6BDD9Y4hAAtTQtpLdG5WMdjy5HJ8ENSAvUfQli++XlnGLRY41+sPjbHKp f12pXpJI7XhGVv+DKYQfg4C6U8JiAN47WXNWLvV34yEETMcBnkXE7bpAX+SHlg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=riseup.net header.s=squak header.b=sZ2rSylB; dmarc=pass (policy=none) header.from=riseup.net; 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" 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 9E9AE9430 for ; Thu, 16 May 2024 18:16:14 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s7dlh-0000tL-0R; Thu, 16 May 2024 12:15:45 -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 1s7dlP-0000rj-Ah for help-guix@gnu.org; Thu, 16 May 2024 12:15:27 -0400 Received: from mx0.riseup.net ([198.252.153.6]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s7dlN-0001GB-6l for help-guix@gnu.org; Thu, 16 May 2024 12:15:27 -0400 Received: from fews02-sea.riseup.net (fews02-sea-pn.riseup.net [10.0.1.112]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx0.riseup.net (Postfix) with ESMTPS id 4VgFYk2s47z9tfw; Thu, 16 May 2024 16:15:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1715876122; bh=Vl4BgSo8o6rgLlkgzvTFuDEAACjY8QsDxUUF+oV3f6M=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=sZ2rSylBepeMZHZBt6duWpcS5dvFHs5EVILR+hzc2vDXFAXZtmE6R10vCeAPa3iAD Uh3VHrkgP9jTB9RsaL+zG4lWPXK+F940mZj21ojR03mBjPXgYrcPQ4IGCOr4mpnaNR gKneIRnrDm78uzSXRqXlMxOn+cYvymZj0+Ejfg0Q= X-Riseup-User-ID: 468E1FF70A117A972798BBC317EF3577C48C23D72426C24209183CD6D8FAF95D Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews02-sea.riseup.net (Postfix) with ESMTPSA id 4VgFYj74VHzFt0h; Thu, 16 May 2024 16:15:21 +0000 (UTC) MIME-Version: 1.0 Date: Thu, 16 May 2024 16:15:21 +0000 From: raingloom@riseup.net To: Giovanni Biscuolo Cc: help-guix@gnu.org Subject: Re: how to use a variable in a plain-file object? In-Reply-To: <87le493g1o.fsf@xelera.eu> References: <87le493g1o.fsf@xelera.eu> Message-ID: <77eb920ccc94157785c38a49db5bceb0@riseup.net> Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=198.252.153.6; envelope-from=raingloom@riseup.net; helo=mx0.riseup.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham 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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -6.95 X-Spam-Score: -6.95 X-Migadu-Queue-Id: 9E9AE9430 X-Migadu-Scanner: mx11.migadu.com X-TUID: iQoE6/5xxxja On 2024-05-16 17:57, Giovanni Biscuolo wrote: > Hello, > > sorry for the very guile-absolute-beginner question, but I'd like to use > a declared variable in a plain-file object, so I can write something > like in this pseudo-code snippet: > > --8<---------------cut here---------------start------------->8--- > > (define variable1 "var1-value") > (define variable2 "var2-value") > > [...] > > (define %my-file-object > ,(plain-file "something.conf" " > # This is an example configuration file > > attribute1 =" variable1 " > > attribute2 =" variable2 " > > ")) > > --8<---------------cut here---------------end--------------->8--- > > and obtain a "something.conf" file like this: > > --8<---------------cut here---------------start------------->8--- > # This is an example configuration file > > attribute1 = var1-value > > attribute2 = var2-value > > --8<---------------cut here---------------end--------------->8--- > > how can I do, please? > > Thanks, Gio' You probably want a G-expression. 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 highly recommend reading the relevant docs in Guix's info pages. Online version: https://guix.gnu.org/manual/en/html_node/G_002dExpressions.html Related blog post: https://guix.gnu.org/en/blog/2023/dissecting-guix-part-3-g-expressions/