diff options
Diffstat (limited to 'guix/gexp.scm')
-rw-r--r-- | guix/gexp.scm | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/guix/gexp.scm b/guix/gexp.scm index cacc2bf183..8fea42c757 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org> ;;; Copyright © 2018 Jan Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com> @@ -79,6 +79,9 @@ file-append-base file-append-suffix + raw-derivation-file + raw-derivation-file? + load-path-expression gexp-modules @@ -265,6 +268,29 @@ The expander specifies how an object is converted to its sexp representation." (with-monad %store-monad (return drv))) +;; Expand to a raw ".drv" file for the lowerable object it wraps. In other +;; words, this gives the raw ".drv" file instead of its build result. +(define-record-type <raw-derivation-file> + (raw-derivation-file obj) + raw-derivation-file? + (obj raw-derivation-file-object)) ;lowerable object + +(define-gexp-compiler raw-derivation-file-compiler <raw-derivation-file> + compiler => (lambda (obj system target) + (mlet %store-monad ((obj (lower-object + (raw-derivation-file-object obj) + system #:target target))) + ;; Returning the .drv file name instead of the <derivation> + ;; record ensures that 'lower-gexp' will classify it as a + ;; "source" and not as an "input". + (return (if (derivation? obj) + (derivation-file-name obj) + obj)))) + expander => (lambda (obj lowered output) + (if (derivation? lowered) + (derivation-file-name lowered) + lowered))) + ;;; ;;; File declarations. @@ -1597,7 +1623,12 @@ imported modules in its search path. Look up EXP's modules in MODULE-PATH." (chmod port #o555)))) #:system system #:target target - #:module-path module-path))) + #:module-path module-path + + ;; These derivations are not worth offloading or + ;; substituting. + #:local-build? #t + #:substitutable? #f))) (define* (gexp->file name exp #:key (set-load-path? #t) |