ncli-refactor #3
@ -18,15 +18,21 @@ in rec {
|
||||
${rebuild_logic}
|
||||
echo -e "Starting NixOS rebuild for current host: ${host} on generation: $YELLOW$geno$NOCOLOR"
|
||||
|
||||
# Step 1: Build the configuration and safely update the bootloader first
|
||||
set +e
|
||||
sudo nixos-rebuild switch --flake .
|
||||
sudo nixos-rebuild boot --flake .
|
||||
_rebuild_exit=$?
|
||||
set -e
|
||||
|
||||
if [ "$_rebuild_exit" -eq 0 ]; then
|
||||
echo "✓ Rebuild finished successfully for ${host}"
|
||||
echo "✓ Rebuild and bootloader update finished successfully for ${host}"
|
||||
|
||||
# Step 2: Now that boot entries are safe, activate the system live
|
||||
echo "Activating new configuration..."
|
||||
sudo /nix/var/nix/profiles/system/bin/switch-to-configuration switch
|
||||
|
||||
if [ -n "$current" ]; then
|
||||
sudo /run/current-system/specialisation/"$current"/bin/switch-to-configuration test
|
||||
sudo /nix/var/nix/profiles/system/specialisation/"$current"/bin/switch-to-configuration test
|
||||
else
|
||||
echo "No specialization tag found, staying on default system."
|
||||
fi
|
||||
@ -109,15 +115,21 @@ in rec {
|
||||
echo "Rebuilding system... Staying on current specialization"
|
||||
fi
|
||||
|
||||
# Step 1: Build the configuration and safely update the bootloader first
|
||||
set +e
|
||||
sudo nixos-rebuild switch --flake .
|
||||
sudo nixos-rebuild boot --flake .
|
||||
_rebuild_exit=$?
|
||||
set -e
|
||||
|
||||
if [ "$_rebuild_exit" -eq 0 ]; then
|
||||
echo "✓ Update and rebuild finished successfully for ${host}"
|
||||
echo "✓ Update, rebuild and bootloader update finished successfully for ${host}"
|
||||
|
||||
# Step 2: Now that boot entries are safe, activate the system live
|
||||
echo "Activating new configuration..."
|
||||
sudo /nix/var/nix/profiles/system/bin/switch-to-configuration switch
|
||||
|
||||
if [ -n "$current" ]; then
|
||||
sudo /run/current-system/specialisation/"$current"/bin/switch-to-configuration test
|
||||
sudo /nix/var/nix/profiles/system/specialisation/"$current"/bin/switch-to-configuration test
|
||||
else
|
||||
echo "No specialization tag found, staying on default system."
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user