diff --git a/home/.chezmoidata/packages_base.yaml b/home/.chezmoidata/packages_base.yaml new file mode 100644 index 0000000..59db371 --- /dev/null +++ b/home/.chezmoidata/packages_base.yaml @@ -0,0 +1,28 @@ +packages_base: + archlinux: + pacman: + - 'git' + - 'base-devel' + yay: + - 'curl' + - 'direnv' + - 'ranger' + - 'tmux' + - 'trash-cli' + - 'unzip' + - 'wget' + - 'zip' + - 'zoxide' + debian: + apt: + - 'apt-utils' + - 'autoconf' + - 'automake' + - 'cmake' + - 'doxygen' + - 'libtool' + - 'libtool-bin' + - 'mist' + - 'ninja-build' + - 'pkg-config' + - 'makedeb' diff --git a/home/.chezmoidata/packages_lvim.yaml b/home/.chezmoidata/packages_lvim.yaml new file mode 100644 index 0000000..870b1df --- /dev/null +++ b/home/.chezmoidata/packages_lvim.yaml @@ -0,0 +1,21 @@ +packages_lvim: + archlinux: + yay: + - 'cargo' + - 'go' + - 'neovim' + - 'npm' + - 'python-pip' + - 'python-pynvim' + - 'ripgrep' + debian: + apt: + - 'cargo' + - 'go' + - 'npm' + - 'python3-pip' + - 'python3-pynvim' + - 'ripgrep' + mist: + - 'neovim' + diff --git a/home/.chezmoidata/packages_shell.yaml b/home/.chezmoidata/packages_shell.yaml new file mode 100644 index 0000000..2afc1c0 --- /dev/null +++ b/home/.chezmoidata/packages_shell.yaml @@ -0,0 +1,9 @@ +packages_shell: + archlinux: + yay: + - 'zsh' + - 'starship' + debian: + mist: + - 'zsh' + - 'starship-bin' diff --git a/home/.chezmoiscripts/run_onchange_after_10-install-packages.sh.tmpl b/home/.chezmoiscripts/backup/run_onchange_after_10-install-packages.sh.tmpl similarity index 98% rename from home/.chezmoiscripts/run_onchange_after_10-install-packages.sh.tmpl rename to home/.chezmoiscripts/backup/run_onchange_after_10-install-packages.sh.tmpl index c38e115..d16e84d 100644 --- a/home/.chezmoiscripts/run_onchange_after_10-install-packages.sh.tmpl +++ b/home/.chezmoiscripts/backup/run_onchange_after_10-install-packages.sh.tmpl @@ -110,8 +110,6 @@ packages=( {{- end }} done - ## curl -sS https://starship.rs/install.sh | sh - mist install starship-bin echo -e "\033[0;32m>>>>> Finish Debian/Ubuntu Linux packages installation <<<<<\033[0m" diff --git a/home/.chezmoiscripts/run_onchange_after_20-config-zim.sh b/home/.chezmoiscripts/backup/run_onchange_after_20-config-zim.sh similarity index 100% rename from home/.chezmoiscripts/run_onchange_after_20-config-zim.sh rename to home/.chezmoiscripts/backup/run_onchange_after_20-config-zim.sh diff --git a/home/.chezmoiscripts/backup/run_onchange_after_80-install-lvim.sh.tmpl b/home/.chezmoiscripts/backup/run_onchange_after_80-install-lvim.sh.tmpl new file mode 100644 index 0000000..c6be24a --- /dev/null +++ b/home/.chezmoiscripts/backup/run_onchange_after_80-install-lvim.sh.tmpl @@ -0,0 +1,73 @@ +#!/usr/bin/env bash + +set -euxo pipefail + +packages=( + cargo + go + neovim + npm + python-pip + python-pynvim + ripgrep +) + +echo -e "\033[0;32m>>>>> Begin LVim installation <<<<<\033[0m" + +{{ if (eq .chezmoi.osRelease.id "manjaro" "arch") -}} + + ## Update system + {{- if ne .chezmoi.username "root" }} + sudo pacman -Syu --noconfirm + {{- else }} + pacman -Syu --noconfirm + {{- end}} + + ## Install packages + for package in ${packages[@]}; do + if [ "$(yay -Qq $package 2> /dev/null)" != $package ]; then + echo "installing packages" + + {{- if ne .chezmoi.username "root" }} + sudo yay -S --noconfirm $package + {{- else }} + yay -S --noconfirm $package + {{- end }} + fi + done + +{{ else if (eq .chezmoi.osRelease.id "debian" "ubuntu") -}} + + export DEBIAN_FRONTEND=noninteractive + + ## Update system + {{- if ne .chezmoi.username "root" }} + sudo -E apt update + sudo -E apt upgrade --yes + {{- else }} + apt update + apt upgrade --yes + {{- end}} + + ## Install packages + packages=(${packages[@]//go/golang}) + packages=(${packages[@]//python/python3}) + packages=(${packages[@]//neovim/}) + + for package in ${packages[@]}; do + echo "installing ${package}..." + + {{- if ne .chezmoi.username "root" }} + sudo -E apt-get install --yes --no-install-recommends --ignore-missing $package + {{- else }} + apt-get install --yes --no-install-recommends --ignore-missing $package + {{- end }} + done + + mist install neovim + +{{- end }} + +LV_BRANCH='release-1.3/neovim-0.9' bash <(curl -s 'https://raw.githubusercontent.com/LunarVim/LunarVim/release-1.3/neovim-0.9/utils/installer/install.sh') + +echo -e "\033[0;32m>>>>> Finish LVim installation <<<<<\033[0m" diff --git a/home/.chezmoiscripts/run_onchange_after_10-install-packages-base.sh.tmpl b/home/.chezmoiscripts/run_onchange_after_10-install-packages-base.sh.tmpl new file mode 100644 index 0000000..6567759 --- /dev/null +++ b/home/.chezmoiscripts/run_onchange_after_10-install-packages-base.sh.tmpl @@ -0,0 +1,84 @@ +#!/usr/bin/env bash + +set -euxo pipefail + +{{ if (eq .chezmoi.osRelease.id "manjaro" "arch") -}} + + echo -e "\033[0;32m>>>>> Begin Arch/Manjaro Linux packages installation <<<<<\033[0m" + + ## Update system + {{- if ne .chezmoi.username "root" }} + sudo pacman -Syu --noconfirm + {{- else }} + pacman -Syu --noconfirm + {{- end}} + + ## Install yay + if [ ! $(command -v yay) ]; then + echo "installing yay" + + {{ range .packages_base.archlinux.pacman -}} + {{- if ne .chezmoi.username "root" }} + sudo pacman -S --needed --noconfirm {{ . | quote }} + {{- else}} + pacman -S --needed --noconfirm {{ . | quote }} + {{- end }} + {{ end -}} + + git clone https://aur.archlinux.org/yay.git /tmp/yay + cd /tmp/yay + makepkg -si --noconfirm + rm -rf /tmp/yay + fi + + ## Install packages + {{ range .packages_base.archlinux.yay -}} + echo "installing {{ . | quote }}..." + yay -S --needed --noconfirm {{ . | quote }} + {{ end -}} + + echo -e "\033[0;32m>>>>> Finish Arch/Manjaro Linux packages installation <<<<<\033[0m" + +{{ else if (eq .chezmoi.osRelease.id "debian" "ubuntu") -}} + + echo -e "\033[0;32m>>>>> Begin Debian/Ubuntu Linux packages installation <<<<<\033[0m" + + export DEBIAN_FRONTEND=noninteractive + + ## Add repositories and update system + {{- if ne .chezmoi.username "root" }} + sudo -E apt-get install --yes --no-install-recommends --ignore-missing lsb-release gpg + curl -fsSL 'https://proget.makedeb.org/debian-feeds/makedeb.pub' | gpg --dearmor | sudo tee /usr/share/keyrings/makedeb-archive-keyring.gpg 1> /dev/null + echo 'deb [signed-by=/usr/share/keyrings/makedeb-archive-keyring.gpg arch=all] https://proget.makedeb.org/ makedeb main' | sudo tee /etc/apt/sources.list.d/makedeb.list + curl -fsSL 'https://proget.makedeb.org/debian-feeds/prebuilt-mpr.pub' | gpg --dearmor | sudo tee /usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg 1> /dev/null + echo "deb [arch=all,$(dpkg --print-architecture) signed-by=/usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg] https://proget.makedeb.org prebuilt-mpr $(lsb_release -cs)" | sudo tee /etc/apt/sources.list.d/prebuilt-mpr.list + sudo -E apt update + sudo -E apt upgrade --yes + sudo -E apt-get install --yes --no-install-recommends --ignore-missing mist + {{- else }} + apt-get install --yes --no-install-recommends --ignore-missing lsb-release gpg + curl -fsSL 'https://proget.makedeb.org/debian-feeds/makedeb.pub' | gpg --dearmor | tee /usr/share/keyrings/makedeb-archive-keyring.gpg 1> /dev/null + echo 'deb [signed-by=/usr/share/keyrings/makedeb-archive-keyring.gpg arch=all] https://proget.makedeb.org/ makedeb main' | tee /etc/apt/sources.list.d/makedeb.list + curl -fsSL 'https://proget.makedeb.org/debian-feeds/prebuilt-mpr.pub' | gpg --dearmor | tee /usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg 1> /dev/null + echo "deb [arch=all,$(dpkg --print-architecture) signed-by=/usr/share/keyrings/prebuilt-mpr-archive-keyring.gpg] https://proget.makedeb.org prebuilt-mpr $(lsb_release -cs)" | tee /etc/apt/sources.list.d/prebuilt-mpr.list + apt update + apt upgrade --yes + apt-get install --yes --no-install-recommends --ignore-missing mist + {{- end}} + + mist update + + ## Install packages + {{ range .packages_base.debian.apt -}} + echo "installing {{ . | quote }}..." + {{- if ne .chezmoi.username "root" }} + sudo -E apt-get install --yes --no-install-recommends --ignore-missing {{ . | quote }} + {{- else}} + apt-get install --yes --no-install-recommends --ignore-missing {{ . | quote }} + {{- end }} + {{ end -}} + + echo -e "\033[0;32m>>>>> Finish Debian/Ubuntu Linux packages installation <<<<<\033[0m" + +{{- end }} + diff --git a/home/.chezmoiscripts/run_onchange_after_20-install-shell.sh.tmpl b/home/.chezmoiscripts/run_onchange_after_20-install-shell.sh.tmpl new file mode 100644 index 0000000..6cf37a6 --- /dev/null +++ b/home/.chezmoiscripts/run_onchange_after_20-install-shell.sh.tmpl @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +set -euxo pipefail + +ZIMDIR=${HOME}/.zim + +echo -e "\033[0;32m>>>>> Begin Zsh installation <<<<<\033[0m" + +{{ if (eq .chezmoi.osRelease.id "manjaro" "arch") -}} + + ## Install packages + {{ range .packages_shell.archlinux.yay -}} + echo "installing {{ . | quote }}..." + yay -S --needed --noconfirm {{ . | quote }} + {{ end -}} + +{{ else if (eq .chezmoi.osRelease.id "debian" "ubuntu") -}} + + ## Install packages + {{ range .packages_shell.debian.mist -}} + {{- if ne .chezmoi.username "root" }} + sudo -E apt-get install --yes --no-install-recommends --ignore-missing {{ . | quote }} + {{- else}} + apt-get install --yes --no-install-recommends --ignore-missing + {{- end }} + {{ end -}} + +{{- end }} + +echo -e "\033[0;32m>>>>> Installing Zim Framework <<<<<\033[0m" +$(which zsh) -c "source ${ZIMDIR}/zimfw.zsh init -q" +echo -e "\033[0;32m>>>>> Finish Zim Framework <<<<<\033[0m" + +echo -e "\033[0;32m>>>>> Finish zsh installation <<<<<\033[0m" + diff --git a/home/.chezmoiscripts/run_onchange_after_80-install-lvim.sh.tmpl b/home/.chezmoiscripts/run_onchange_after_80-install-lvim.sh.tmpl index c6be24a..3ce8253 100644 --- a/home/.chezmoiscripts/run_onchange_after_80-install-lvim.sh.tmpl +++ b/home/.chezmoiscripts/run_onchange_after_80-install-lvim.sh.tmpl @@ -2,69 +2,34 @@ set -euxo pipefail -packages=( - cargo - go - neovim - npm - python-pip - python-pynvim - ripgrep -) - echo -e "\033[0;32m>>>>> Begin LVim installation <<<<<\033[0m" {{ if (eq .chezmoi.osRelease.id "manjaro" "arch") -}} - ## Update system - {{- if ne .chezmoi.username "root" }} - sudo pacman -Syu --noconfirm - {{- else }} - pacman -Syu --noconfirm - {{- end}} - ## Install packages - for package in ${packages[@]}; do - if [ "$(yay -Qq $package 2> /dev/null)" != $package ]; then - echo "installing packages" - - {{- if ne .chezmoi.username "root" }} - sudo yay -S --noconfirm $package - {{- else }} - yay -S --noconfirm $package - {{- end }} - fi - done + {{ range .packages_lvim.archlinux.yay -}} + echo "installing {{ . | quote }}..." + yay -S --needed --noconfirm {{ . | quote }} + {{ end -}} {{ else if (eq .chezmoi.osRelease.id "debian" "ubuntu") -}} export DEBIAN_FRONTEND=noninteractive - ## Update system - {{- if ne .chezmoi.username "root" }} - sudo -E apt update - sudo -E apt upgrade --yes - {{- else }} - apt update - apt upgrade --yes - {{- end}} - ## Install packages - packages=(${packages[@]//go/golang}) - packages=(${packages[@]//python/python3}) - packages=(${packages[@]//neovim/}) - - for package in ${packages[@]}; do - echo "installing ${package}..." - + {{ range .packages_base.debian.apt -}} + echo "installing {{ . | quote }}..." {{- if ne .chezmoi.username "root" }} - sudo -E apt-get install --yes --no-install-recommends --ignore-missing $package - {{- else }} - apt-get install --yes --no-install-recommends --ignore-missing $package + sudo -E apt-get install --yes --no-install-recommends --ignore-missing {{ . | quote }} + {{- else}} + apt-get install --yes --no-install-recommends --ignore-missing {{ . | quote }} {{- end }} - done + {{ end -}} - mist install neovim + {{ range .packages_base.debian.mist -}} + echo "installing {{ . | quote }}..." + apt-get install --yes --no-install-recommends --ignore-missing {{ . | quote }} + {{ end -}} {{- end }}