#!/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