Skip to content

Commit 0e05582

Browse files
pogobananeMic92
authored andcommitted
nixos-anywhere-pxe: explicitly print nixos-anywhere cmd including the ssh key
this allows the user to just copy paste the command and run it manually, in case it failed
1 parent fa4958d commit 0e05582

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/nixos_anywhere_pxe/__init__.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -335,22 +335,24 @@ def ssh_private_key() -> Iterator[SshKey]:
335335
def nixos_anywhere(
336336
ip: str, flake: str, ssh_private_key: Path, nixos_anywhere_args: List[str]
337337
) -> None:
338+
cmd = [
339+
# FIXME: path
340+
"bash",
341+
str(NIXOS_ANYWHERE_SH),
342+
"--flake",
343+
flake,
344+
"-L",
345+
# do not substitute because we do not have internet and copying locally is faster.
346+
"--no-substitute-on-destination",
347+
ip,
348+
] + nixos_anywhere_args
338349
run(
339-
[
340-
# FIXME: path
341-
"bash",
342-
str(NIXOS_ANYWHERE_SH),
343-
"--flake",
344-
flake,
345-
"-L",
346-
# do not substitute because we do not have internet and copying locally is faster.
347-
"--no-substitute-on-destination",
348-
ip,
349-
]
350-
+ nixos_anywhere_args,
350+
cmd,
351351
extra_env=dict(SSH_PRIVATE_KEY=ssh_private_key.read_text()),
352352
check=False,
353353
)
354+
print("If the installation failed, you may run the install command manually again:")
355+
print(f"{cmd} -i {ssh_private_key.read_text()}")
354356

355357

356358
@contextmanager

0 commit comments

Comments
 (0)