From 1d8933340749a85e07e273416da9c558606cf849 Mon Sep 17 00:00:00 2001 From: alvinlollo Date: Wed, 30 Sep 2026 13:36:17 +1000 Subject: [PATCH] Add apt support to LazyVim script --- LazyVim.sh | 42 ++++++++++++++++++++++++++++++++++-------- README.md | 2 +- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/LazyVim.sh b/LazyVim.sh index 6d404c8..5003f32 100755 --- a/LazyVim.sh +++ b/LazyVim.sh @@ -8,16 +8,36 @@ if [ -n "${FISH_VERSION:-}" ] || case "$SHELL" in *fish*) ;; *) false ;; esac; t read -r -p "Press Enter to continue anyway, or Ctrl+C to cancel..." /dev/null; then - echo "Cannot proceed: Not a arch based system" - echo "This script does not have debian support" +# Install prerequisetes +if command -v pacman >/dev/null; then + echo "pacman detected. Installing prerequisites" + # sclip is not packaged for arch, tree-sitter-cli ships the tree-sitter binary + sudo pacman -S --needed --noconfirm git curl wget python3 python-pip neovim jdk-openjdk base-devel ripgrep fd lazygit tectonic tree-sitter-cli julia luarocks shfmt ast-grep nvm +elif command -v apt >/dev/null; then + echo "apt detected. Installing prerequisites" + # tectonic and sclip have no debian package, ast-grep comes from npm, node comes from nodejs + sudo apt install git curl wget python3 python3-pip python3-pynvim neovim default-jdk build-essential ripgrep fd-find lazygit tree-sitter-cli luarocks shfmt nodejs npm -y + + # julia has no package for every debian architecture (e.g. arm64) + sudo apt install julia -y || echo "julia could not be installed, skipping" + + # Debian ships the fd binary as fdfind + if ! command -v fd >/dev/null && command -v fdfind >/dev/null; then + sudo ln -sf "$(command -v fdfind)" /usr/local/bin/fd + fi + + if ! command -v sg >/dev/null; then + sudo npm install -g @ast-grep/cli + fi + + echo "Skipped on debian (not packaged): tectonic, sclip" +else + echo "Cannot proceed: pacman or apt is required" + echo "This script supports arch based and debian based systems" echo "+ sleep 10" && sleep 10 exit 1 fi -# Install prerequisetes -sudo pacman -S --needed --noconfirm git curl wget python3 python-pip neovim jdk-openjdk base-devel ripgrep fd lazygit curl tectonic tree-sittter sclip julia luarocks shfmt ast-grep nvm - echo "" echo 'This script will move your current nvim config to ~/.config/nvim.bak' echo "Press CTRL+C within 10 secconds if you don't want these actions to be made" @@ -117,5 +137,11 @@ if command -v nvm &>/dev/null; then fi # Use NVM to install the latest LTS version of Node.js -nvm install lts -nvm use lts +if command -v nvm &>/dev/null; then + nvm install lts + nvm use lts +elif command -v node >/dev/null; then + echo "nvm not found, using system Node.js $(node --version)" +else + echo "No Node.js installation found. Install it manually, then re-run this script." +fi diff --git a/README.md b/README.md index fe6d7be..2cea5d8 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ This script automatically installs my favourite Linux applications I use every d This script will automatically install [shelly-cli](https://github.com/Seafoam-Labs/Shelly-ALPM) if it is not already present. -Most of this script is intended for Arch Linux with some Debian compatibility on the zsh install script only. +Most of this script is intended for Arch Linux with some Debian compatibility on the zsh, bat and LazyVim install scripts. It also installs custom configuration for zsh and it's plugins.