######################################## nvim
sudo apt install zig -y
snap install nvim --classic
sudo apt install xsel xclip wl-clipboard
sudo apt install ripgrep -y
sudo apt install zlib1g zlib1g-dev -y

sudo cp ../../sesh /usr/bin
cp ../tmux.conf ~/.tmux.conf

######################################## Homebrew and ASDF
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)"
test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >>~/.bashrc
source ~/.bashrc
sudo apt-get install build-essential

brew install asdf
echo -e "\n. \"$(brew --prefix asdf)/libexec/asdf.sh\"" >>~/.bashrc
echo -e "\n. \"$(brew --prefix asdf)/etc/bash_completion.d/asdf.bash\"" >>~/.bashrc

asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git
asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git

######################################## Languages
asdf install nodejs latest
asdf install ruby latest
gem install solargraph
sudo snap install go --classic
# sudo apt install ruby -y
# sudo apt install ruby-dev -y

######################################## Lazygit
sudo add-apt-repository ppa:lazygit-team/release -y
sudo apt update

LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[^"]*')
curl -Lo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz"
tar xf lazygit.tar.gz lazygit
sudo install lazygit /usr/local/bin

# sudo apt install alacritty -y
sudo flatpak install org.wezfurlong.wezterm -y
echo 'alias wezterm="flatpak run org.wezfurlong.wezterm"' >>~/.bashrc

sudo apt install software-properties-common
sudo apt install tmux -y

######################################## Zed
sh ./zed.sh &
######################################## VSCode
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EB3E94ADBE1229CF
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
sudo apt update
sudo apt install code -y

######################################## nerd fonts
sudo apt install wget fontconfig &&
  wget -P ~/.local/share/fonts https://github.com/ryanoasis/nerd-fonts/releases/latest/download/Meslo.zip &&
  cd ~/.local/share/fonts && unzip Meslo.zip && rm *Windows* && rm Meslo.zip && fc-cache -fv
######
######################################## Docker
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" |
  sudo tee /etc/apt/sources.list.d/docker.list >/dev/null
sudo apt-get update

######################################## Hosting
npm install -g @railway/cli
npm install -g vercel
npm install -g vercel@latest

######################################## Configs
cd ~/.config/

git config --global user.email "noisycarlos@hey.com"
git config --global user.name "Carlos Aldana"

git config --global credential.helper store
git clone https://git.noisyserver.sbs/noisycarlos/nvim
git clone https://git.noisyserver.sbs/noisycarlos/wezterm

rm -r lazygit
git clone https://git.noisyserver.sbs/noisycarlos/lazygit
# git clone https://git.noisyserver.sbs/tmux-plugins/tpm ~/.tmux/plugins/tpm
