diff options
author | Ludovic Courtès <ludo@gnu.org> | 2015-03-17 22:09:32 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2015-03-17 22:25:55 +0100 |
commit | ff40e9b7e55846c86f48c861816ac01bd0d7af7a (patch) | |
tree | 4e32022258c9cba5e376d1ebfa0a96befce24539 /guix/gexp.scm | |
parent | 9d8100f4c7d9f44a3623419039ac985be7ba9bb3 (diff) | |
download | guix-patches-ff40e9b7e55846c86f48c861816ac01bd0d7af7a.tar guix-patches-ff40e9b7e55846c86f48c861816ac01bd0d7af7a.tar.gz |
gexp: Move the package and origin compilers to (guix packages).
From now own, (guix packages) depends on (guix gexps); it was the other
way around now. This means that (guix packages) code can use gexps.
* guix/gexp.scm (origin-compiler, package-compiler): Remove.
(default-guile-derivation): New procedure.
(gexp->derivation): Use it instead of 'default-guile' +
'package->derivation'.
* guix/packages.scm (default-guile-derivation): New procedure.
(package-compiler, origin-compiler): New variables.
* doc/guix.texi (G-Expressions): Mention extensibility.
Diffstat (limited to 'guix/gexp.scm')
-rw-r--r-- | guix/gexp.scm | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/guix/gexp.scm b/guix/gexp.scm index 119fe42d52..f8646a081c 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -20,7 +20,6 @@ #:use-module (guix store) #:use-module (guix monads) #:use-module (guix derivations) - #:use-module (guix packages) #:use-module (guix utils) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) @@ -39,7 +38,10 @@ text-file* imported-files imported-modules - compiled-modules)) + compiled-modules + + define-gexp-compiler + gexp-compiler?)) ;;; Commentary: ;;; @@ -125,16 +127,6 @@ cross-compiling.)" body ...))) (register-compiler! name))) -(define-gexp-compiler (origin-compiler (origin origin?) system target) - ;; Compiler for origins. - (origin->derivation origin system)) - -(define-gexp-compiler (package-compiler (package package?) system target) - ;; Compiler for packages. - (if target - (package->cross-derivation package target system) - (package->derivation package system))) - ;;; ;;; Inputs & outputs. @@ -212,6 +204,15 @@ names and file names suitable for the #:allowed-references argument to (sequence %store-monad (map lower lst)))) +(define default-guile-derivation + ;; Here we break the abstraction by talking to the higher-level layer. + ;; Thus, do the resolution lazily to hide the circular dependency. + (let ((proc (delay + (let ((iface (resolve-interface '(guix packages)))) + (module-ref iface 'default-guile-derivation))))) + (lambda (system) + ((force proc) system)))) + (define* (gexp->derivation name exp #:key system (target 'current) @@ -314,8 +315,7 @@ The other arguments are as for 'derivation'." (return #f))) (guile (if guile-for-build (return guile-for-build) - (package->derivation (default-guile) - system)))) + (default-guile-derivation system)))) (mbegin %store-monad (set-grafting graft?) ;restore the initial setting (raw-derivation name |