I have 2 computers at home with nearly identical configurations. To save bandwidth, I had the idea to update one (which took 20 minutes) and then use nixos-rebuild switch --use-remote-sudo --target-host $host --flake ".#$host"
to copy the derivations to the second computer.
copying 2861 paths...
copying path '/nix/store/013yilq34lcbwb393h4fba4s76gydrbp-zram-generator.conf' to 'ssh://remote'...
...
However, this is horribly slow. I just aborted the whole thing after 3.5 hours. Then did a normal nixos-rebuild switch on the second computer, which took 17 minutes.
Why is it faster to download all derivations from the internet than copying it over lan?
I’m using a similar setup here. I first nix build the second system closure on the first system, the nix copy it to the second system, copy flake.{nix,lock}, the do nixos-rebuild switch --target-host ....
I also observed that if the second machine is reachable via WiFi and Ethernet ssh can get confused by the Hostname/IP mapping and copying is very slow.