From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id 2Jo3N+LrVmfMYQAA62LTzQ:P1 (envelope-from ) for ; Mon, 09 Dec 2024 13:08:51 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id 2Jo3N+LrVmfMYQAA62LTzQ (envelope-from ) for ; Mon, 09 Dec 2024 14:08:51 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=lepiller.eu header.s=dkim header.b=g6mTDE52; dmarc=pass (policy=none) header.from=lepiller.eu; 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=1733749730; a=rsa-sha256; cv=none; b=nDrP6BOqh5z2Px15j7f6VtulJpG7sVqR31oyNA8X6nSilI26ZwTCQd2O8GQ0OSNL8WwZeV 9vDrMyeBz+fYgKT8B+JZqZAWfi+mzk+/ipUZQ0wWCU9sWNSdOYBj+U7cggYf3nRiq77yWp yOa/U51ar+pj1aSQLOdAZ+XRfkqmICB/JdDLA9m7lZSsqbPg9bWKO2ZbgwH2KStRsttMhj q/V9mbjAVhhCrECU3AdKoxODRTNWiP64QpxssH1tKDN5q4aykuz8am1JAjPfksaFAN75AO 1ZKXLwv5leGaHYWuPDHFKmXuUcocLuuQM9rsFhojqdH1JYUa5Tb7cq8Ec2MPog== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=lepiller.eu header.s=dkim header.b=g6mTDE52; dmarc=pass (policy=none) header.from=lepiller.eu; 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=1733749730; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=kjw7R0oRjGKMSwMqWsSUsEfERASm9xJuzTFoBy3H4Po=; b=kl9p9wfqSR2MwKMmz78r5fqfA2MvbpOgxr11mdYGnUzPOAZGwJuASsyxyFEuNwCKQM2tpG ybAcwshhjPTRsODSpUs/JIFwNug/bbrE1uD9gBBNXTMIQGQuVm9vpEASs9dpTvykausfrm 54ROOLsRjdmQu6HLasyEVq5TJxf88Sl/W30xkxyjxpmvKXji6IHm9rs1yIXbDzrOSYBQ0W WKn1qlmkY4QY/9Tvy38ov2M8JFix/YYXregzYNL7MxX0ASf6GGiVZXEmHHcLnepEl9fw08 7m+C9FqPlqTzZgO1//G0iNzGtk+VjdqsDqk6KXwaIDv6IMgHN+qQWmBLgk7/BQ== 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 8A81E52A4 for ; Mon, 09 Dec 2024 14:08:50 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tKdUq-0007q4-5S; Mon, 09 Dec 2024 08:08:20 -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 1tKdUl-0007pf-Su for help-guix@gnu.org; Mon, 09 Dec 2024 08:08:16 -0500 Received: from lepiller.eu ([2a00:5884:8208::1] helo=hermes.lepiller.eu) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tKdUi-00037p-Qv for help-guix@gnu.org; Mon, 09 Dec 2024 08:08:15 -0500 Received: from hermes.lepiller.eu (localhost [127.0.0.1]) by hermes.lepiller.eu (OpenSMTPD) with ESMTP id 6d34c51f; Mon, 9 Dec 2024 13:08:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=date:from :to:subject:in-reply-to:references:message-id:mime-version :content-type:content-transfer-encoding; s=dkim; bh=P6yUsge+lkcC qiXXpYzj1i5meqL2SKoRN+KtJTg8q+M=; b=g6mTDE523tkCkMAzN6Xa8FgsaO4+ wQWRttf7VKBg00Cdwbd4WxuAIlZXXQ4QNHJossmbZqENXdFujabA2RXep7Fj14Yv k6N3qXAqZNe78VabqT5RGDqCLynHtHmNiaqbuFZQh2uc4rlNdFCy50sTUzl0NDQ8 Fmy7ZKOnWuupy+mrw7B4B1xIGM3BnYVnd68BFy/VLz6OiRtZCc69FvUYSghwvYUr bhEuRdfzlDCoFJFZI0sVE212uT8EXpeFf4Slb41yt4UmBfJ8aWDc3xErrNVWt91l jOzvTYWfwrEdpcdrfwFo2QJw/I16un8gU8wTfYcLbEw+5vBtf8zOoxCDbQ== Received: by hermes.lepiller.eu (OpenSMTPD) with ESMTPSA id e511b2df (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 9 Dec 2024 13:08:04 +0000 (UTC) Date: Mon, 09 Dec 2024 14:08:01 +0100 From: Julien Lepiller To: help-guix@gnu.org, Yulran Subject: Re: Nested gexps in mcron job definitions User-Agent: K-9 Mail for Android In-Reply-To: <87o71lc9sy.fsf@posteo.net> References: <87o71lc9sy.fsf@posteo.net> Message-ID: <0B208CFA-731C-47E7-AE64-F4FAA12BFD8F@lepiller.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2a00:5884:8208::1; envelope-from=julien@lepiller.eu; helo=hermes.lepiller.eu X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_NONE=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-Queue-Id: 8A81E52A4 X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -7.16 X-Spam-Score: -7.16 X-TUID: 1aGrnvY0h5wU Hi Yulran, I think this is related to how gexps are expanded=2E In your first gexp, y= ou use #$accounts, which expands to ("account1" "account2"), and it's inter= preted as a procedure call=2E Untested, but '#$accounts should work=2E It might be easier to work with a single gexp, like so: #~(job '(next-second (range 1 61 10)) (lambda () (let ((accounts =E2=80=A6)) =E2=80=A6 (system =E2=80=A6)))) Le 9 d=C3=A9cembre 2024 13:36:45 GMT+01:00, Yulran a= =C3=A9crit=C2=A0: >Hi guix, > >I'm having trouble with nesting g-expressions when defining a mcron job= =2E I want the job to run the same "mastodon-archive" commands for several = accounts, so I define a list of accounts and use 'map' to build the complet= e command=2E This works well when there are only strings involved, but I ca= n't make it work with gexps=2E > >Here's a simplified example with only strings: > >--8<---------------cut here---------------start------------->8--- >(define succeeding-job > (let* ((accounts '("account1" "account2")) > (cmd (apply string-append > (map > (lambda (acct) > (string-append > "mastodon-archive archive " acct "; ")) > accounts)))) > #~(job '(next-second (range 1 61 10)) > (lambda () > (system (string-append "echo '" #$cmd "'"))) > "mastodon-archive"))) >--8<---------------cut here---------------end--------------->8--- > >The job succeeds and the mcron log prints as expected "mastodon-archive a= rchive account1; mastodon-archive archive account2;"=2E Now to use the full= path to the mastodon-archive binary, cmd must be a gexp: > >--8<---------------cut here---------------start------------->8--- >(define failing-job > (let* ((accounts '("account1" "account2")) > (cmd #~(apply string-append > (map > (lambda (acct) > (string-append > #$mastodon-archive "/bin/mastodon-archive arch= ive " acct "; ")) > #$accounts)))) > #~(job '(next-second (range 1 61 10)) > (lambda () > (system (string-append "echo '" #$cmd "'"))) > "mastodon-archive"))) >--8<---------------cut here---------------end--------------->8--- > >The home configuration builds fine, but the mcron job fails with the erro= r: (wrong-type-arg #f Wrong type to apply: ~S (account1) (account1)) > >I played around with gexp-ing the string-append in the lambda, ungexp-ing= acct, and trying every other combination of gexp/ungexp I could think of, = but I could only make it worse=2E > >Any idea what I'm doing wrong? >