aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guix/channels.scm6
-rw-r--r--guix/inferior.scm27
2 files changed, 29 insertions, 4 deletions
diff --git a/guix/channels.scm b/guix/channels.scm
index 96d62ce062..9658cf9393 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -477,6 +477,12 @@ be used as a profile hook."
(gexp->derivation-in-inferior "guix-package-cache" build
profile
+
+ ;; If the Guix in PROFILE is too old and
+ ;; lacks 'guix repl', don't build the cache
+ ;; instead of failing.
+ #:silent-failure? #t
+
#:properties '((type . profile-hook)
(hook . package-cache))
#:local-build? #t)))
diff --git a/guix/inferior.scm b/guix/inferior.scm
index 027418a98d..63c95141d7 100644
--- a/guix/inferior.scm
+++ b/guix/inferior.scm
@@ -513,10 +513,15 @@ PACKAGE must be live."
(inferior-package->derivation package system #:target target))
(define* (gexp->derivation-in-inferior name exp guix
+ #:key silent-failure?
+ #:allow-other-keys
#:rest rest)
"Return a derivation that evaluates EXP with GUIX, an instance of Guix as
returned for example by 'channel-instances->derivation'. Other arguments are
-passed as-is to 'gexp->derivation'."
+passed as-is to 'gexp->derivation'.
+
+When SILENT-FAILURE? is true, create an empty output directory instead of
+failing when GUIX is too old and lacks the 'guix repl' command."
(define script
;; EXP wrapped with a proper (set! %load-path …) prologue.
(scheme-file "inferior-script.scm" exp))
@@ -539,9 +544,23 @@ passed as-is to 'gexp->derivation'."
(write `(primitive-load #$script) pipe)
(unless (zero? (close-pipe pipe))
- (error "inferior failed" #+guix)))))
-
- (apply gexp->derivation name trampoline rest))
+ (if #$silent-failure?
+ (mkdir #$output)
+ (error "inferior failed" #+guix))))))
+
+ (define (drop-extra-keyword lst)
+ (let loop ((lst lst)
+ (result '()))
+ (match lst
+ (()
+ (reverse result))
+ ((#:silent-failure? _ . rest)
+ (loop rest result))
+ ((kw value . tail)
+ (loop tail (cons* value kw result))))))
+
+ (apply gexp->derivation name trampoline
+ (drop-extra-keyword rest)))
;;;