From bcf5dac5d70b5b1eac5391cbef0e0c52ce9e56f9 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Sun, 7 May 2023 22:07:35 +0100 Subject: [PATCH] min-copy-closure: honour $SSH_COMMAND env var --- pkgs/min-copy-closure/min-copy-closure.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pkgs/min-copy-closure/min-copy-closure.sh b/pkgs/min-copy-closure/min-copy-closure.sh index 2dba9dd..1b57818 100755 --- a/pkgs/min-copy-closure/min-copy-closure.sh +++ b/pkgs/min-copy-closure/min-copy-closure.sh @@ -1,13 +1,25 @@ #!/usr/bin/env bash +ssh_command=${SSH_COMMAND-ssh} target_host=$1 shift -paths=$(nix-store -q --requisites "$@") +if [ -z "$target_host" ] ; then + echo Usage: min-copy-closure target-host paths + exit 1 +fi + +if [ -n "$IN_NIX_BUILD" ] ; then + # can't run nix-store in a derivation, so we have to + # skip the requisites when running tests in hydra + paths=$@ +else + paths=$(nix-store -q --requisites "$@") +fi needed="" coproc remote { - ssh -C ${target_host} + ${ssh_command} -C -T ${target_host} } exec 10>&${remote[1]}