--- a/guix/store.scm +++ b/guix/store.scm @@ -484,11 +512,11 @@ encoding conversion errors." (when (>= (nix-server-minor-version server) 10) (send (boolean use-substitutes?))) (when (>= (nix-server-minor-version server) 12) - (let ((pairs (if timeout - `(("build-timeout" . ,(number->string timeout)) - ,@binary-caches) - binary-caches))) - (send (string-pairs pairs)))) + (let ((pairs `(,@(if timeout + `(("build-timeout" . ,(number->string timeout))) + '()) + ("substitute-urls" . ,(string-join substitute-urls))))) + (send (string-pairs (pk 'pairs pairs))))) (let loop ((done? (process-stderr server))) (or done? (process-stderr server))))) diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm index 370c2a3..df38b5e 100644 --- a/guix/scripts/build.scm +++ b/guix/scripts/build.scm @@ -110,6 +110,9 @@ options handled by 'set-build-options-from-command-line', and listed in (display (_ " --no-substitutes build instead of resorting to pre-built substitutes")) (display (_ " + --substitute-urls=URLS + fetch substitute from URLS if they are authorized")) + (display (_ " --no-build-hook do not attempt to offload builds via the build hook")) (display (_ " --max-silent-time=SECONDS @@ -133,6 +136,8 @@ options handled by 'set-build-options-from-command-line', and listed in #:max-build-jobs (or (assoc-ref opts 'max-jobs) 1) #:fallback? (assoc-ref opts 'fallback?) #:use-substitutes? (assoc-ref opts 'substitutes?) + #:substitute-urls (or (assoc-ref opts 'substitute-urls) + '()) #:use-build-hook? (assoc-ref opts 'build-hook?) #:max-silent-time (assoc-ref opts 'max-silent-time) #:timeout (assoc-ref opts 'timeout) @@ -166,6 +171,13 @@ options handled by 'set-build-options-from-command-line', and listed in (alist-cons 'substitutes? #f (alist-delete 'substitutes? result)) rest))) + (option '("substitute-urls") #t #f + (lambda (opt name arg result . rest) + (apply values + (alist-cons 'substitute-urls + (string-tokenize arg) + (alist-delete 'substitute-urls result)) + rest))) (option '("no-build-hook") #f #f (lambda (opt name arg result . rest) (apply values diff --git a/guix/scripts/substitute-binary.scm b/guix/scripts/substitute-binary.scm index 903564c..1d45753 100755 --- a/guix/scripts/substitute-binary.scm +++ b/guix/scripts/substitute-binary.scm @@ -631,7 +631,10 @@ found." (assoc-ref (daemon-options) option)) (define %cache-url - (match (and=> (find-daemon-option "substitute-urls") + (match (and=> (string-append + (find-daemon-option "untrusted-substitute-urls") ;client + " " + (find-daemon-option "substitute-urls")) ;admin string-tokenize) ((url) url)