From 0562baaa8ee9c4cb911fb8498a760d579b6735dd Mon Sep 17 00:00:00 2001 From: Ilan Joselevich Date: Sat, 22 Jul 2023 20:54:05 +0300 Subject: [PATCH] Drop the need for python by using nproc --all/hw.logicalcpu_max --- install-nix.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/install-nix.sh b/install-nix.sh index 536783c..5a2b25e 100755 --- a/install-nix.sh +++ b/install-nix.sh @@ -46,11 +46,16 @@ installer_options=( --nix-extra-conf-file "$workdir/nix.conf" ) +if [[ $OSTYPE =~ darwin ]]; then + dameon_user_count="$(sysctl -n hw.logicalcpu_max)" +else + dameon_user_count="$(nproc --all)" +fi # only use the nix-daemon settings if on darwin (which get ignored) or systemd is supported if [[ (! $INPUT_INSTALL_OPTIONS =~ "--no-daemon") && ($OSTYPE =~ darwin || -e /run/systemd/system) ]]; then installer_options+=( --daemon - --daemon-user-count "$(python3 -c 'import multiprocessing as mp; print(mp.cpu_count() * 2)')" + --daemon-user-count "$dameon_user_count" ) else # "fix" the following error when running nix*