Does nixos-rebuild with targetHost will copy the current directory's file to targetHost?

we know if we run nixos-rebuild, the files in the current directory will copy to /nix/store/hash-source/.
but with a “–target-host” parameter, the /nix/store/hash-source/ does not exist on the target host. Why?

Probably because it is not part of the runtime closure.

1 Like

thanks, but the result has a systemd service that ExecStart is a script pointing to this /nix/store/hash-source/ directory.
more detail: How to deploy custom NixOS module configuration with a flake using nixos-rebuild and keep the relative path of a custom script file?