From ee9751f14928ab3fa8fee21a1a18cd9bd42a8d39 Mon Sep 17 00:00:00 2001 From: Kenny Ballou Date: Fri, 13 Jan 2023 23:39:07 -0700 Subject: compute usable number of cores for builds Consider 1/4 of the CPU count as "usable" for Guix builds. Signed-off-by: Kenny Ballou --- Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 9936d588..bf3f552e 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,9 @@ HOSTS=h4x daeva owl baal yak koi bard SYSTEMS=$(patsubst %,systems/%,$(HOSTS)) HOMES=$(patsubst %,homes/%,$(HOSTS)) HOSTNAME=$(shell hostname) +NPROC=$(shell nproc) +CORES=$(guile (max 1 (floor (/ $(NPROC) 4)))) + .PHONY: current-system current-system: config/emacs/emacs.d/init.el homes/$(HOSTNAME) systems/$(HOSTNAME) @@ -65,11 +68,11 @@ all-systems: $(SYSTEMS) all-homes: $(HOMES) $(HOMES): - guix time-machine -C $(CHANNEL_FILE) -- home build --cores=2 $@.scm + guix time-machine -C $(CHANNEL_FILE) -- home build --cores=$(CORES) $@.scm .PHONY: $(SYSTEMS) $(SYSTEMS): - guix time-machine -C $(CHANNEL_FILE) -- system build --cores=2 $@.scm + guix time-machine -C $(CHANNEL_FILE) -- system build --cores=$(CORES) $@.scm ## Private targets config/emacs/emacs.d/init.el config/emacs/emacs.d/early-init.el: config/emacs/emacs.d/emacs.org -- cgit v1.2.1