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,9 +40,11 @@ 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 [ $UPDATES ]; then
echo "NixOS updates to apply: "
echo $UPDATES
if [ $AUTOACCEPT == false ]; then if [ $AUTOACCEPT == false ]; then
read -p "Continue with upgrade (y/n) ? " choice read -p "Continue with upgrade (y/n) ? " choice
case "$choice" in case "$choice" in
@ -50,8 +53,10 @@ if [ $AUTOACCEPT == false ]; then
* ) echo "Invalid option. Upgrade cancelled." && exit;; * ) echo "Invalid option. Upgrade cancelled." && exit;;
esac esac
fi fi
sudo nixos-rebuild $OPERATION --flake . sudo nixos-rebuild $OPERATION --flake .
else
echo "No NixOS updates found."
fi
echo "Updating Flatpaks:" echo "Updating Flatpaks:"
flatpak update flatpak update