47 lines
885 B
Bash
Executable file
47 lines
885 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
|
|
exit
|
|
;;
|
|
d)
|
|
do_devenv
|
|
exit
|
|
;;
|
|
h)
|
|
update_home_manager
|
|
apply_home_manager
|
|
exit
|
|
;;
|
|
?)
|
|
echo "Ignoring unknown option. Please only pass -a, -d, or -h"
|
|
;;
|
|
esac
|
|
done
|
|
shift "$((OPTIND - 1))"
|
|
# Fallthrough event
|
|
echo "No argument provided. Please pass -a, -d, or -h"
|