diff options
Diffstat (limited to 'ops/terraform/deploy-nixos/nixos-copy.sh')
-rwxr-xr-x | ops/terraform/deploy-nixos/nixos-copy.sh | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/ops/terraform/deploy-nixos/nixos-copy.sh b/ops/terraform/deploy-nixos/nixos-copy.sh new file mode 100755 index 000000000000..1c6b8df024d2 --- /dev/null +++ b/ops/terraform/deploy-nixos/nixos-copy.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# +# Copies a NixOS system to a target host, using the provided key. +set -ueo pipefail + +scratch="$(mktemp -d)" +trap 'rm -rf -- "${scratch}"' EXIT + +echo -n "$DEPLOY_KEY" > $scratch/id_deploy +chmod 0600 $scratch/id_deploy + +export NIX_SSHOPTS="\ + -o StrictHostKeyChecking=no\ + -o UserKnownHostsFile=/dev/null\ + -o GlobalKnownHostsFile=/dev/null\ + -o IdentityFile=$scratch/id_deploy" + +nix-copy-closure \ + --to ${TARGET_USER}@${TARGET_ADDRESS} \ + ${SYSTEM_DRV} \ + --gzip \ + --include-outputs \ + --use-substitutes |