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