nix-community / nixos-anywhere

install nixos everywhere via ssh [maintainer=@numtide]
https://nix-community.github.io/nixos-anywhere/
MIT License
1.49k stars 106 forks source link

--build-on-remote flag hangs up on "Building disko script" step and never finishes on MacOS #385

Open onnimonni opened 2 days ago

onnimonni commented 2 days ago

Issue

Even on the latest version of nixos-anywhere I can't get deployments working with --build-on-remote. I already tried to mention about this on #371 but it's probably cleaner to open new issue instead than continuing there.

Example logs

$ nix --extra-experimental-features "flakes nix-command" run github:nix-community/nixos-anywhere/ -- --debug --print-build-logs --build-on-remote --flake .#myHost root@X.Y.Z.W

...

### Building disko script ###
+ nixCopy --to ssh://root@X.Y.Z.W '.#nixosConfigurations."myHost".config.system.build.diskoScript' --derivation --no-check-sigs
+ NIX_SSHOPTS='-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /tmp/tmp.ZiSqUZEHAN/nixos-anywhere '
+ nix copy --extra-experimental-features 'nix-command flakes' --no-write-lock-file -L --to ssh://root@X.Y.Z.W '.#nixosConfigurations."myHost".config.system.build.diskoScript' --derivation --no-check-sigs
Warning: Permanently added 'X.Y.Z.W' (ED25519) to the list of known hosts.

You can see my flake and diskoscripts in this example repo: https://github.com/onnimonni/hetzner-auction-nixos-example.

I can get this working if I kexec the server and then deploy directly there as I documented on the example git repo but not directly from my MacOS.

MacOS version

$ sw_vers
ProductName:        macOS
ProductVersion:     14.6.1
BuildVersion:       23G93
Mic92 commented 2 days ago

Did it work with ssh-ng://?

onnimonni commented 2 days ago

Probably a stupid question but how would I use that? By using a copy of the script with my own mods?

Mic92 commented 2 days ago

You can even take the nix copy command that you see in the debug output

onnimonni commented 2 days ago

So this is what I tried:

$ nix copy --extra-experimental-features 'nix-command flakes' --no-write-lock-file -L --to ssh-ng://root@X.Y.Z.W '.#nixosConfigurations."myHost".config.system.build.diskoScript' --derivation --no-check-sigs --debug --print-build-logs 2> nix-copy-debug.log

I redacted my ip-address and changed /Users/$USER to ~ in the log.

It doesn't do anything after the server accepts my public key and just waits. I pressed ctrl+c to stop the process after 15minutes.

I attached the logs here: nix-copy-debug.log

Here's also my nix version:

$ nix --version
nix (Nix) 2.24.5
sedlund commented 1 day ago

log missing context of stdout -- looks like ssh issue