From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id eLuYFXCIWWd8owAA62LTzQ:P1 (envelope-from ) for ; Wed, 11 Dec 2024 12:41:20 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id eLuYFXCIWWd8owAA62LTzQ (envelope-from ) for ; Wed, 11 Dec 2024 13:41:20 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=coquand.email header.s=fm1 header.b=JNZu7VmE; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=uYgacfV7; dmarc=pass (policy=none) header.from=coquand.email; 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-Seal: i=1; s=key1; d=yhetil.org; t=1733920879; a=rsa-sha256; cv=none; b=GbtbigKp/lnjrDo3r6MYhpgG/kZkjXR8J9/JnsSCC6lpc4U4CuSOrKu3IB5muBFzHwsYG8 T6bQ0HFEQdxfOaqCTmjmxQVv9mz3siTPSWdBw/7RFzv25T7g8AxjIs6rCRLGmf6f31GH5T UCQO4YsL51LmyLaplG4p3IZkOxLKXTMhXYWyc4nsL316kND6KVQ6ba0L+S4x2u3pLKnNET yqyFRadWIDxKNEZsgRff1Ny2PyScSYOcYtLNBD0gI8/KDDl/v1yQaYEc3ixHhT80LfF1uh sp39mIyg9Gn+gHHZ/fTGe0kGSWlN2qHqn47Kvi/xo4VcUWiONtNlXGHubPbvsg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=coquand.email header.s=fm1 header.b=JNZu7VmE; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=uYgacfV7; dmarc=pass (policy=none) header.from=coquand.email; 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=1733920879; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=WD1HtrlLOZxcbOb6jrG/q/WF8TzMMfZR+1Imx83l/XY=; b=DxTAHIT6b/NgCZ8HELfeFUIGvwWMqMjnmUaC6zfunfD5Rl+2ne78kEFeoVciYxFjQlLHYq hnOpllDpfly67B1wU4s+7hA2Te7gegzxSRTH+T/ihAnS40Pv5VUMd4pOIe3hb5PIytGX0a wjHYXuLjj9V7lplUBMazlGngOvfdh8aHiRnl+WO2+mf4O3WB+LLeqrmV+IptwcYPJfCfWh /Va4DNZja3IpH8tfon6U0KrVMRqQ7rKssBKbXDTMff2PgwVhka0ZcpbgbI0BFB3jxqHZQK paGHlL7EGmS0mm/rcZ1eC6W/FZ0VL4G6Sh6PzmWQGvjf1O1pz2+E1LQTq3b6Fg== 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 184671DD66 for ; Wed, 11 Dec 2024 13:41:19 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tLM1G-0007Vr-KO; Wed, 11 Dec 2024 07:40:47 -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 1tLM0q-0007Om-2w for help-guix@gnu.org; Wed, 11 Dec 2024 07:40:20 -0500 Received: from fout-a5-smtp.messagingengine.com ([103.168.172.148]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tLM0n-0000dl-OV for help-guix@gnu.org; Wed, 11 Dec 2024 07:40:19 -0500 Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfout.phl.internal (Postfix) with ESMTP id 6823213838F1; Wed, 11 Dec 2024 07:40:16 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Wed, 11 Dec 2024 07:40:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=coquand.email; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:reply-to :subject:subject:to:to; s=fm1; t=1733920816; x=1734007216; bh=WD 1HtrlLOZxcbOb6jrG/q/WF8TzMMfZR+1Imx83l/XY=; b=JNZu7VmEpAR6RFFVv7 tJXIa6/GTca8BT+BsfOl8kXPJTQ2TrvwqTj44+rH9kchAVLNXDB3C5df6Bjv6aya R0rU51Zm5QPhDlfNqLHHskFeKq3SYXtKnDQXqT/a8hOrCh9zjGbkM61FvKi8eWPT Dkmf0O0/y9nVG9Ic3SmDYlEx5ZC7e5V42D4J+4wEZWXbgc88XB2/TIdlK9QO7Rla UYiJ5KFp+Gzie3jINfrgWOhJhBpjtv/mDH23Knl3a+p3WpyvGDEV0pGjk+ercjOn pgbB8pI6qd5EOUHCNFxponD/cUSq+27hThfuyK3+pSTaAhtxU9wwEUASaSgA6fIK JUmg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1733920816; x=1734007216; bh=WD1HtrlLOZxcbOb6jrG/q/WF8TzMMfZR+1I mx83l/XY=; b=uYgacfV7UqiGUl1otCXbzQZG0d+hx8kd7kPsm5I7fvmoFysnqb7 bmWr7iisUfm8YzrUsCowOxyV2dXkaoP25CJw7sQbsWR2bdF902fIte3HyBmuEgNt 7otxvS9NkjZ2DnMQdP6ghzYERLIzDsDvwFocEULRT7kyu6kT12I2uoQfPIPeBY5C Rxg4tcs/Ty2KTE4IleFS2SPdZfC9OV+UURD0J3j1j8833TmobDcmFNu1dKAFlJgz uXg1IuW0Z2+26ooaKZUEB74k/57UrZ9RV2dIuo7hmJWnPGq8n0RZXuukuYeRtDXi RQTTlONQCHOtOd6uTo5PhSeao5005ov74bQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrkedtgdegvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnth hsucdlqddutddtmdenucfjughrpefhvfevufgjfffkgggtsehttdertddttddtnecuhfhr ohhmpeforghrtgcuvehoqhhurghnugcuoehmrghrtgestghoqhhurghnugdrvghmrghilh eqnecuggftrfgrthhtvghrnhepveefvddutdfhleefvdekgfetleeiteetteeuudeuhfeg leehfeetudehieevgfeknecuffhomhgrihhnpehmrghilhhguhhnrdhorhhgnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhgrrhgtsegtohhq uhgrnhgurdgvmhgrihhlpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuth dprhgtphhtthhopegvughouhesrhgukhhlvghinhdrfhhrpdhrtghpthhtohephhgvlhhp qdhguhhigiesghhnuhdrohhrgh X-ME-Proxy: Feedback-ID: i587e488e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 11 Dec 2024 07:40:15 -0500 (EST) From: Marc Coquand To: Edouard Klein Cc: help-guix@gnu.org Subject: Re: Prepend string to "file" in G-expression In-Reply-To: <87r06esal7.fsf@rdklein.fr> (message from Edouard Klein on Wed, 11 Dec 2024 12:49:56 +0100) Date: Wed, 11 Dec 2024 14:40:11 +0200 Message-ID: <87a5d2e6l0.fsf@coquand.email> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=103.168.172.148; envelope-from=marc@coquand.email; helo=fout-a5-smtp.messagingengine.com 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_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=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: -3.09 X-Spam-Score: -3.09 X-Migadu-Queue-Id: 184671DD66 X-Migadu-Scanner: mx12.migadu.com X-TUID: zg72VDWvMApC Heya, Essentially what I'm trying to do is build a program that sends an email, and then package it in Guix. The reason is that laminar (a ci tool) expects a script to run after each job. My initial idea was to build a shell-script with Guile, but I thought it might be easier to build a Guile-script instead with Gexpr. So using guix to construct a file containing the appropriate guile program to run. The error in the previous email turned out to not be related to that code, I was confused because it complained about string-append as I was using that function. Since the last email I've now come up with the following: (define notify-mail-gexp (with-imported-modules '((guix build utils)) #~(begin (use-modules (guix build utils) (ice-9 popen) (ice-9 receive)) (let* ((cat-bin #$(file-append coreutils "/bin/cat")) (msmtp-bin #$(file-append msmtp "/bin/msmtp")) (job-name (getenv "JOB")) (result (getenv "RESULT"))) (receive (from to pids) (pipeline `(("echo" ,(string-append "To: builds@address\n" "Subject: Build | " job-name "#" result "From: build-notify@address\n\n" "You can not reply to this email.")) (,msmtp-bin "--host=smtp.eu.mailgun.org" "--port=587" "--auth=on" "--user=build-notify@address" "--tls=on" "-t" "--read-envelope-from" "--set-from-header=auto" ,(string-append "--passwordeval=" cat-bin " " "/run/secrets/mailgun")))) (close from) (close to)))))) (program-file "notify-mail" notify-mail-gexp) This kind of works, but piping unix commands this way is not very ergonomic, so I wonder what a better approach would be. Maybe a plain-file with a shell-script is simpler. -- Marc On Wed, Dec 11 2024, Edouard Klein wrote: > Hi, > > I foresee at least two problems with what you are trying to achieve (I > may be mistaken so take this with a grain of salt): > - Gexps are for passing info to the build daemon, and at build time > there is no internet connection, and therefore no way to send an email > - Any file you reference will be pulled in the store, therefore your > password will be in the store, for all to read. > > > > As for the rest, I don't think I understand your question: > just put the file name after "/bin/cat " (notice the space after cat). > > If it's provided by a package, use the #$package-name "/relative/path", > otherwise you could use something like #$(plain-file "name" "content") > or #$(local file "fname"). But again, beware, those are going to be > copied into the store. > > Could you please tell us more about what you are trying to achieve ? > > Cheers, > > Edouard. > Marc Coquand writes: > >> Heya, I'm trying to grok g-expressions and setting up a small guile >> program that sends an email. >> >> I have the following >> >> (define notify-mail-gexp >> (with-imported-modules >> '((guix build utils)) >> #~(begin >> (use-modules >> (guix build utils)) >> (let* ((msmtp-bin #$(file-append msmtp "/bin/msmtp")) >> (run-number (getenv "RUN")) >> (result (getenv "RESULT")) >> (job-name (getenv "JOB")) >> (password-eval-command >> (string-append >> "--password-eval=" #$coreutils "/bin/cat"))) ;; more to come later >> (invoke msmtp-bin >> "--user=\"me@address\"" >> password-eval-command >> "-t" >> "--read-envelope-from" >> "--set-from-header=\"auto\"" >> (result-email job-name run-number result)))))) >> >> (program-file "notify-mail" notify-mail-gexp) >> >> What I struggle with is the correct incantation to build an argument to >> invoke that looks like this: >> >> --password-eval=/gnu/blahblah/bin/cat some-file >> >> And I'd love any kind of directions for how I'm supposed to write this >> correctly. >> >> Thanks in advance