Add a guile-for-build' parameter to build-expression->derivation'.

* guix/derivations.scm (%guile-for-build): Use `nixpkgs-derivation*'
  instead of `nixpkgs-derivation'.
  (build-expression->derivation): New `guile-for-build' keyword
  parameter.  Use it.
This commit is contained in:
Ludovic Courtès 2012-09-01 11:45:52 +02:00
parent 4c1eddf766
commit 6dd7787c39

View file

@ -440,7 +440,7 @@ (define (env-vars-with-empty-outputs)
(define %guile-for-build (define %guile-for-build
;; The derivation of the Guile to be used within the build environment, ;; The derivation of the Guile to be used within the build environment,
;; when using `build-expression->derivation'. ;; when using `build-expression->derivation'.
(make-parameter (false-if-exception (nixpkgs-derivation "guile")))) (make-parameter (false-if-exception (nixpkgs-derivation* "guile"))))
(define* (imported-files store files (define* (imported-files store files
#:key (name "file-import") (system (%current-system))) #:key (name "file-import") (system (%current-system)))
@ -509,7 +509,8 @@ (define* (build-expression->derivation store name system exp inputs
#:key (outputs '("out")) #:key (outputs '("out"))
hash hash-algo hash hash-algo
(env-vars '()) (env-vars '())
(modules '())) (modules '())
guile-for-build)
"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
@ -519,9 +520,13 @@ (define* (build-expression->derivation store name system exp inputs
of string pairs specifying the name and value of environment variables of string pairs specifying the name and value of environment variables
visible to the builder. The builder terminates by passing the result of EXP 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 to `exit'; thus, when EXP returns #f, the build is considered to have
failed." failed.
EXP is built using GUILE-FOR-BUILD (a derivation). When GUILE-FOR-BUILD is
omitted or is #f, the value of the `%guile-for-build' fluid is used instead."
(define guile (define guile
(string-append (derivation-path->output-path (%guile-for-build)) (string-append (derivation-path->output-path (or guile-for-build
(%guile-for-build)))
"/bin/guile")) "/bin/guile"))
(define module-form? (define module-form?
@ -579,7 +584,7 @@ (define %build-inputs
,@(if mod-dir `("-L" ,mod-dir) '()) ,@(if mod-dir `("-L" ,mod-dir) '())
,builder) ,builder)
env-vars env-vars
`((,(%guile-for-build)) `((,(or guile-for-build (%guile-for-build)))
(,builder) (,builder)
,@(map cdr inputs) ,@(map cdr inputs)
,@(if mod-drv `((,mod-drv)) '())) ,@(if mod-drv `((,mod-drv)) '()))