From 383bc2b052bc17592c778448394182ddfa0fad09 Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Tue, 25 Jun 2024 01:15:15 +0300 Subject: [PATCH] chore(scripts): tweak cargo updates --- scripts/install-cargo-packages.sh | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/scripts/install-cargo-packages.sh b/scripts/install-cargo-packages.sh index 2cfb7c3..60eeb19 100755 --- a/scripts/install-cargo-packages.sh +++ b/scripts/install-cargo-packages.sh @@ -21,12 +21,21 @@ source "$CARGO_HOME/env" exit 1 } -rustup default system +rustup default stable + +# If we have cargo install-update, use it first +x-have cargo-install-update && { + msg_run "Updating cargo packages with cargo install-update" + cargo install-update -a + msg_done "Done with cargo install-update" +} packages=( + # A cargo subcommand for checking and applying + # updates to installed executables + "cargo-update" + # Cargo cache management utility "cargo-cache" - # starship.rs - # "starship" # An incremental parsing system for programming tools "tree-sitter-cli" # a subprocess caching utility @@ -37,9 +46,6 @@ packages=( "eza" # A simple, fast and user-friendly alternative to 'find' "fd-find" - # A cargo subcommand for checking and applying - # updates to installed executables - "cargo-update" # recursively searches directories for a # regex pattern while respecting your gitignore "ripgrep" @@ -48,6 +54,9 @@ packages=( "bottom" ) +# Number of jobs to run in parallel, this helps to keep the system responsive +BUILD_JOBS=$(nproc --ignore=2) + for pkg in "${packages[@]}"; do # Trim spaces pkg=${pkg// /} @@ -55,7 +64,7 @@ for pkg in "${packages[@]}"; do if [[ ${pkg:0:1} == "#" ]]; then continue; fi msg_run "Installing cargo package $pkg" - cargo install "$pkg" + cargo install --jobs $BUILD_JOBS "$pkg" echo "" done @@ -64,10 +73,12 @@ msg_done "Installed cargo packages!" msg_run "Now doing the next steps for cargo packages" -# use bob to install nvim +# use bob to install latest stable nvim x-have bob && { bob use stable && x-path-append "$XDG_DATA_HOME/bob/nvim-bin" } msg_run "Removing cargo cache" cargo cache --autoclean +msg_done "Done removing cargo cache" +