unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: Julien Lepiller <julien@lepiller.eu>
To: jgart <jgart@dismail.de>
Cc: Guix Help <help-guix@gnu.org>
Subject: Re: What passes in the inputs to the lambda?
Date: Sun, 20 Nov 2022 23:19:51 +0100	[thread overview]
Message-ID: <20221120231951.52063cb0@sybil.lepiller.eu> (raw)
In-Reply-To: <20221120151009.GB25110@dismail.de>

Le Sun, 20 Nov 2022 15:10:09 -0600,
jgart <jgart@dismail.de> a écrit :

> In the following snippet, what passes in the inputs to the lambda?
> 
> (modify-phases %standard-phases
>   (replace 'unpack
>     (lambda* (#:key inputs #:allow-other-keys)
>       (let* ((source (assoc-ref inputs "source"))
>              (guile-dir (assoc-ref inputs "guile"))
>              (guile (string-append guile-dir "/bin/guile")))
>         (invoke guile "--no-auto-compile" source)
>         (chdir "bootar"))))
> 

The lambda you're talking about is a build phase of some package. These
phases are passed in order to the build system's build procedure. The
exact arguments passed to this lambda therefore depend on the way the
build procedure calls the phases. For instance, we see this in the
gnu-build-system:

(define* (gnu-build name inputs
                    #:key
                    [...])
  [...]
      #~(gnu-build #:source source
                   [...]))

This inner gnu-build is actually a reference to the build side's
gnu-build, not the host side (because it's gquoted (if that's a word
:p)), and it's defined in (guix build gnu-build-system):

(define* (gnu-build #:key [...] #:rest args)
  [...])

It calls the phases with this:

(apply proc args)

where proc is the phase (in this case, your lambda) and args is the
rest of keyword arguments that the definition of gnu-build captured.

HTH!


      reply	other threads:[~2022-11-20 22:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-20 21:10 What passes in the inputs to the lambda? jgart
2022-11-20 22:19 ` Julien Lepiller [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221120231951.52063cb0@sybil.lepiller.eu \
    --to=julien@lepiller.eu \
    --cc=help-guix@gnu.org \
    --cc=jgart@dismail.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).