docs: clean up directory structure
This commit is contained in:
23
docs/nix/default.nix
Normal file
23
docs/nix/default.nix
Normal file
@@ -0,0 +1,23 @@
|
||||
{ pkgs, ... }:
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "clan-documentation";
|
||||
|
||||
src = ../.;
|
||||
|
||||
nativeBuildInputs =
|
||||
[ pkgs.python3 ]
|
||||
++ (with pkgs.python3Packages; [
|
||||
mkdocs
|
||||
mkdocs-material
|
||||
]);
|
||||
|
||||
buildPhase = ''
|
||||
mkdocs build --strict
|
||||
|
||||
ls -la .
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
cp -a site/ $out/
|
||||
'';
|
||||
}
|
||||
36
docs/nix/deploy-docs.nix
Normal file
36
docs/nix/deploy-docs.nix
Normal file
@@ -0,0 +1,36 @@
|
||||
{
|
||||
writeShellScriptBin,
|
||||
coreutils,
|
||||
openssh,
|
||||
rsync,
|
||||
lib,
|
||||
docs,
|
||||
}:
|
||||
|
||||
writeShellScriptBin "deploy-docs" ''
|
||||
set -eux -o pipefail
|
||||
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
|
||||
''
|
||||
17
docs/nix/flake-module.nix
Normal file
17
docs/nix/flake-module.nix
Normal file
@@ -0,0 +1,17 @@
|
||||
{ inputs, ... }:
|
||||
{
|
||||
perSystem =
|
||||
{
|
||||
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; };
|
||||
};
|
||||
};
|
||||
}
|
||||
1
docs/nix/shell.nix
Normal file
1
docs/nix/shell.nix
Normal file
@@ -0,0 +1 @@
|
||||
{ docs, pkgs, ... }: pkgs.mkShell { inputsFrom = [ docs ]; }
|
||||
Reference in New Issue
Block a user