diff --git a/core/src/magic.sld b/core/src/magic.sld index 7c2b4b7..53d8b37 100644 --- a/core/src/magic.sld +++ b/core/src/magic.sld @@ -25,6 +25,7 @@ store-path-devirtualise store-path-register-fallback + store-path-register-post-build ca-thread-count drv-resolve-ca @@ -464,6 +465,11 @@ (mutex-lock! pending-count-mutex) (unless (eq? pending-count 'error) (set! pending-count (- pending-count 1))) + + ; Notify the derivation that it is built. + (let* ((meta (derivation-meta ca-drv)) + (post-build (and meta (assoc 'post-build meta)))) + (when post-build ((cdr post-build) (pending-item-resolved-paths item)))) (mutex-unlock! pending-count-mutex) (mutex-lock! pending-mutex) (set-pending-item-awaiting-count! item 'built) @@ -593,6 +599,11 @@ (set-derivation-meta! (store-path-drv path) (cons (cons 'fallback wrap-fallback) (or (derivation-meta (store-path-drv path)) '()))) path) + ; Note: this post-build hook is called with a mutex taken. + (define (store-path-register-post-build path callback) + (set-derivation-meta! (store-path-drv path) (cons (cons 'post-build callback) (or (derivation-meta (store-path-drv path)) '()))) + path) + (register-build-step '((zilch core magic) build) #t (lambda items (printf "received build info: ~S\n" items)