refactor: streamline upgrade script and update Flutter environment variable
All checks were successful
Nix Format Check / check-format (push) Successful in 39s

This commit is contained in:
2024-11-21 22:25:19 +01:00
parent 5c73283e5f
commit eabff41a56
9 changed files with 57 additions and 43 deletions

View File

@ -1,8 +1,26 @@
#!/usr/bin/env bash
source $HOME/dotfiles/bin/helpers/functions.sh
printfe "%s\n" "cyan" "Upgrading NixOS packages..."
cd $HOME/dotfiles/config/nixos && sudo nixos-rebuild switch --upgrade --flake .#$DOTF_HOSTNAME --impure
while [[ "$#" -gt 0 ]]; do
case $1 in
--ha) RUN_HA=true ;;
--nix) RUN_NIX=true ;;
*) echo "Unknown parameter passed: $1"; exit 1 ;;
esac
shift
done
printfe "%s\n" "cyan" "Upgrading Home Manager packages..."
cd $HOME/dotfiles/config/home-manager && NIXPKGS_ALLOW_UNFREE=1 home-manager switch -b backup --flake .#$DOTF_HOSTNAME --impure
if [[ -z "$RUN_HA" && -z "$RUN_NIX" ]]; then
RUN_HA=true
RUN_NIX=true
fi
if [[ "$RUN_NIX" == true ]]; then
printfe "%s\n" "cyan" "Upgrading NixOS packages..."
cd $HOME/dotfiles/config/nixos && sudo nixos-rebuild switch --upgrade --flake .#$DOTF_HOSTNAME --impure
fi
if [[ "$RUN_HA" == true ]]; then
printfe "%s\n" "cyan" "Upgrading Home Manager packages..."
cd $HOME/dotfiles/config/home-manager && NIXPKGS_ALLOW_UNFREE=1 home-manager switch -b backup --flake .#$DOTF_HOSTNAME --impure
fi