Files
.dotfiles/install.sh

330 lines
7.4 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
DOTSDIR=$(pwd)
#########################
## gum style variables ##
#########################
# GUM_SPIN_SPINNER="minidot"
# GUM_SPIN_SHOW_OUTPUT="true"
sudo -v || exit 1
####################
## Installing gum ##
####################
if ! command -v gum &>/dev/null; then
echo "Installing gum"
sudo pacman -S --needed --noconfirm gum
fi
###################################
## Installing yay & dependencies ##
###################################
if ! command -v yay &>/dev/null; then
sudo -v || exit 1
# gum spin --title "Installing yay dependencies" -- \
sudo pacman -S base-devel git --needed --noconfirm
TEMP_DIR=$(mktemp -d)
# gum spin --title "Cloning yay-bin from AUR" -- \
git clone https://aur.archlinux.org/yay-bin.git "$TEMP_DIR"/yay
cd "$TEMP_DIR"/yay
sudo -v || exit 1
# gum spin --title "Installing yay" -- \
makepkg -si --noconfirm
fi
cd "$DOTSDIR"
#############################
## Configuration Selection ##
#############################
mapfile -t desktop < <(
gum choose --header="Choose desktop configuration:" \
"Niri" \
"KDE Plasma" \
"None"
)
mapfile -t tools < <(
gum choose --header="Choose tools to install:" --no-limit \
"Terminal" \
"Terminal Emulator" \
"Gaming" \
"VR Gaming" \
"Hamr Sticker Picker" \
"CUPS Printing Support" \
"Audio" \
"Bluetooth"
)
mapfile -t extratools < <(
gum choose --header="Choose extra tools to install:" --no-limit \
"Godot" \
"Btop" \
"Fuzzel" \
"Ncdu" \
"Linja Pona [Font]" \
"Vesktop" \
"Nextcloud" \
"Zen Browser" \
"Tailscale" \
"Global git config" \
"MPV"
)
#####################
## Installing stow ##
#####################
sudo -v || exit 1
# gum spin --title "Installing GNU Stow" -- \
yay -S --needed --noconfirm stow
######################
## Applying configs ##
######################
for choice in "${desktop[@]}"; do
case "$choice" in
"Niri")
sudo -v || exit 1
# gum spin --title "Installing niri alongside required packages" -- \
yay -S --needed --noconfirm \
niri \
nautilus \
gnome-keyring \
brightnessctl \
cava \
candy-icons-git \
power-profiles-daemon \
qt6ct-kde \
xdg-desktop-portal-gnome \
xdg-desktop-portal-gtk \
xdg-desktop-portal-wlr \
quickshell \
cava \
cliphist \
wl-clipboard \
dgop \
matugen-bin \
qt6-multimedia \
dms-shell-bin \
xwayland-satellite \
ly \
noto-fonts-emoji
# greetd-dms-greeter-git
stow niri qt6ct --adopt
xdg-mime default org.gnome.nautilus.desktop inode/directory
mkdir -p "$HOME"/.config/environment.d
echo "QT_QPA_PLATFORMTHEME=qt6ct" >>"$HOME"/.config/environment.d/90-qt.conf
systemctl --user daemon-reload
systemctl --user enable dms
systemctl --user add-wants niri.service dms
systemctl --user add-wants niri.service gnome-keyring-daemon.service
# dms greeter enable
# dms greeter sync
sudo systemctl enable ly@tty1
;;
"KDE Plasma")
sudo -v || exit 1
# gum spin --title "Installing KDE Plasma" -- \
pacman -S --needed --noconfirm plasma kde-applications
sudo systemctl enable sddm
;;
esac
done
for choice in "${tools[@]}"; do
case "$choice" in
"Terminal")
sudo -v || exit 1
# gum spin --title "Installing Terminal packages..." -- \
yay -S --needed --noconfirm \
fastfetch \
hyfetch \
neovim \
zsh \
eza \
fzf \
tealdeer \
ttf-sourcecodepro-nerd \
vim \
wl-clipboard \
zoxide \
reflector \
inetutils \
imagemagick \
tree
# sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone https://github.com/ohmyzsh/ohmyzsh "$HOME"/.oh-my-zsh
stow fastfetch hyfetch nvim zsh --adopt
# gum spin --title "Updating Tealdeer database" -- \
tldr --update
chsh -s /bin/zsh "$USER"
;;
"Terminal Emulator")
sudo -v || exit 1
# gum spin --title "Installing Terminal Emulator..." -- \
yay -S --needed --noconfirm \
ghostty
stow ghostty --adopt
;;
"Gaming")
sudo -v || exit 1
# gum spin --title "Installing Gaming Packages..." -- \
yay -S --needed --noconfirm \
mangohud \
gamemode \
steam \
prismlauncher \
heroic-games-launcher-bin \
arrpc \
umu-launcher \
wine \
protontricks \
protonup-qt \
goverlay \
vkbasalt \
vulkan-tools
stow mangohud --adopt
sudo -v || exit 1
# gum spin --spinner minidot --title "Applying arrpy systemd fix..." -- \
sudo cp /usr/lib/systemd/user/arrpc.service /etc/systemd/system/arrpc.service
sudo systemctl enable arrpc --now
;;
"VR Gaming")
sudo -v || exit 1
# gum spin --title "Installing VR Gaming Packages..." -- \
yay -S --needed --noconfirm \
alvr-launcher-bin \
wlx-overlay-s-bin
;;
"Hamr Sticker Picker")
sudo -v || exit 1
# gum spin --title "Installing hamr..." -- \
yay -S --needed --noconfirm \
hamr
stow hamr-sticker-picker --adopt
systemctl --user enable hamr.service
systemctl --user add-wants niri.service hamr.service
systemctl --user start hamr.service
;;
"CUPS Printing Support")
sudo -v || exit 1
yay -S --needed --noconfirm \
cups
sudo systemctl enable cups
;;
"Audio")
sudo -v || exit 1
yay -S --needed --noconfirm \
pipewire \
pipewire-pulse \
wireplumber
systemctl --user enable --now pipewire pipewire-pulse wireplumber
;;
"Bluetooth")
sudo -v || exit 1
yay -S --needed --noconfirm \
bluez
sudo systemctl enable bluetooth --now
;;
esac
done
extrapkgs=()
for choice in "${extratools[@]}"; do
case "$choice" in
"Godot")
extrapkgs+=("godots-bin")
stow godot --adopt
;;
"Fuzzel")
extrapkgs+=("fuzzel")
stow fuzzel --adopt
;;
"Btop") extrapkgs+=("btop") ;;
"Ncdu") extrapkgs+=("ncdu") ;;
"Linja Pona [Font]") extrapkgs+=("otf-linja-pona") ;;
"Vesktop") extrapkgs+=("vesktop") ;;
"Nextcloud") extrapkgs+=("nextcloud-client") ;;
"Zen Browser") extrapkgs+=("zen-browser-bin") ;;
"Tailscale") extrapkgs+=("tailscale") ;;
"Global git config")
git config --global init.defaultBranch main
if [ "$USER" = "vivian" ]; then
echo "-=[ WARNING ]=-"
echo "Because your username equals \"vivian\", your git user.name and user.email will be set to mine, please revert this change if you are not me."
echo "Your old values will be written to ~/.dots-gitbackup"
{
echo "user.name"
git config --global user.name
echo ""
echo "user.email"
git config --global user.email
} >"$HOME"/.dots-gitbackup
git remote remove origin
git remote add origin ssh://git@gitea.sparkle.gay:9173/vivian/.dotfiles.git
git config --global user.name "Vivian Elisabeth H"
git config --global user.email "36878099+SparkleDEV@users.noreply.github.com"
fi
;;
"MPV")
extrapkgs+=("mpv" "yt-dlp")
stow mpv --adopt
;;
esac
done
extpkgstr=$(
IFS=" "
echo "${extrapkgs[*]}"
)
sudo -v || exit 1
yay -S --needed --noconfirm $extpkgstr
git add .
git reset --hard HEAD
git submodule update --recursive --init
echo "-=[ DOTFILES INSTALLED ]=-"
echo "You propably want to reboot"