M guix-build.in => guix-build.in +1 -2
@@ 198,8 198,7 @@ Report bugs to: ~a.~%") "@PACKAGE_BUGREPORT@"))
;; TODO: Add more options.
(set-build-options %store
#:keep-failed? (assoc-ref opts 'keep-failed?)
- #:build-cores (or (assoc-ref opts 'cores)
- (current-processor-count)))
+ #:build-cores (or (assoc-ref opts 'cores) 0))
(if (assoc-ref opts 'derivations-only?)
(format #t "~{~a~%~}" drv)
M guix/build/gnu-build-system.scm => guix/build/gnu-build-system.scm +9 -2
@@ 128,11 128,18 @@
(string-append srcdir "/configure")
flags))))
+(define %parallel-job-count
+ ;; String to be passed next to GNU Make's `-j' argument.
+ (match (getenv "NIX_BUILD_CORES")
+ (#f "1")
+ ("0" (number->string (current-processor-count)))
+ (x x)))
+
(define* (build #:key (make-flags '()) (parallel-build? #t)
#:allow-other-keys)
(zero? (apply system* "make"
`(,@(if parallel-build?
- `("-j" ,(getenv "NIX_BUILD_CORES"))
+ `("-j" ,%parallel-job-count)
'())
,@make-flags))))
@@ 142,7 149,7 @@
(if tests?
(zero? (apply system* "make" test-target
`(,@(if parallel-tests?
- `("-j" ,(getenv "NIX_BUILD_CORES"))
+ `("-j" ,%parallel-job-count)
'())
,@make-flags)))
(begin