clan-core/docs/nix/deploy-docs.nix

37 lines
576 B
Nix
Raw Normal View History

2024-04-12 14:37:50 +00:00
{
writeShellScriptBin,
coreutils,
openssh,
rsync,
lib,
docs,
}:
writeShellScriptBin "deploy-docs" ''
2024-04-12 14:39:56 +00:00
set -eux -o pipefail
2024-04-12 14:37:50 +00:00
export PATH="${
lib.makeBinPath [
coreutils
openssh
rsync
]
}"
if [ -n "$SSH_HOMEPAGE_KEY" ]; then
echo "$SSH_HOMEPAGE_KEY" > ./ssh_key
chmod 600 ./ssh_key
sshExtraArgs="-i ./ssh_key"
else
sshExtraArgs=
fi
rsync \
-e "ssh -o StrictHostKeyChecking=no $sshExtraArgs" \
-a ${docs}/ \
www@clan.lol:/var/www/docs.clan.lol
if [ -e ./ssh_key ]; then
rm ./ssh_key
fi
''