add build-on-remote flag

This commit is contained in:
Jörg Thalheim
2024-11-04 13:19:00 +01:00
parent c02ecc2f67
commit 2f3369cca5
2 changed files with 14 additions and 0 deletions

View File

@@ -62,6 +62,7 @@
"flakes" "flakes"
]; ];
}; };
system.extraDependencies = dependencies;
}; };
nodes.client = { nodes.client = {
environment.systemPackages = [ environment.systemPackages = [

View File

@@ -31,6 +31,7 @@ def install_nixos(
password: str | None = None, password: str | None = None,
no_reboot: bool = False, no_reboot: bool = False,
extra_args: list[str] | None = None, extra_args: list[str] | None = None,
build_on_remote: bool = False,
) -> None: ) -> None:
if extra_args is None: if extra_args is None:
extra_args = [] extra_args = []
@@ -70,6 +71,9 @@ def install_nixos(
if no_reboot: if no_reboot:
cmd.append("--no-reboot") cmd.append("--no-reboot")
if build_on_remote:
cmd.append("--build-on-remote")
if password: if password:
cmd += [ cmd += [
"--env-password", "--env-password",
@@ -104,6 +108,7 @@ class InstallOptions:
debug: bool = False debug: bool = False
no_reboot: bool = False no_reboot: bool = False
json_ssh_deploy: dict[str, str] | None = None json_ssh_deploy: dict[str, str] | None = None
build_on_remote: bool = False
nix_options: list[str] = field(default_factory=list) nix_options: list[str] = field(default_factory=list)
@@ -119,6 +124,7 @@ def install_machine(opts: InstallOptions, password: str | None) -> None:
password=password, password=password,
no_reboot=opts.no_reboot, no_reboot=opts.no_reboot,
extra_args=opts.nix_options, extra_args=opts.nix_options,
build_on_remote=opts.build_on_remote,
) )
@@ -159,6 +165,7 @@ def install_command(args: argparse.Namespace) -> None:
no_reboot=args.no_reboot, no_reboot=args.no_reboot,
json_ssh_deploy=json_ssh_deploy, json_ssh_deploy=json_ssh_deploy,
nix_options=args.option, nix_options=args.option,
build_on_remote=args.build_on_remote,
), ),
password, password,
) )
@@ -192,6 +199,12 @@ def register_install_parser(parser: argparse.ArgumentParser) -> None:
help="do not reboot after installation", help="do not reboot after installation",
default=False, default=False,
) )
parser.add_argument(
"--build-on-remote",
action="store_true",
help="build the NixOS configuration on the remote machine",
default=False,
)
parser.add_argument( parser.add_argument(
"--yes", "--yes",
action="store_true", action="store_true",