dotfiles/tools/env.sh

131 lines
3.3 KiB
Bash
Raw Normal View History

2023-07-05 11:59:24 +03:00
#!/bin/bash
set -e
2023-06-25 15:32:30 +03:00
HW_TARGET=$(uname)/$(uname -m)
2023-01-03 23:38:35 +03:00
2023-06-25 15:32:30 +03:00
case $HW_TARGET in
Darwin/arm64)
2023-07-05 11:59:24 +03:00
echo Platform checked.;;
2023-06-25 15:32:30 +03:00
Darwin/x86_64)
2023-07-05 11:59:24 +03:00
echo Platform checked.;;
2023-06-25 15:32:30 +03:00
Linux/arm64|Linux/aarch64)
2023-07-05 11:59:24 +03:00
echo Platform checked.;;
2023-06-25 15:32:30 +03:00
Linux/x86_64)
2023-07-05 11:59:24 +03:00
echo Platform checked.;;
2023-06-25 15:32:30 +03:00
*)
2023-07-05 11:59:24 +03:00
echo Yo, dude. This script is for Linux/Darwin x64/arm64. Get this system and try one more time
exit 255
2023-06-25 15:32:30 +03:00
esac
2023-07-05 11:59:24 +03:00
if command -v gum >/dev/null; then
TEA_GUM=gum
else
curl https://tea.xyz -o /tmp/tea
2023-07-05 12:13:21 +03:00
TEA_GUM=$(sh /tmp/tea --silent +charm.sh/gum which gum | tail -n 1)
2023-07-05 11:59:24 +03:00
fi
$TEA_GUM format -- <<EoMD
# hi, let's setup env.
> dotfiles picked from github.com:ivabus/dotfiles
## What will be installed by default
* tea
* neovim
* htop
* git
* zsh
## What could be additionally installed
### Compilers/Interpretators
* LLVM
* Rust and Cargo
* Python
### Tools
* GitHub CLI
* make
* automake
* cmake
* meson
* ninja
EoMD
if ! $TEA_GUM confirm "Do you want to continue"; then
exit 1
fi
2023-01-03 19:05:51 +03:00
2023-07-05 12:15:37 +03:00
rm -rf $HOME/.env > /dev/null 2>&1
2023-06-25 15:53:33 +03:00
2023-07-05 11:59:24 +03:00
$TEA_GUM format "Installing env to \`$HOME/.env\`"
2023-06-25 15:53:33 +03:00
mkdir $HOME/.env $HOME/.env/bin > /dev/null 2>&1
2023-01-03 19:05:51 +03:00
2023-06-25 15:53:33 +03:00
TEA_PREFIX=$HOME/.env/tea
TEA=$HOME/.env/tea/tea.xyz/v0/bin/tea
2023-01-03 19:05:51 +03:00
PATH=$PATH
2023-07-05 11:59:24 +03:00
$TEA_GUM format "Installing \`tea\` to \`$TEA_PREFIX\`"
2023-07-05 12:06:59 +03:00
2023-07-05 12:15:37 +03:00
curl https://tea.xyz -o /tmp/tea > /dev/null 2>&1
2023-07-05 12:06:59 +03:00
sh /tmp/tea --yes --prefix $TEA_PREFIX
2023-07-05 11:59:24 +03:00
$TEA_GUM format "Installing \`zsh\`"
$TEA +zsh.sourceforge.io sh -c "exit"
2023-01-03 19:05:51 +03:00
PATH="$HOME/.env/bin:$PATH"
2023-07-05 11:59:24 +03:00
$TEA_GUM format "Installing \`neovim\`"
$TEA +neovim.io sh -c "exit"
$TEA_GUM format "Installing \`htop\`"
$TEA +htop.dev sh -c "exit"
$TEA_GUM format "Installing \`git\`"
$TEA +git-scm.org sh -c "exit"
if $TEA_GUM confirm "Would you like to install compilers/interpretators (LLVM, Rust, Python)?"; then
$TEA_GUM format "Installing \`rust\` and \`cargo\`"
$TEA +rust-lang.org sh -c "exit"
$TEA +rust-lang.org/cargo sh -c "exit"
$TEA_GUM format "Installing \`llvm\`"
$TEA +llvm.org sh -c "exit"
$TEA_GUM format "Installing \`python\`"
$TEA +python.org sh -c "exit"
2023-01-03 19:05:51 +03:00
fi
2023-07-05 11:59:24 +03:00
if $TEA_GUM confirm "Would you like to install development tools (GitHub CLI, make/cmake/meson/ninja)?"; then
$TEA_GUM format "Installing \`gh\`"
$TEA +cli.github.com sh -c "exit"
$TEA_GUM format "Installing \`make\` & \`automake\` & \`cmake\` & \`meson\` & \`ninja\`"
$TEA +gnu.org/make sh -c "exit"
$TEA +gnu.org/automake sh -c "exit"
$TEA +cmake.org sh -c "exit"
$TEA +mesonbuild.com sh -c "exit"
$TEA +ninja-build.org sh -c "exit"
2023-01-03 19:05:51 +03:00
fi
2023-07-05 11:59:24 +03:00
$TEA_GUM format "Configuring \$PATH with installed progs"
2023-01-03 19:05:51 +03:00
for i in "tea" "nvim" "clang" "clang++" "lldb" "rustc" "cargo" "htop" "make" "cmake" "automake" "meson" "ninja" "git" "gh"
do
2023-06-25 15:53:33 +03:00
ln -s $TEA $HOME/.env/bin/$i
2023-01-03 19:05:51 +03:00
done
2023-07-05 12:22:30 +03:00
$TEA_GUM format "Configuring"
$TEA_GUM spin --title "Cloning ivabus/dotfiles" $TEA git clone https://github.com/ivabus/dotfiles $HOME/.env/dotfiles> /dev/null
2023-06-25 16:09:51 +03:00
mkdir -p $HOME/.env/dotfiles/zsh/plugins $HOME/.env/dotfiles/zsh/themes
2023-06-25 16:15:39 +03:00
curl -fsSL https://raw.githubusercontent.com/ivabus/ivabus-zsh-theme/master/ivabus.zsh-theme -o $HOME/.env/dotfiles/zsh/themes/ivabus.zsh-theme > /dev/null 2>&1
2023-07-05 12:22:30 +03:00
$TEA_GUM spin $TEA git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $HOME/.env/dotfiles/zsh/plugins/zsh-syntax-highlighting --title "Cloning zsh-syntax-highlighting"> /dev/null
2023-06-25 15:53:33 +03:00
sh $HOME/.env/dotfiles/tools/link_env.sh
2023-01-03 19:05:51 +03:00
2023-07-05 11:59:24 +03:00
$TEA_GUM format -- <<EoMD
Environment installed to \`$HOME/.env\`
To start environment just type:
2023-07-05 12:02:02 +03:00
\`PATH="\$HOME/.env/bin:\$PATH" zsh\`
2023-07-05 11:59:24 +03:00
EoMD