1
0
forked from clan/clan-core

add deploy script for homepage

This commit is contained in:
Jörg Thalheim 2024-04-12 16:37:50 +02:00 committed by Johannes Kirschbauer
parent 30663d563d
commit c3f2c548a6
Signed by: hsjobeki
SSH Key Fingerprint: SHA256:vX3utDqig7Ph5L0JPv87ZTPb/w7cMzREKVZzzLFg9qU
2 changed files with 42 additions and 1 deletions

35
docs/deploy-docs.nix Normal file
View File

@ -0,0 +1,35 @@
{
writeShellScriptBin,
coreutils,
openssh,
rsync,
lib,
docs,
}:
writeShellScriptBin "deploy-docs" ''
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
''

View File

@ -1,11 +1,17 @@
{ inputs, ... }:
{
perSystem =
{ self', pkgs, ... }:
{
config,
self',
pkgs,
...
}:
{
devShells.docs = pkgs.callPackage ./shell.nix { inherit (self'.packages) docs; };
packages = {
docs = pkgs.python3.pkgs.callPackage ./default.nix { inherit (inputs) nixpkgs; };
deploy-docs = pkgs.callPackage ./deploy-docs.nix { inherit (config.packages) docs; };
};
};
}