From ef91c7bcd88b05d9c21916f7df9a4761dc370008 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Sun, 8 Jan 2023 09:56:01 +0000 Subject: [PATCH] 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 --- .../networking/feedreaders/newsboat/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/networking/feedreaders/newsboat/default.nix b/pkgs/applications/networking/feedreaders/newsboat/default.nix index 7e06a7595903..a93391bbbb1b 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"