d32baeff6c
This is the result of a `"reuse annotate --copyright "The TVL Authors" --license MIT"` in that directory, making it conformant with the REUSE Specification: https://reuse.software/spec Change-Id: I13e069b4621e8d5ccb7a09c12f772d70dea40a11 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10170 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
32 lines
820 B
Bash
Executable file
32 lines
820 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
# SPDX-FileCopyrightText: 2023 The TVL Authors
|
|
#
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
#
|
|
# Copies a NixOS system to a target host, using the provided key,
|
|
# or whatever ambient key is configured if the key is not set.
|
|
set -ueo pipefail
|
|
|
|
export NIX_SSHOPTS="\
|
|
-o StrictHostKeyChecking=no\
|
|
-o UserKnownHostsFile=/dev/null\
|
|
-o GlobalKnownHostsFile=/dev/null"
|
|
|
|
# If DEPLOY_KEY was passed, write it to $scratch/id_deploy
|
|
if [ -n "${DEPLOY_KEY-}" ]; then
|
|
scratch="$(mktemp -d)"
|
|
trap 'rm -rf -- "${scratch}"' EXIT
|
|
|
|
echo -n "$DEPLOY_KEY" > $scratch/id_deploy
|
|
chmod 0600 $scratch/id_deploy
|
|
export NIX_SSHOPTS="$NIX_SSHOPTS -o IdentityFile=$scratch/id_deploy"
|
|
fi
|
|
|
|
nix-copy-closure \
|
|
--to ${TARGET_USER}@${TARGET_HOST} \
|
|
${SYSTEM_DRV} \
|
|
--gzip \
|
|
--include-outputs \
|
|
--use-substitutes
|