mirror of https://github.com/mitchell/dotfiles.git
244 lines
5.7 KiB
Fish
Executable File
244 lines
5.7 KiB
Fish
Executable File
#!/usr/bin/env fish
|
|
|
|
### Config ###
|
|
|
|
set -g cmd_func_prefix 'provision'
|
|
|
|
if test -z "$distro"
|
|
set -g distro 'arch'
|
|
end
|
|
|
|
|
|
### Commands ###
|
|
# Add, edit, and remove commands freely below.
|
|
# To add a command simply create a function with this naming scheme: {run_func_prefix}_{name}.
|
|
|
|
function provision_default -d 'Provisioning terminal, desktop, and m-net'
|
|
provision_terminal_env
|
|
and provision_desktop_env
|
|
and provision_m_net
|
|
end
|
|
|
|
function provision_terminal_env -d 'Install base terminal utilities and sync configurations'
|
|
if test $distro = arch
|
|
log 'Installing pikaur from AUR'
|
|
|
|
install_pkgs --needed base-devel
|
|
|
|
set -l cwd (pwd)
|
|
set -l tmp_dir (mktemp --directory)
|
|
|
|
git clone https://aur.archlinux.org/pikaur.git $tmp_dir
|
|
and cd $tmp_dir
|
|
and makepkg --clean --install --rmdeps --syncdeps --noconfirm
|
|
|
|
cd $cwd
|
|
rm -rf $tmp_dir
|
|
end
|
|
|
|
if test $distro = debian
|
|
log 'Adding fish apt repo'
|
|
|
|
install_pkgs gpg
|
|
|
|
echo 'deb http://download.opensuse.org/repositories/shells:/fish:/release:/3/Debian_10/ /' |
|
|
sudo tee /etc/apt/sources.list.d/shells:fish:release:3.list
|
|
|
|
curl -fsSL https://download.opensuse.org/repositories/shells:fish:release:3/Debian_10/Release.key |
|
|
gpg --dearmor |
|
|
sudo tee /etc/apt/trusted.gpg.d/shells_fish_release_3.gpg >/dev/null
|
|
end
|
|
|
|
set -l base_pkgs \
|
|
fish \
|
|
git \
|
|
neovim \
|
|
tmux \
|
|
rsync \
|
|
curl \
|
|
kitty-terminfo \
|
|
fzf \
|
|
|
|
set -l arch_pkgs \
|
|
$base_pkgs \
|
|
python-neovim \
|
|
the_silver_searcher \
|
|
bat
|
|
|
|
set -l debian_pkgs \
|
|
$base_pkgs \
|
|
silversearcher-ag
|
|
|
|
log 'Installing base terminal utilities'
|
|
install_pkgs
|
|
or return $status
|
|
|
|
log 'Setting m\'s default shell to fish'
|
|
sudo chsh -s /usr/bin/fish m
|
|
|
|
log 'Running sync script'
|
|
./sync --desktop
|
|
|
|
log 'Installing asdf-vm'
|
|
git clone https://github.com/asdf-vm/asdf.git ~/.asdf
|
|
and cd ~/.asdf
|
|
and git checkout (git describe --abbrev=0 --tags)
|
|
end
|
|
|
|
function provision_desktop_env -d 'Install base desktop utilities and configure theme'
|
|
set -l base_pkgs \
|
|
xclip \
|
|
bspwm \
|
|
sxhkd \
|
|
picom \
|
|
feh \
|
|
rofi \
|
|
kitty \
|
|
qutebrowser \
|
|
wget \
|
|
unzip
|
|
|
|
set -l arch_pkgs \
|
|
$base_pkgs \
|
|
xorg-server \
|
|
xorg-xinit \
|
|
ttf-ibm-plex \
|
|
ttf-jetbrains-mono \
|
|
pavucontrol \
|
|
pulseaudio \
|
|
wmname \
|
|
polybar
|
|
|
|
set -l debian_pkgs \
|
|
$base_pkgs \
|
|
xinit \
|
|
fonts-ibm-plex \
|
|
suckless-tools \
|
|
polybar
|
|
|
|
log 'Installing base desktop environment utilities'
|
|
install_pkgs
|
|
or return $status
|
|
|
|
log 'Setting xinitrc'
|
|
echo 'exec bspwm' >~/.xinitrc
|
|
|
|
log 'Installing arc-gruvbox theme'
|
|
mkdir -p ~/.themes
|
|
xzcat ./oomox-arc-gruvbox.tar.xz | tar --extract --directory=$HOME/.themes
|
|
|
|
if test $distro = debian
|
|
log 'Installing JetBrains Mono font manually'
|
|
|
|
set -l cwd (pwd)
|
|
set -l tmp_dir (mktemp --directory)
|
|
|
|
cd $tmp_dir
|
|
|
|
wget -q https://github.com/JetBrains/JetBrainsMono/releases/download/v2.002/JetBrainsMono-2.002.zip
|
|
and unzip -q JetBrainsMono-2.002.zip
|
|
and mkdir -p ~/.local/share/fonts/truetype/JetBrainsMono
|
|
and cp ./ttf/*.ttf ~/.local/share/fonts/truetype/JetBrainsMono/
|
|
|
|
cd $cwd
|
|
rm -r $tmp_dir
|
|
end
|
|
|
|
log 'Setting gtk theme'
|
|
mkdir ~/.config/gtk-3.0
|
|
echo "
|
|
[Settings]
|
|
gtk-icon-theme-name = Adwaita
|
|
gtk-theme-name = oomox-arc-gruvbox
|
|
gtk-font-name = IBM Plex Sans 11" >~/.config/gtk-3.0/settings.ini
|
|
end
|
|
|
|
function provision_m_net -d 'Install syncthing and keepassxc'
|
|
log 'Installing m-net utilities'
|
|
install_pkgs \
|
|
keepassxc \
|
|
syncthing
|
|
or return $status
|
|
|
|
log 'Enabling syncthing service'
|
|
sudo systemctl enable syncthing@m.service
|
|
end
|
|
|
|
function provision_libvirt -d 'Provision libvirt and virt-manager'
|
|
log 'Installing libvirt, qemu, and virt-manager'
|
|
install_libvirt
|
|
end
|
|
|
|
function provision_vagrant -d 'Provision vagrant with libvirt'
|
|
install_libvirt
|
|
or return $status
|
|
|
|
log 'Installing vagrant and libvirt plugin'
|
|
set -l arch_pkgs vagrant
|
|
set -l debian_pkgs vagrant-libvirt
|
|
|
|
install_pkgs
|
|
or return $status
|
|
|
|
vagrant plugin install vagrant-libvirt
|
|
end
|
|
|
|
function install_libvirt
|
|
set -l base_pkgs \
|
|
virt-manager
|
|
|
|
set -l arch_pkgs \
|
|
$base_pkgs \
|
|
libvirt \
|
|
qemu \
|
|
dnsmasq \
|
|
ebtables
|
|
|
|
set -l debian_pkgs \
|
|
$base_pkgs \
|
|
qemu-system \
|
|
libvirt-clients \
|
|
libvirt-daemon-system
|
|
|
|
install_pkgs
|
|
|
|
log 'Adding m to libvirt group and enabling libvirtd service'
|
|
switch $distro
|
|
case debian
|
|
sudo adduser m libvirt
|
|
case arch
|
|
sudo gpasswd -a m libvirt
|
|
end
|
|
|
|
sudo systemctl enable libvirtd.service
|
|
end
|
|
|
|
function install_pkgs -S
|
|
switch $distro
|
|
case arch
|
|
set -l cmd pacman
|
|
|
|
if command -q pikaur
|
|
set cmd pikaur
|
|
end
|
|
|
|
sudo $cmd --sync --refresh --sysupgrade --noconfirm
|
|
sudo $cmd --sync --noconfirm $arch_pkgs $argv
|
|
case debian
|
|
sudo apt-get --quiet --yes update
|
|
sudo apt-get --quiet --yes upgrade
|
|
sudo apt-get --quiet --yes install $debian_pkgs $argv
|
|
end
|
|
end
|
|
|
|
function log -a message
|
|
echo \n"---------------- $message ----------------"\n
|
|
end
|
|
|
|
function main
|
|
curl -fsS https://git.mjfs.us/mitchell/swim.fish/raw/branch/master/functions/sw.fish | source
|
|
run_swim_command $cmd_func_prefix $argv
|
|
end
|
|
|
|
main $argv
|