diff options
Diffstat (limited to 'guix/grafts.scm')
-rw-r--r-- | guix/grafts.scm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/guix/grafts.scm b/guix/grafts.scm index 4c69eb35a2..0ffda8f9aa 100644 --- a/guix/grafts.scm +++ b/guix/grafts.scm @@ -42,6 +42,7 @@ graft-derivation/shallow %graft? + without-grafting set-grafting grafting?)) @@ -341,6 +342,17 @@ DRV, and graft DRV itself to refer to those grafted dependencies." ;; Whether to honor package grafts by default. (make-parameter #t)) +(define (call-without-grafting thunk) + (lambda (store) + (values (parameterize ((%graft? #f)) + (run-with-store store (thunk))) + store))) + +(define-syntax-rule (without-grafting mexp ...) + "Bind monadic expressions MEXP in a dynamic extent where '%graft?' is +false." + (call-without-grafting (lambda () (mbegin %store-monad mexp ...)))) + (define-inlinable (set-grafting enable?) ;; This monadic procedure enables grafting when ENABLE? is true, and ;; disables it otherwise. It returns the previous setting. |