Merge pull request 'clan-cli: Remove can_build_locally and replace with nixos-anywhere --build-on auto' (#2944) from Qubasa/clan-core:main into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/2944
This commit is contained in:
@@ -49,8 +49,7 @@ def install_machine(opts: InstallOptions) -> None:
|
|||||||
machine.info(f"installing {machine.name}")
|
machine.info(f"installing {machine.name}")
|
||||||
|
|
||||||
h = machine.target_host
|
h = machine.target_host
|
||||||
target_host = f"{h.user or 'root'}@{h.host}"
|
machine.info(f"target host: {h.target}")
|
||||||
machine.info(f"target host: {target_host}")
|
|
||||||
|
|
||||||
generate_facts([machine])
|
generate_facts([machine])
|
||||||
generate_vars([machine])
|
generate_vars([machine])
|
||||||
@@ -123,26 +122,29 @@ def install_machine(opts: InstallOptions) -> None:
|
|||||||
if opts.identity_file:
|
if opts.identity_file:
|
||||||
cmd += ["-i", str(opts.identity_file)]
|
cmd += ["-i", str(opts.identity_file)]
|
||||||
|
|
||||||
if not machine.can_build_locally or opts.build_on_remote:
|
if opts.build_on_remote:
|
||||||
machine.info(
|
cmd.extend(["--build-on", "remote"])
|
||||||
f"Target machine has architecture {machine.system} which cannot be built locally or with the configured remote builders. Building on target machine"
|
else:
|
||||||
)
|
cmd.extend(["--build-on", "auto"])
|
||||||
cmd.append("--build-on-remote")
|
|
||||||
|
|
||||||
if machine.target_host.port:
|
if h.port:
|
||||||
cmd += ["--ssh-port", str(machine.target_host.port)]
|
cmd += ["--ssh-port", str(h.port)]
|
||||||
if opts.kexec:
|
if opts.kexec:
|
||||||
cmd += ["--kexec", opts.kexec]
|
cmd += ["--kexec", opts.kexec]
|
||||||
|
|
||||||
if opts.debug:
|
if opts.debug:
|
||||||
cmd.append("--debug")
|
cmd.append("--debug")
|
||||||
cmd.append(target_host)
|
cmd.append(h.target)
|
||||||
if opts.use_tor:
|
if opts.use_tor:
|
||||||
# nix copy does not support tor socks proxy
|
# nix copy does not support tor socks proxy
|
||||||
# cmd.append("--ssh-option")
|
# cmd.append("--ssh-option")
|
||||||
# cmd.append("ProxyCommand=nc -x 127.0.0.1:9050 -X 5 %h %p")
|
# cmd.append("ProxyCommand=nc -x 127.0.0.1:9050 -X 5 %h %p")
|
||||||
run(
|
run(
|
||||||
nix_shell(
|
nix_shell(
|
||||||
["nixpkgs#nixos-anywhere", "nixpkgs#tor"],
|
[
|
||||||
|
"nixpkgs#nixos-anywhere",
|
||||||
|
"nixpkgs#tor",
|
||||||
|
],
|
||||||
["torify", *cmd],
|
["torify", *cmd],
|
||||||
),
|
),
|
||||||
RunOpts(log=Log.BOTH, prefix=machine.name, needs_user_terminal=True),
|
RunOpts(log=Log.BOTH, prefix=machine.name, needs_user_terminal=True),
|
||||||
|
|||||||
Reference in New Issue
Block a user