Add an `env-vars' keyword parameter to `build-expression->derivation'.

* guix/derivations.scm (build-expression->derivation): New `env-vars'
  keyword parameter; default to '().  Use it.
This commit is contained in:
Ludovic Courtès 2012-09-01 11:33:20 +02:00
parent dc4e02572e
commit 4c1eddf766
1 changed files with 7 additions and 4 deletions

View File

@ -508,15 +508,18 @@ search path."
(define* (build-expression->derivation store name system exp inputs (define* (build-expression->derivation store name system exp inputs
#:key (outputs '("out")) #:key (outputs '("out"))
hash hash-algo hash hash-algo
(env-vars '())
(modules '())) (modules '()))
"Return a derivation that executes Scheme expression EXP as a builder for "Return a derivation that executes Scheme expression EXP as a builder for
derivation NAME. INPUTS must be a list of (NAME DRV-PATH SUB-DRV) tuples; derivation NAME. INPUTS must be a list of (NAME DRV-PATH SUB-DRV) tuples;
when SUB-DRV is omitted, \"out\" is assumed. EXP is evaluated in an when SUB-DRV is omitted, \"out\" is assumed. EXP is evaluated in an
environment where %OUTPUT is bound to the main output path, %OUTPUTS is bound environment where %OUTPUT is bound to the main output path, %OUTPUTS is bound
to a list of output/path pairs, and where %BUILD-INPUTS is bound to an alist to a list of output/path pairs, and where %BUILD-INPUTS is bound to an alist
of string/output-path pairs made from INPUTS. The builder terminates by of string/output-path pairs made from INPUTS. Optionally, ENV-VARS is a list
passing the result of EXP to `exit'; thus, when EXP returns #f, the build is of string pairs specifying the name and value of environment variables
considered to have failed." visible to the builder. The builder terminates by passing the result of EXP
to `exit'; thus, when EXP returns #f, the build is considered to have
failed."
(define guile (define guile
(string-append (derivation-path->output-path (%guile-for-build)) (string-append (derivation-path->output-path (%guile-for-build))
"/bin/guile")) "/bin/guile"))
@ -575,7 +578,7 @@ considered to have failed."
`("--no-auto-compile" `("--no-auto-compile"
,@(if mod-dir `("-L" ,mod-dir) '()) ,@(if mod-dir `("-L" ,mod-dir) '())
,builder) ,builder)
'(("HOME" . "/homeless")) env-vars
`((,(%guile-for-build)) `((,(%guile-for-build))
(,builder) (,builder)
,@(map cdr inputs) ,@(map cdr inputs)