clan-cli: machines install: add phases option for nixos-anywhere

This commit is contained in:
Sacha Korban
2025-02-13 15:21:02 +11:00
parent 2f1d436646
commit 9bc3d808c1

View File

@@ -32,6 +32,7 @@ class InstallOptions:
kexec: str | None = None
debug: bool = False
no_reboot: bool = False
phases: str | None = None
build_on_remote: bool = False
nix_options: list[str] = field(default_factory=list)
update_hardware_config: HardwareConfig = HardwareConfig.NONE
@@ -95,6 +96,9 @@ def install_machine(opts: InstallOptions) -> None:
if opts.no_reboot:
cmd.append("--no-reboot")
if opts.phases:
cmd += ["--phases", str(opts.phases)]
if opts.update_hardware_config is not HardwareConfig.NONE:
cmd.extend(
[
@@ -185,6 +189,7 @@ def install_command(args: argparse.Namespace) -> None:
machine=machine,
target_host=target_host,
kexec=args.kexec,
phases=args.phases,
debug=args.debug,
no_reboot=args.no_reboot,
nix_options=args.option,
@@ -208,7 +213,7 @@ def register_install_parser(parser: argparse.ArgumentParser) -> None:
parser.add_argument(
"--no-reboot",
action="store_true",
help="do not reboot after installation",
help="do not reboot after installation (deprecated)",
default=False,
)
parser.add_argument(
@@ -237,6 +242,12 @@ def register_install_parser(parser: argparse.ArgumentParser) -> None:
choices=[x.value for x in HardwareConfig],
)
parser.add_argument(
"--phases",
type=str,
help="comma separated list of phases to run. Default is: kexec,disko,install,reboot",
)
machines_parser = parser.add_argument(
"machine",
type=str,