#!/bin/bash

set -e

if [ "$(id -u)" -eq 0 ]; then echo "Do not run as root." >&2; exit 1; fi

sudo pacman -Syu
sudo pacman --needed -S \
	alacritty \
	base-devel \
	bat \
	bluez \
	bluez-utils \
	brightnessctl \
	curl \
	difftastic \
	dunst \
	dust \
	exa \
	fd \
	fish \
	fuzzel \
	git \
	git-delta \
	grim \
	htop \
	hyprland \
	hyprpaper \
	neovim \
	nerd-fonts \
	noto-fonts \
	noto-fonts-emoji \
	noto-fonts-extra \
	nushell \
	pamixer \
	qt5-wayland \
	qt6-wayland \
	ripgrep \
	rustup \
	sad \
	tig \
	vim \
	waybar \
	wget \
	wl-clipboard \
	zathura

# install nvim packer
git clone --depth 1 https://github.com/wbthomason/packer.nvim \
	~/.local/share/nvim/site/pack/packer/start/packer.nvim \
	|| true # command will fail if packer is already installed

rustup default stable

if ! command -v paru &> /dev/null; then
	echo "`paru` not found, installing..."
	sleep 1

	cd "$(mktemp -d)"
	git clone https://aur.archlinux.org/paru.git
	cd paru
	makepkg -si
fi

paru -S wdisplays eww-wayland

cargo install --locked --git https://git.nubo.sh/hulthe/lockscreen-blur.git
cargo install --locked --git https://git.nubo.sh/hulthe/volume_indicator.git

# cargo binstall
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash

cargo binstall cargo-watch
cargo binstall cargo-get
