initenv/setup.sh

112 lines
3.6 KiB
Bash
Raw Normal View History

#!/bin/sh
set -e
START_DIR=$(pwd)
INITENV_DIR=$(dirname "$0")
ARCH=$(uname -m)
if [ "$ARCH" = "x86_64" ]; then
ARCH_GO="amd64"
fi
if [ "$ARCH" = "aarch64" ]; then
ARCH_GO="arm64"
fi
setup_configs() {
mkdir -p $HOME/.config
mkdir -p $HOME/.ssh
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDtHnwPdfiqbqK+kh9DrVpNfPLuukBFvPbaZNhH1Ih59m0NxpiqMnfUeKTvBz9tHixcGCZ59jj8Lhy6egB5SXQBm2YUadfQKk5hNPJaRuBLP2Vj35PO6E6HZfx3brPumdDCqL35G1I/8KSryQF5q7u+VSKVkjQCA5Cdaz8IOtU9kfyzRPUYXIxvSlCVFjuviBVerjBopa9HwrzhYq5PTftmyuWOiV8nzxhlcAju2Xe8yvZJcyusFABmjNimY366pQYAaXX2Uxi4nP4C8WL+axYliLV/FxAZSpk51LP9cfQkHGV7jEZQzf/M02DPlo7NR7VRULaJlWaVYulT/LbuQecpr+KimaB62GkWbjX5tG/dc3RsL0yz+UcrYD2bYd0PZpakIvnwQOaMxrJYyWOZrTsw7X/lBWNb1M62xN828pZ3PfqGkWGzVaH09Jb24U4yHyYrfAU/RKiHnvVyw2ISl3SCz20fhiIGOV7lhDtTyVOLau16AluQDz0U3fcYV2Eipa4euOf7sShoFsJg8N5R9EG0ZvmQathEN856ViaJZE3SIkvyQ5epngrc1IdZPGH/4fQabywgiEa0vk6ZDW7RuvZXztpHDWZpmd7zXL98vSplvEYuT1VFk9DwAIcbGIK2Xwfedt1GDsCsdGY+eZ0LZMCDAa0DPTydjic7/6xVl78iYQ== emilisbliudzius@gmail.com" >$HOME/.ssh/authorized_keys
}
setup_Xorg() {
mkdir -p $HOME/.config/herbstluftwm/
cp $INITENV_DIR/Xorg/autostart $HOME/.config/herbstluftwm/
cp $INITENV_DIR/Xorg/.xinitrc $HOME/
}
setup_fishe() {
cp -r $INITENV_DIR/fish $HOME/.config/
}
setup_golang() {
mkdir $INITENV_DIR/go-tmp
cd $INITENV_DIR/go-tmp
GO_VERSION=$(curl https://go.dev/VERSION\?m=text)
GO_ARCHIVE="$GO_VERSION.linux-$ARCH_GO.tar.gz"
wget "https://dl.google.com/go/$GO_ARCHIVE"
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf $GO_ARCHIVE
rm $GO_ARCHIVE
cd $START_DIR
}
setup_rust() {
wget https://sh.rustup.rs -O $INITENV_DIR/rustup.sh
chmod +x $INITENV_DIR/rustup.sh
sh $INITENV_DIR/rustup.sh -yq
rm $INITENV_DIR/rustup.sh
}
setup_pkgs() {
if [ ! -f "/etc/arch-release" ]; then
echo "Not on arch, skipping installing packages"
return
fi
setup_aur
yay --noconfirm -S ttf-twemoji-color
sudo pacman -Sy --noconfirm fish bat code vim flameshot herbstluftwm \
kitty xorg-server xorg-xrandr xorg-xinit ttf-dejavu ttf-fira-code ttf-hanazono \
ttf-liberation ttf-liberation ttf-liberation wget man \
inetutils tar xz unzip bemenu-x11 bemenu firefox base-devel pipewire
}
setup_aur() {
sudo pacman --noconfirm -Sy git autoconf
mkdir -p $INITENV_DIR/yay-bin
git clone https://aur.archlinux.org/yay-bin.git $INITENV_DIR/yay-bin
cd $INITENV_DIR/yay-bin
makepkg --noconfirm -si
cd $START_DIR
rm -rf $INITENV_DIR/yay-bin
}
setup_vscode() {
yay --noconfirm -Sy code-marketplace
mkdir -p $HOME/.config/Code\ -\ OSS/User/
cp $INITENV_DIR/vscode/settings.json $HOME/.config/Code\ -\ OSS/User/
cp $INITENV_DIR/vscode/keybindings.json $HOME/.config/Code\ -\ OSS/User/
# Extensions
extensions="golang.Go rust-lang.rust-analyzer vadimcn.vscode-lldb
bungcip.better-toml eamodio.gitlens vscodevim.vim donjayamanne.githistory
ziyasal.vscode-open-in-github"
for ext in $extensions; do
code --install-extension $ext --force
done
# Go tools for vscode
/usr/local/go/bin/go install github.com/cweill/gotests/...@latest
/usr/local/go/bin/go install github.com/fatih/gomodifytags@latest
/usr/local/go/bin/go install github.com/josharian/impl@latest
/usr/local/go/bin/go install github.com/haya14busa/goplay/cmd/goplay@latest
/usr/local/go/bin/go install github.com/go-delve/delve/cmd/dlv@latest
/usr/local/go/bin/go install honnef.co/go/tools/cmd/staticcheck@latest
/usr/local/go/bin/go install golang.org/x/tools/gopls@latest
}
setup_finisher() {
fish $INITENV_DIR/post-install.fish
sudo chsh -s $(which fish) $USER
echo "all done."
fish
}
setup_configs
setup_pkgs
setup_rust
setup_golang
setup_fishe
setup_Xorg
setup_vscode
setup_finisher