fix: check if phases are non-default when running

This commit is contained in:
Sacha Korban
2025-08-29 18:27:03 +10:00
committed by Jörg Thalheim
parent 83e51db2e7
commit 1a766a3447

View File

@@ -214,27 +214,29 @@ def run_machine_install(opts: InstallOptions, target_host: Remote) -> None:
cmd,
)
notify_install_step("nixos-anywhere")
install_steps = {
"kexec": "nixos-anywhere",
"disko": "formatting",
"install": "installing",
"reboot": "rebooting",
}
def run_phase(phase: str) -> None:
notification = install_steps.get(phase, "nixos-anywhere")
notify_install_step(notification)
run(
[*cmd, "--phases", "kexec"],
RunOpts(log=Log.BOTH, prefix=machine.name, needs_user_terminal=True),
)
notify_install_step("formatting")
run(
[*cmd, "--phases", "disko"],
RunOpts(log=Log.BOTH, prefix=machine.name, needs_user_terminal=True),
)
notify_install_step("installing")
run(
[*cmd, "--phases", "install"],
RunOpts(log=Log.BOTH, prefix=machine.name, needs_user_terminal=True),
)
notify_install_step("rebooting")
run(
[*cmd, "--phases", "reboot"],
[*cmd, "--phases", phase],
RunOpts(log=Log.BOTH, prefix=machine.name, needs_user_terminal=True),
)
if opts.phases:
phases = [phase.strip() for phase in opts.phases.split(",")]
for phase in phases:
run_phase(phase)
else:
for phase in ["kexec", "disko", "install", "reboot"]:
run_phase(phase)
if opts.persist_state:
inventory_store = InventoryStore(machine.flake)
inventory = inventory_store.read()