dotfiles/nix/update.sh
Anthony Cicchetti e5df0b93cc better updater
2024-04-16 15:05:18 -04:00

50 lines
822 B
Bash
Executable file

#!/bin/bash
do_devenv() {
pushd ~/.dotfiles || return
printf "Updating \033[38;5;87mdevenv\033[0m \n"
nix flake update
popd || return
}
do_topgrade() {
topgrade
}
update_home_manager() {
pushd ./home-manager || return
printf "Updating \033[38;5;87mhome-manager\033[0m\n"
nix flake update
popd || return
}
apply_home_manager() {
pushd ./home-manager || return
if [[ $(uname) == "Darwin" ]]; then
home-manager switch --flake ".#aarch64-darwin-acicchetti"
else
home-manager switch --flake '.#x86_64-linux-acicchetti'
fi
popd || return
}
while getopts ':dhat' opt; do
case $opt in
a)
apply_home_manager
;;
d)
do_devenv
;;
h)
update_home_manager
apply_home_manager
;;
t)
do_topgrade
;;
?)
echo "Ignoring unknown option. Please only pass -a, -d, -h, or -t"
exit
;;
esac
done