help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What passes in the inputs to the lambda?


From: Julien Lepiller
Subject: Re: What passes in the inputs to the lambda?
Date: Sun, 20 Nov 2022 23:19:51 +0100

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 via email to

[Prev in Thread] Current Thread [Next in Thread]