dotfiles/nix/update.sh
2023-07-25 10:39:27 -04:00

42 lines
781 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
}
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
}
OPTIND=1
while getopts dha opt; do
case $opt in
a)
apply_home_manager
;;
d)
do_devenv
;;
h)
update_home_manager
apply_home_manager
;;
*)
"Ignoring unknown option. Please only pass -a, -d, or -h"
;;
esac
done
shift "$((OPTIND - 1))"