tvl-depot/ops/terraform/deploy-nixos/nixos-copy.sh
Florian Klink f7439d2526 fix(ops/terraform): s/TARGET_ADDRESS/TARGET_HOST
We missed renaming this as well while iterating over
https://cl.tvl.fyi/c/depot/+/7950.

Change-Id: I704d3b60bb3beb1a2148e27bdd4a49075a6649b3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8230
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2023-03-08 16:59:19 +00:00

23 lines
541 B
Bash
Executable file

#!/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_HOST} \
${SYSTEM_DRV} \
--gzip \
--include-outputs \
--use-substitutes