Create the options-page subpage when the docs dev shell is loaded. Also simplify the dev shell definition by just utilizing what's in configurePhase of the docs derivation
66 lines
1.5 KiB
Nix
66 lines
1.5 KiB
Nix
{
|
|
clan-core,
|
|
pkgs,
|
|
module-docs,
|
|
clan-cli-docs,
|
|
asciinema-player-js,
|
|
asciinema-player-css,
|
|
roboto,
|
|
fira-code,
|
|
docs-options,
|
|
...
|
|
}:
|
|
let
|
|
uml-c4 = pkgs.python3Packages.plantuml-markdown.override { plantuml = pkgs.plantuml-c4; };
|
|
in
|
|
pkgs.stdenv.mkDerivation {
|
|
name = "clan-documentation";
|
|
|
|
# Points to repository root.
|
|
# so that we can access directories outside of docs to include code snippets
|
|
src = clan-core;
|
|
|
|
nativeBuildInputs =
|
|
[
|
|
pkgs.python3
|
|
uml-c4
|
|
]
|
|
++ (with pkgs.python3Packages; [
|
|
mkdocs
|
|
mkdocs-material
|
|
mkdocs-macros
|
|
]);
|
|
configurePhase = ''
|
|
pushd docs
|
|
|
|
mkdir -p ./site/reference/cli
|
|
cp -af ${module-docs}/* ./site/reference/
|
|
cp -af ${clan-cli-docs}/* ./site/reference/cli/
|
|
chmod -R +w ./site/reference
|
|
echo "Generated API documentation in './site/reference/' "
|
|
|
|
cp -r ${docs-options} ./site/options-page
|
|
chmod -R +w ./site/options-page
|
|
|
|
mkdir -p ./site/static/asciinema-player
|
|
ln -snf ${asciinema-player-js} ./site/static/asciinema-player/asciinema-player.min.js
|
|
ln -snf ${asciinema-player-css} ./site/static/asciinema-player/asciinema-player.css
|
|
|
|
# Link to fonts
|
|
ln -snf ${roboto}/share/fonts/truetype/Roboto-Regular.ttf ./site/static/
|
|
ln -snf ${fira-code}/share/fonts/truetype/FiraCode-VF.ttf ./site/static/
|
|
|
|
# Copy icons into place
|
|
cp -af ../pkgs/clan-app/ui/icons ./site/static/
|
|
'';
|
|
|
|
buildPhase = ''
|
|
mkdocs build --strict
|
|
ls -la .
|
|
'';
|
|
|
|
installPhase = ''
|
|
cp -a out/ $out/
|
|
'';
|
|
}
|