unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* What passes in the inputs to the lambda?
@ 2022-11-20 21:10 jgart
  2022-11-20 22:19 ` Julien Lepiller
  0 siblings, 1 reply; 2+ messages in thread
From: jgart @ 2022-11-20 21:10 UTC (permalink / raw)
  To: Guix Help

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"))))


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: What passes in the inputs to the lambda?
  2022-11-20 21:10 What passes in the inputs to the lambda? jgart
@ 2022-11-20 22:19 ` Julien Lepiller
  0 siblings, 0 replies; 2+ messages in thread
From: Julien Lepiller @ 2022-11-20 22:19 UTC (permalink / raw)
  To: jgart; +Cc: Guix Help

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!


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-20 22:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-20 21:10 What passes in the inputs to the lambda? jgart
2022-11-20 22:19 ` Julien Lepiller

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).