monads, gexp: Remove unintended dependency on (gnu packages …).

* guix/gexp.scm (gexp->derivation, gexp->script): Use 'default-guile'
  instead of an explicit reference to 'guile-final'.
  (default-guile): New procedure.
* guix/monads.scm (run-with-store)[default-guile]: New procedure.
  Use it.
This commit is contained in:
Ludovic Courtès 2014-05-01 18:53:16 +02:00
parent 79c0c8cdf7
commit 53e89b1732
2 changed files with 16 additions and 7 deletions

View File

@ -129,9 +129,8 @@ The other arguments are as for 'derivation'."
(return #f))) (return #f)))
(guile (if guile-for-build (guile (if guile-for-build
(return guile-for-build) (return guile-for-build)
(package->derivation (package->derivation (default-guile)
(@ (gnu packages base) guile-final) system))))
system))))
(raw-derivation name (raw-derivation name
(string-append (derivation->output-path guile) (string-append (derivation->output-path guile)
"/bin/guile") "/bin/guile")
@ -336,9 +335,14 @@ package/derivation references."
;;; Convenience procedures. ;;; Convenience procedures.
;;; ;;;
(define (default-guile)
;; Lazily resolve 'guile-final'. This module must not refer to (gnu …)
;; modules directly, to avoid circular dependencies, hence this hack.
(module-ref (resolve-interface '(gnu packages base))
'guile-final))
(define* (gexp->script name exp (define* (gexp->script name exp
#:key (modules '()) #:key (modules '()) (guile (default-guile)))
(guile (@ (gnu packages base) guile-final)))
"Return an executable script NAME that runs EXP using GUILE with MODULES in "Return an executable script NAME that runs EXP using GUILE with MODULES in
its search path." its search path."
(mlet %store-monad ((modules (imported-modules modules)) (mlet %store-monad ((modules (imported-modules modules))

View File

@ -414,10 +414,15 @@ input list as a monadic value."
(system (%current-system))) (system (%current-system)))
"Run MVAL, a monadic value in the store monad, in STORE, an open store "Run MVAL, a monadic value in the store monad, in STORE, an open store
connection." connection."
(define (default-guile)
;; Lazily resolve 'guile-final'. This module must not refer to (gnu …)
;; modules directly, to avoid circular dependencies, hence this hack.
(module-ref (resolve-interface '(gnu packages base))
'guile-final))
(parameterize ((%guile-for-build (or guile-for-build (parameterize ((%guile-for-build (or guile-for-build
(package-derivation store (package-derivation store
(@ (gnu packages base) (default-guile)
guile-final)
system))) system)))
(%current-system system)) (%current-system system))
(mval store))) (mval store)))