Fix the script...

This commit is contained in:
Root User 2026-03-19 22:27:37 +01:00
parent 947b4d711c
commit d2b554b18c
Signed by: root
GPG key ID: 087F0A95E5766D72
2 changed files with 17 additions and 3 deletions

View file

@ -184,9 +184,15 @@ fi
# Step 4: Rebuild system using local flake
# Compute repository root (three levels up from this script: .../nix-system-configs/modules/scripts -> repo root)
FLAKE_ROOT="$(cd "${SCRIPT_DIR}/../../.." && pwd)"
print_info "Rebuilding NixOS system using flake at ${BOLD}${FLAKE_ROOT}${RESET}..."
# Normalize selected system name to flake nixosConfigurations naming convention (prefix with 'nixos-' if missing)
if [[ "${selected_system}" == nixos-* ]]; then
flake_name="${selected_system}"
else
flake_name="nixos-${selected_system}"
fi
print_info "Rebuilding NixOS system using flake at ${BOLD}${FLAKE_ROOT}#${flake_name}${RESET}..."
echo ""
if sudo NIX_CONFIG='experimental-features = nix-command flakes' nixos-rebuild switch --upgrade-all --flake "${FLAKE_ROOT}#${selected_system}"; then
if sudo NIX_CONFIG='experimental-features = nix-command flakes' nixos-rebuild switch --upgrade-all --flake "${FLAKE_ROOT}#${flake_name}"; then
print_success "System rebuild completed successfully!"
else
print_error "System rebuild failed"

View file

@ -101,8 +101,16 @@ echo ""
# Step 1: Rebuild system
print_info "Rebuilding NixOS system..."
# Normalize selected system name to flake nixosConfigurations naming convention (prefix with 'nixos-' if missing)
if [[ "${selected_system}" == nixos-* ]]; then
flake_name="${selected_system}"
else
flake_name="nixos-${selected_system}"
fi
echo ""
if sudo nixos-rebuild switch --upgrade-all; then
if sudo NIX_CONFIG='experimental-features = nix-command flakes' nixos-rebuild switch --upgrade-all --flake "${PWD}#${flake_name}"; then
print_success "System rebuild completed"
else
print_error "System rebuild failed"