clan-homepage/flake-parts/deploy.nix
DavHau e000e651f3
All checks were successful
deploy / test (push) Successful in 4s
deploy.nix: fix script
2023-07-19 20:37:32 +02:00

36 lines
698 B
Nix

{
perSystem = {
lib,
pkgs,
self',
...
}: let
deployScript = pkgs.writeScript "deploy.sh" ''
export PATH="${lib.makeBinPath [
pkgs.coreutils
pkgs.openssh
pkgs.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 ${self'.packages.default}/ \
www@clan.lol:/var/www
if [ -e ./ssh_key ]; then
rm ./ssh_key
fi
'';
in {
apps.deploy.program = "${deployScript}";
};
}