Remote build hangs while copying path to remote box

I’ve a Raspberry Pi 4, 4GB running NixOS and a Ryzen 7 4800H laptop running archlinux, and I wish to build custom kernel for rpi using latter.
I’m at a point where I can run this remote build command on rpi successfully:

nix-build --expr '(with import <nixpkgs> { system = "aarch64-linux"; }; runCommand "foo" {} "uname > $out")' --builders 'ssh-ng://root@ aarch64-linux'

On rpi, this is how I configure the builder

  nix = {
    extraOptions = ''
      builders-use-substitutes = true
    distributedBuilds = true;
    maxJobs = 0;
    buildMachines = [ { 
      hostName = "";
      sshUser = "ssh-ng://root";
      sshKey = "/root/.ssh/";
      systems = ["x86_64-linux" "aarch64-linux"];
      maxJobs = 1;
      speedFactor = 2;
      supportedFeatures = [ "big-parallel" ];
      mandatoryFeatures = [ ];
    } ];

nixos-rebuild switch command gets stuck on copying

building Nix...
building the system configuration...
these derivations will be built:
building '/nix/store/584028dzaaaxn7f7wrhkhm2n2z6s0pcs-etc-machines.drv'...
building '/nix/store/p5skldqf57h8jcl4gwffcfa7m6s3v2jj-linux-5.10.103-1.20220308.drv' on 'ssh-ng://root@'...
copying 42 paths...
copying path '/nix/store/f0qrx5isjr46kv7iqpajiks1gdsmd5sk-source' to 'ssh-ng://root@'...
copying path '/nix/store/hdr6v584ig3dpjlcs9afxxky3lvzm2nw-randstruct-provide-seed.patch' to 'ssh-ng://root@'...

At this point, I’m sure that there’s no resource contention on rpi. As per nmon disk usage is mostly 0%, network transferring constantly at 100-200 KB/s. rpi and laptop are on local network. They can transfer at 50MB/s easily.
Also, the last thing: randstruct-provide-seed.patch is just a simple file.

I’ve tried with nix 2.7.0 and nix 2.3.16 on archlinux host, but both seem to get stuck.
If I run nixos-rebuild with -vvvvv then I see a huge spam of logs repeating the same 3 lines

building of '/nix/store/p5skldqf57h8jcl4gwffcfa7m6s3v2jj-linux-5.10.103-1.20220308.drv': read 91 bytes
waiting for children
sleeping 10 seconds
building of '/nix/store/p5skldqf57h8jcl4gwffcfa7m6s3v2jj-linux-5.10.103-1.20220308.drv': read 91 bytes
waiting for children
sleeping 10 seconds

Can anyone please suggest what might be the issue?


I’m facing exactly the same problem but on macOS (M1) with remote x86_64-linux builder.

Noticed that problem dissapears if I authenticate on remote builder as root. Weird, both root and my original users are listed in nix.settings.trusted-users.