feat: mac install support

This commit is contained in:
2024-03-07 19:33:24 +00:00
parent c0ce6ea961
commit e6a7bec30d
14 changed files with 144 additions and 97 deletions

View File

@@ -1,15 +0,0 @@
build-essential
libssl-dev
libbz2-dev
libreadline-dev
libsqlite3-dev
libxml2-dev
libxmlsec1-dev
llvm
libncurses5-dev
libncursesw5-dev
xz-utils
tk-dev
libffi-dev
liblzma-dev
zlib1g-dev

View File

@@ -5,18 +5,35 @@
# Configure pyenv.
#
if ! bin_in_path "pyenv"; then
if ! command -v "pyenv" &> /dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
# see https://github.com/pyenv/pyenv/wiki/common-build-problems
pyenv_list_file="$INSTALL_DIR/10-pyenv-pkglist"
install_file "$pyenv_list_file"
ppyenv_packages=(
build-essential
libssl-dev
libbz2-dev
libreadline-dev
libsqlite3-dev
libxml2-dev
libxmlsec1-dev
llvm
libncurses5-dev
libncursesw5-dev
xz-utils
tk-dev
libffi-dev
liblzma-dev
zlib1g-dev
)
pyenv_packages=($(comm -13 <(printf "%s\n" "${pyenv_packages[@]}" | sort) <(dpkg --get-selections | awk '{print $1}' | sort)))
if [ ${#pyenv_packages[@]} -gt 0 ]; then
sudo apt-get install -qq "${pyenv_packages[@]}"
fi
# see https://github.com/pyenv/pyenv-installer
download_run \
"https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer" \
bash
e
unset pyenv_list_file
bash -c "$(curl -fsSL https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer)"
unset pyenv_packages
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install pyenv
brew install pyenv-virtualenv
@@ -30,10 +47,9 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
https://github.com/pyenv/pyenv-virtualenv.git \
$virtualenv_path
fi
unset virtualenv_path
fi
eval "$(pyenv init --path)"
pyenv update
pyenv --version

View File

@@ -7,16 +7,49 @@
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
if ! bin_in_path "pip3"; then
pyenv install 3.9.0
pyenv global 3.9.0
if ! command -v "pip3" &>/dev/null; then
pyenv install 3.12.1
pyenv global 3.12.1
fi
pip install --upgrade pip
pip3 install --upgrade pip
pip install --quiet --upgrade --user pip
pip3 install --quiet --upgrade --user pip
python3 --version
pip3 --version
for dep in $(jq -r ".pip_dependencies[]" $CONFIG); do
pip3 install --upgrade $dep
done
pip_dependencies=(
# docker-compose
# neovim
# "python-language-server[all]"
# pyvim
)
installed_packages=$(pip3 list --format=freeze | awk -F'==' '{print $1}')
pip_dependencies=($(comm -13 <(printf "%s\n" "${installed_packages[@]}" | sort) <(printf "%s\n" "${pip_dependencies[@]}" | sort)))
if [ ${#pip_dependencies[@]} -gt 0 ]; then
pip3 install --quiet --upgrade --user "${pip_dependencies[@]}"
fi
unset installed_packages pip_dependencies PYTHON_KEYRING_BACKEND
if ! command -v "pipx" &>/dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo apt-get install -qq pipx
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install pipx
fi
fi
echo "pipx $(pipx --version)"
if ! command -v "poetry" &>/dev/null; then
pipx install poetry
fi
poetry --version
POETRY_PLUGIN="$ZSH/custom/plugins/poetry"
if [ ! -d "$POETRY_PLUGIN" ]; then
mkdir -p $POETRY_PLUGIN
poetry completions zsh > $POETRY_PLUGIN/_poetry
fi

View File

@@ -5,29 +5,35 @@
# Configure Node.js.
#
nvm_version="0.39.7"
if ! bin_in_path "nvm"; then
download_run "https://raw.githubusercontent.com/nvm-sh/nvm/v${nvm_version}/install.sh" \
"bash"
fi
NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh"
nvm_version="0.39.7"
if ! command -v "nvm" &>/dev/null; then
bash -c "$(curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v${nvm_version}/install.sh)"
[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh"
fi
nvm --version
nvm alias default lts/iron
nvm install lts/iron
nvm use lts/iron
node --version
echo "Node.js $(node --version)"
yarn --version
echo "npm $(npm --version)"
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
for dep in $(jq -r ".node_dependencies[]" $CONFIG); do
yarn global add $dep
yarn global upgrade $dep
done
npm_dependencies=(
"firebase-tools"
"neovim"
"typescript-language-server"
"typescript"
)
npm_dependencies=($(comm -13 <(printf "%s\n" "${npm_dependencies[@]}" | sort) <(npm list -g --depth=0 --parseable | awk -F'/' '{print $NF}' | sort)))
if [ ${#npm_dependencies[@]} -gt 0 ]; then
npm install -g "${npm_dependencies[@]}"
fi
unset nvm_version
unset nvm_version npm_dependencies

View File

@@ -1,4 +1,4 @@
# /bin/bash
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:

View File

@@ -0,0 +1,15 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# Install terraform.
#
if ! command -v "terraform" &>/dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo apt-get install -qq terraform
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew tap hashicorp/tap
brew install hashicorp/tap/terraform
fi
fi

View File

@@ -6,7 +6,7 @@
#
if [[ "$OSTYPE" == "darwin"* ]]; then
if ! command -v iterm2 &> /dev/null; then
if ! brew list --cask iterm2 &>/dev/null; then
brew install --cask iterm2
fi
fi

View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Description:
# Install neofetch.
#
if ! command -v "neofetch" &>/dev/null; then
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo apt-get install -qq neofetch
elif [[ "$OSTYPE" == "darwin"* ]]; then
brew install neofetch
fi
fi

View File

@@ -5,4 +5,4 @@
# Print system information.
#
screenfetch
neofetch