1
0
Fork 0

Tweak upgrade script

This commit is contained in:
Aires 2024-04-02 09:23:28 -04:00
parent 4f1d045e1a
commit 3b7379a1c5
2 changed files with 21 additions and 16 deletions

View file

@ -117,11 +117,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1711915616, "lastModified": 1712016346,
"narHash": "sha256-co6LoFA+j6BZEeJNSR8nZ4oOort5qYPskjrDHBaJgmo=", "narHash": "sha256-O2nO7pD+krq+4HgkLB4VThRtAucIPfXDs/jJqCGlK1w=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "820be197ccf3adaad9a8856ef255c13b6cc561a6", "rev": "4be0464472675212654dedf3e021bd5f1d58b92f",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -26,10 +26,11 @@ while [[ $# -gt 0 ]]; do
;; ;;
-h|--help) -h|--help)
usage usage
shift exit
;; ;;
*) *)
break echo "Unknown argument $1"
exit 1
;; ;;
esac esac
done done
@ -39,19 +40,23 @@ echo "Using installation mode: $OPERATION"
cd ~/Development/nix-configuration cd ~/Development/nix-configuration
nix flake update nix flake update
nixos-rebuild build --flake . nixos-rebuild build --flake .
echo "Updates to apply:" UPDATES=$(nix store diff-closures /run/current-system ./result | awk '/[0-9] →|→ [0-9]/ && !/nixos/' || echo)
nix store diff-closures /run/current-system ./result | awk '/[0-9] →|→ [0-9]/ && !/nixos/' || echo
if [ $AUTOACCEPT == false ]; then if [ $UPDATES ]; then
read -p "Continue with upgrade (y/n) ? " choice echo "NixOS updates to apply: "
case "$choice" in echo $UPDATES
y|Y|yes ) echo "Running nixos-rebuild $OPERATION :";; if [ $AUTOACCEPT == false ]; then
n|N|no ) echo "Upgrade cancelled." && exit;; read -p "Continue with upgrade (y/n) ? " choice
* ) echo "Invalid option. Upgrade cancelled." && exit;; case "$choice" in
esac y|Y|yes ) echo "Running nixos-rebuild $OPERATION :";;
n|N|no ) echo "Upgrade cancelled." && exit;;
* ) echo "Invalid option. Upgrade cancelled." && exit;;
esac
fi
sudo nixos-rebuild $OPERATION --flake .
else
echo "No NixOS updates found."
fi fi
sudo nixos-rebuild $OPERATION --flake .
echo "Updating Flatpaks:" echo "Updating Flatpaks:"
flatpak update flatpak update