mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-10-01 14:33:28 +00:00
docs: adapt builder functions for ndg
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I6a6a6964720fae8f3db129835efa5d5df956c3ef
This commit is contained in:
parent
cd9a5da852
commit
11d0292539
2 changed files with 94 additions and 90 deletions
|
@ -92,7 +92,7 @@
|
|||
|
||||
# Generate the HTML manual pages
|
||||
html = pkgs.callPackage ./manual.nix {
|
||||
inherit release;
|
||||
inherit inputs release;
|
||||
inherit (nvimModuleDocs) optionsJSON;
|
||||
};
|
||||
in {
|
||||
|
|
|
@ -1,38 +1,47 @@
|
|||
{
|
||||
lib,
|
||||
inputs,
|
||||
stdenvNoCC,
|
||||
fetchzip,
|
||||
runCommandLocal,
|
||||
# build inputs
|
||||
nixos-render-docs,
|
||||
documentation-highlighter,
|
||||
dart-sass,
|
||||
path,
|
||||
# nrd configuration
|
||||
release,
|
||||
optionsJSON,
|
||||
} @ args: let
|
||||
manual-release = args.release or "unstable";
|
||||
|
||||
scss-reset = fetchzip {
|
||||
url = "https://github.com/Frontend-Layers/scss-reset/archive/refs/tags/1.4.2.zip";
|
||||
hash = "sha256-cif5Sx8Ca5vxdw/mNAgpulLH15TwmzyJFNM7JURpoaE=";
|
||||
};
|
||||
|
||||
compileStylesheet = runCommandLocal "compile-nvf-stylesheet" {} ''
|
||||
mkdir -p $out
|
||||
|
||||
tmpfile=$(mktemp -d)
|
||||
trap "rm -r $tmpfile" EXIT
|
||||
|
||||
ln -s "${scss-reset}/build" "$tmpfile/scss-reset"
|
||||
|
||||
${dart-sass}/bin/sass --load-path "$tmpfile" \
|
||||
${./static/style.scss} "$out/style.css"
|
||||
|
||||
echo "Generated styles"
|
||||
'';
|
||||
in
|
||||
runCommandLocal "hjem-docs" {
|
||||
nativeBuildInputs = [inputs.ndg.packages.${stdenvNoCC.system}.ndg];
|
||||
} ''
|
||||
mkdir -p $out/share/doc
|
||||
|
||||
# Copy the markdown sources to be processed by ndg
|
||||
cp -rvf ${./manual} ./manual
|
||||
|
||||
substituteInPlace ./manual/options.md \
|
||||
--subst-var-by OPTIONS_JSON ./config-options.json
|
||||
|
||||
substituteInPlace ./manual/index.md \
|
||||
--subst-var-by NVF_VERSION ${manual-release}
|
||||
|
||||
substituteInPlace ./manual/hacking/additional-plugins.md \
|
||||
--subst-var-by NVF_REPO "https://github.com/notashelf/nvf/blob/${manual-release}"
|
||||
|
||||
ndg html \
|
||||
--jobs $NIX_BUILD_CORES --title "NVF" \
|
||||
--module-options ${optionsJSON}/share/doc/nixos/options.json \
|
||||
--manpage-urls ${path}/doc/manpage-urls.json \
|
||||
--options-depth 3 \
|
||||
--generate-search true \
|
||||
--highlight-code true \
|
||||
--input-dir ./manual \
|
||||
--output-dir "$out/share/doc"
|
||||
|
||||
# Hydra support. Probably not necessary.
|
||||
mkdir -p $out/nix-support/
|
||||
echo "doc manual $dest index.html" >> $out/nix-support/hydra-build-products
|
||||
''
|
||||
/*
|
||||
stdenvNoCC.mkDerivation {
|
||||
name = "nvf-manual";
|
||||
src = builtins.path {
|
||||
|
@ -65,14 +74,7 @@ in
|
|||
${./static/script}/anchor-use.js \
|
||||
${./static/script}/search.js
|
||||
|
||||
substituteInPlace ./options.md \
|
||||
--subst-var-by OPTIONS_JSON ./config-options.json
|
||||
|
||||
substituteInPlace ./manual.md \
|
||||
--subst-var-by NVF_VERSION ${manual-release}
|
||||
|
||||
substituteInPlace ./hacking/additional-plugins.md \
|
||||
--subst-var-by NVF_REPO "https://github.com/notashelf/nvf/blob/${manual-release}"
|
||||
|
||||
# Move compiled stylesheet
|
||||
cp -vt $dest \
|
||||
|
@ -112,3 +114,5 @@ in
|
|||
echo "doc manual $dest index.html" >> $out/nix-support/hydra-build-products
|
||||
'';
|
||||
}
|
||||
*/
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue