#!/usr/bin/env sh

set -ex

_fail() {
    echo "$@" >&2
    exit 1
}
 
# Provision seatd + sway
pacman -S --noconfirm xorg xorg-server gnome gnome-extra || _fail "Could not provision desktop packages"

systemctl enable gdm.service || _fail "Could not enable the greeter"

## Provision tools
pacman -S --noconfirm git bind which tree ripgrep base-devel pulseaudio pavucontrol evince chromium 1password 1password-cli gnome-tweaks firefox

# Replace emacs-nox with normal emacs
pacman -R --noconfirm --unneeded emacs-nox
pacman -S --noconfirm emacs

## Provision conf
# FIXME: Get this token outa here
su - arrdem <<EOF
git clone https://arrdem:59642f9163e0a05f0d3755d84e0002949b5ee8a4@git.arrdem.com/arrdem/dotfiles.git conf
cd conf
# ./cram apply --execute
mkdir -p ~/.local
git clone https://github.com/paperwm/PaperWM.git ~/.local/paperwm
cd ~/.local/paperwm
./install
gnome-extensions enable paperwm@paperwm.github.com
EOF
