summaryrefslogtreecommitdiff
path: root/guix/build/utils.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-11-22 12:32:32 +0100
committerLudovic Courtès <ludo@gnu.org>2014-11-22 12:32:32 +0100
commite6039b9c70c658d648723a2d331f1c9637b49126 (patch)
tree51507be7c3695b2f65c45201a15e47e03ff83591 /guix/build/utils.scm
parente56512125d808522325324b99eaf966d8272355e (diff)
downloadguix-patches-e6039b9c70c658d648723a2d331f1c9637b49126.tar
guix-patches-e6039b9c70c658d648723a2d331f1c9637b49126.tar.gz
utils: Export 'parallel-job-count'.
* guix/build/utils.scm (parallel-job-count): New procedure. * guix/build/gnu-build-system.scm (%parallel-job-count): Remove. (build, check): Use 'parallel-job-count' instead.
Diffstat (limited to 'guix/build/utils.scm')
-rw-r--r--guix/build/utils.scm10
1 files changed, 10 insertions, 0 deletions
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index cda4fb12ef..bfbc4dd43e 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -31,6 +31,8 @@
#:re-export (alist-cons
alist-delete)
#:export (%store-directory
+ parallel-job-count
+
directory-exists?
executable-file?
call-with-ascii-input-file
@@ -69,6 +71,14 @@
(or (getenv "NIX_STORE")
"/gnu/store"))
+(define (parallel-job-count)
+ "Return the number of processes to be passed next to GNU Make's `-j'
+argument."
+ (match (getenv "NIX_BUILD_CORES") ;set by the daemon
+ (#f 1)
+ ("0" (current-processor-count))
+ (x (or (string->number x) 1))))
+
(define (directory-exists? dir)
"Return #t if DIR exists and is a directory."
(let ((s (stat dir #f)))