aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorKenny Ballou <kb@devnulllabs.io>2023-01-13 23:39:07 -0700
committerKenny Ballou <kb@devnulllabs.io>2023-01-13 23:54:28 -0700
commitee9751f14928ab3fa8fee21a1a18cd9bd42a8d39 (patch)
treea26e32b1cef3459efc33774078a800486fa96bf3 /Makefile
parent929c4b2ec911ff0e5010c527287eb2bdbe97b825 (diff)
downloaddotfiles-ee9751f14928ab3fa8fee21a1a18cd9bd42a8d39.tar.gz
dotfiles-ee9751f14928ab3fa8fee21a1a18cd9bd42a8d39.tar.xz
compute usable number of cores for builds
Consider 1/4 of the CPU count as "usable" for Guix builds. Signed-off-by: Kenny Ballou <kb@devnulllabs.io>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile7
1 files changed, 5 insertions, 2 deletions
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