summary refs log tree commit diff
path: root/gnu/packages/nim.scm
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2022-08-03 19:59:37 +0300
committerEfraim Flashner <efraim@flashner.co.il>2022-08-03 20:01:25 +0300
commit4d41dad4bae14e3855d83d7097317a153f1ac4e8 (patch)
tree2653de0ee667dace21fd95566659e7dda0eeeea9 /gnu/packages/nim.scm
parent6bc9c73f722a29552bd86bbc0b8a9de908397ff7 (diff)
downloadguix-4d41dad4bae14e3855d83d7097317a153f1ac4e8.tar.gz
gnu: nim: Enable parallel building.
* gnu/packages/nim.scm (nim)[arguments]: Adjust custom 'build phase to
add parallel flag.
[native-inputs]: Add parallel.
Diffstat (limited to 'gnu/packages/nim.scm')
-rw-r--r--gnu/packages/nim.scm13
1 files changed, 10 insertions, 3 deletions
diff --git a/gnu/packages/nim.scm b/gnu/packages/nim.scm
index c31659fdc9..6da382119f 100644
--- a/gnu/packages/nim.scm
+++ b/gnu/packages/nim.scm
@@ -28,6 +28,7 @@
   #:use-module (guix packages)
   #:use-module (gnu packages bdw-gc)
   #:use-module (gnu packages certs)
+  #:use-module (gnu packages parallel)
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages sqlite)
   #:use-module (gnu packages tls))
@@ -104,10 +105,16 @@
                  (substitute* (find-files "c_code" "stdlib_osproc\\.nim\\.c")
                    (("\"/bin/sh\", 7") (format #f "~s, ~s" sh (string-length sh)))))))
            (replace 'build
-             (lambda _
+             (lambda* (#:key (parallel-build? #t) #:allow-other-keys)
                (setenv "XDG_CACHE_HOME" "./cache-home")
+               (setenv "HOME" "./cache-home")
                (mkdir-p "./cache-home")
-               (invoke "sh" "build.sh")
+               (invoke "sh" "build.sh"
+                       "--parallel"
+                       (if parallel-build?
+                         (number->string (parallel-job-count))
+                         "1"))
+               (sleep 5)        ; Wait for the parallel builds to finish.
                (invoke "./bin/nim" "c" "-d:release" "koch")
                (invoke "./koch" "boot" "-d:release")
                (invoke "./koch" "tools")))
@@ -139,7 +146,7 @@
                  (copy-file "dist/nimble/nimble.bash-completion"
                             (string-append zsh "/_nimble"))))))))
     (inputs (list libgc openssl pcre sqlite))
-    (native-inputs (list nss-certs))
+    (native-inputs (list nss-certs parallel))
     (home-page "https://nim-lang.org")
     (synopsis "Statically-typed, imperative programming language")
     (description "Nim (formerly known as Nimrod) is a statically-typed,