nix-config/bin/dotfiles

33 lines
769 B
Text
Raw Normal View History

2022-03-30 23:41:06 +01:00
#!/bin/bash
set -e
2022-03-30 23:58:01 +01:00
CONFIG_DIR="$HOME/.config/dotfiles"
2022-03-30 23:41:06 +01:00
DOTFILES_DIR="$HOME/.dotfiles"
# TODO: Determine this automatically based on username or somehow.
IS_WSL=${IS_WSL:=false}
2022-03-30 23:41:06 +01:00
clone_or_update_dotfiles() {
git -C $DOTFILES_DIR pull
}
2022-03-30 23:58:01 +01:00
create_config_dir() {
mkdir -p "${CONFIG_DIR}"
}
2022-03-30 23:41:06 +01:00
install_dependencies() {
ansible-galaxy install -r "${DOTFILES_DIR}/requirements.yml"
}
run_playbook() {
if [[ $IS_WSL ]]; then
ansible-playbook --diff --extra-vars "@${CONFIG_DIR}/values.yaml" --ask-become-pass "${DOTFILES_DIR}/main.yaml" --skip-tags skip-if-wsl "${@}"
else
ansible-playbook --diff --extra-vars "@${CONFIG_DIR}/values.yaml" --ask-become-pass "${DOTFILES_DIR}/main.yaml" "${@}"
fi
2022-03-30 23:41:06 +01:00
}
clone_or_update_dotfiles
install_dependencies
run_playbook