1
0
Fork 0

Change upgrade script to always continue even without package updates

This commit is contained in:
Aires 2024-04-18 10:24:16 -04:00
parent b0ed6005f1
commit 99a2022185
2 changed files with 21 additions and 21 deletions

View file

@ -117,11 +117,11 @@
]
},
"locked": {
"lastModified": 1713294767,
"narHash": "sha256-LmaabaQZdx52MPGKPRt9Opoc9Gd9RbwvCdysUUYQoXI=",
"lastModified": 1713391096,
"narHash": "sha256-5xkzsy+ILgQlmvDDipL5xqAehnjWBenAQXV4/NLg2dE=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "fa8c16e2452bf092ac76f09ee1fb1e9f7d0796e7",
"rev": "f46814ec7cbef9c2aef18ca1cbe89f2bb1e8c394",
"type": "github"
},
"original": {
@ -174,11 +174,11 @@
},
"nixos-hardware": {
"locked": {
"lastModified": 1713377320,
"narHash": "sha256-OrBm62B+X9jylr6cPgKc+5OSgF2PRW9IY0ARCOtURMY=",
"lastModified": 1713441075,
"narHash": "sha256-3GGeFsEO8ivD+TcDEqe4s/d0VLvMYGNDGtx0ZnBxkUs=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "f2d364de6589f7a029624983593eafc3c4dac726",
"rev": "6f976e53752e5b9ab08f9a3b1b0b9c67815c9754",
"type": "github"
},
"original": {

View file

@ -41,23 +41,23 @@ echo "Using installation mode: $OPERATION"
cd ~/Development/nix-configuration
nix flake update
nixos-rebuild build --flake .
UPDATES=$(nix store diff-closures /run/current-system ./result | awk '/[0-9] →|→ [0-9]/ && !/nixos/' || echo)
PACKAGE_UPDATES=$(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
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."
if [ "$PACKAGE_UPDATES" ]; then
echo "Packages to update: "
echo $PACKAGE_UPDATES
fi
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 .
echo "Updating Flatpaks:"
flatpak update