about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyich@gmail.com>2023-01-08 09:56:01 +0000
committerSergei Trofimovich <slyich@gmail.com>2023-01-08 10:04:44 +0000
commitef91c7bcd88b05d9c21916f7df9a4761dc370008 (patch)
tree10798e45613898bfca4b49e9a5fdabfcdbfa4452
parent005199faf769e5798f29ed46f57f7d8a6f6af788 (diff)
newsboat: run parallel build for 'make' commands
`newsboat` contains quite a bit of C++ code built by custom Makefile.
`rust` code and tests already get build in parallel. The change enables
build parallelism for custom Makefile as well.

The effect on my machine is 78% build time reduction (4.5x speedup):

Before the change:

    $ time nix build -f. newsboat --rebuild
    real    6m20,904s
    user    0m0,345s
    sys     0m0,167s

After the change:

    $ time nix build -f. newsboat
    ...
    real    1m23,592s
    user    0m0,277s
    sys     0m0,097s
-rw-r--r--pkgs/applications/networking/feedreaders/newsboat/default.nix6
1 files changed, 3 insertions, 3 deletions
diff --git a/pkgs/applications/networking/feedreaders/newsboat/default.nix b/pkgs/applications/networking/feedreaders/newsboat/default.nix
index 7e06a75959035..a93391bbbb1b8 100644
--- a/pkgs/applications/networking/feedreaders/newsboat/default.nix
+++ b/pkgs/applications/networking/feedreaders/newsboat/default.nix
@@ -31,7 +31,7 @@ rustPlatform.buildRustPackage rec {
     ++ lib.optionals stdenv.isDarwin [ Security Foundation libiconv gettext ];
 
   postBuild = ''
-    make prefix="$out"
+    make -j $NIX_BUILD_CORES prefix="$out"
   '';
 
   # https://github.com/NixOS/nixpkgs/pull/98471#issuecomment-703100014 . We set
@@ -44,11 +44,11 @@ rustPlatform.buildRustPackage rec {
   doCheck = true;
 
   preCheck = ''
-    make test
+    make -j $NIX_BUILD_CORES test
   '';
 
   postInstall = ''
-    make prefix="$out" install
+    make -j $NIX_BUILD_CORES prefix="$out" install
   '' + lib.optionalString stdenv.isDarwin ''
     for prog in $out/bin/*; do
       wrapProgram "$prog" --prefix DYLD_LIBRARY_PATH : "${stfl}/lib"