clan-homepage/flake-parts/deploy.nix

29 lines
547 B
Nix
Raw Normal View History

2023-07-17 21:21:54 +00:00
{
perSystem = {
lib,
pkgs,
self',
...
}: let
deployScript = pkgs.writeScript "deploy.sh" ''
export PATH="${lib.makeBinPath [
pkgs.openssh
pkgs.rsync
]}"
2023-07-17 21:33:16 +00:00
if [ -n "$SSH_HOMEPAGE_KEY" ]; then
sshExtraArgs="-i $SSH_HOMEPAGE_KEY"
else
sshExtraArgs=
fi
rsync \
-e "ssh -o StrictHostKeyChecking=no $sshExtraArgs" \
-a ${self'.packages.default}/ \
www@clan.lol:/var/www
2023-07-17 21:21:54 +00:00
'';
in {
apps.deploy.program = "${deployScript}";
};
}