diff --git a/scripts/update b/scripts/update index 0a252e8d4..08d927593 100755 --- a/scripts/update +++ b/scripts/update @@ -2,6 +2,8 @@ #!nix-shell -i bash -p findutils -p nix-update NIX_FILES_TOP=/home/colin/nixos +# each update job has to do an entire nix eval, which can be memory intensive; be careful when tuning this +PARALLELISM=8 usage() { echo "update: update rev/hash for one or more packages" @@ -10,6 +12,7 @@ usage() { echo "options:" echo "- --dry-run" echo "- --verbose" + echo "- -j (default: $PARALLELISM)" echo "" echo "examples:" echo "- update nixpkgs: update only the nixpkgs input" @@ -82,8 +85,8 @@ updateOnePkg() { updatePkgsInParallel() { debug "updating packages in parallel using xargs" debug "- $@" - debug "- xargs -n 1 -P 4 $0 ${scriptFlags[*]}" - echo "$@" | xargs -n 1 -P 4 "$0" "${scriptFlags[@]}" + debug "- xargs -n 1 -P $PARALLELISM $0 ${scriptFlags[*]}" + echo "$@" | xargs -n 1 -P "$PARALLELISM" "$0" "${scriptFlags[@]}" } scriptFlags=() @@ -107,6 +110,10 @@ parseArgs() { scriptFlags+=(--verbose) verbose=1 ;; + (-j) + PARALLELISM=$1 + shift + ;; (--*) nixFlags+=("$arg") ;;