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": {
"lastModified": 1711915616,
"narHash": "sha256-co6LoFA+j6BZEeJNSR8nZ4oOort5qYPskjrDHBaJgmo=",
"lastModified": 1712016346,
"narHash": "sha256-O2nO7pD+krq+4HgkLB4VThRtAucIPfXDs/jJqCGlK1w=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "820be197ccf3adaad9a8856ef255c13b6cc561a6",
"rev": "4be0464472675212654dedf3e021bd5f1d58b92f",
"type": "github"
},
"original": {

View file

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