diff options
author | Ludovic Courtès <ludo@gnu.org> | 2021-03-07 15:26:17 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2021-03-30 22:48:45 +0200 |
commit | 565733c4d71ebfa0f200d027de2ea663461c1bd3 (patch) | |
tree | 8abdec683eeecfa4484c0d235b10e01119b80f98 /guix/grafts.scm | |
parent | 89b0c2390a53dd9b745c43c03dcb8e2915c3ba58 (diff) | |
download | guix-patches-565733c4d71ebfa0f200d027de2ea663461c1bd3.tar guix-patches-565733c4d71ebfa0f200d027de2ea663461c1bd3.tar.gz |
grafts: Add 'without-grafting'.
* guix/grafts.scm (call-without-grafting): New procedure.
(without-grafting): New macro.
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 fd8a108092..7f5b97c39d 100644 --- a/guix/grafts.scm +++ b/guix/grafts.scm @@ -42,6 +42,7 @@ graft-derivation/shallow %graft? + without-grafting set-grafting grafting?)) @@ -323,6 +324,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. |