diff --git a/nix-system-configs/modules/scripts/pull.zsh b/nix-system-configs/modules/scripts/pull.zsh index 0b236c3..6527fcd 100755 --- a/nix-system-configs/modules/scripts/pull.zsh +++ b/nix-system-configs/modules/scripts/pull.zsh @@ -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" diff --git a/nix-system-configs/modules/scripts/push.zsh b/nix-system-configs/modules/scripts/push.zsh index 7c7bb69..522c724 100755 --- a/nix-system-configs/modules/scripts/push.zsh +++ b/nix-system-configs/modules/scripts/push.zsh @@ -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"