Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@

# Generate the HTML manual pages
html = pkgs.callPackage ./manual.nix {
inherit release;
inherit inputs release;
inherit (nvimModuleDocs) optionsJSON;
};
in {
Expand Down
149 changes: 41 additions & 108 deletions docs/manual.nix
Original file line number Diff line number Diff line change
@@ -1,114 +1,47 @@
{
lib,
stdenvNoCC,
fetchzip,
runCommandLocal,
# build inputs
nixos-render-docs,
documentation-highlighter,
dart-sass,
inputs,
path,
# nrd configuration
release,
stdenvNoCC,
runCommandNoCCLocal,
optionsJSON,
release,
} @ 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
stdenvNoCC.mkDerivation {
name = "nvf-manual";
src = builtins.path {
name = "nvf-manual-${manual-release}";
path = lib.sourceFilesBySuffices ./manual [".md" ".md.in"];
};

strictDependencies = true;
nativeBuildInputs = [nixos-render-docs];

postPatch = ''
ln -s ${optionsJSON}/share/doc/nixos/options.json ./config-options.json
'';

buildPhase = ''
dest="$out/share/doc/nvf"
mkdir -p "$(dirname "$dest")"
mkdir -p $dest/{highlightjs,script}

# Copy highlight scripts to /highlights in document root.
cp -vt $dest/highlightjs \
${documentation-highlighter}/highlight.pack.js \
${documentation-highlighter}/LICENSE \
${documentation-highlighter}/mono-blue.css \
${documentation-highlighter}/loader.js

# Copy anchor scripts to the script directory in document root.
cp -vt "$dest"/script \
${./static/script}/anchor-min.js \
${./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 \
${compileStylesheet}/style.css

# Move release notes
cp -vr ${./release-notes} release-notes

# Generate final manual from a set of parameters. Explanation of the CLI flags are
# as follows:
#
# 1. --manpage-urls will allow you to use manual pages as they are defined in
# the nixpkgs documentation.
# 2. --revision is the project revision as it is defined in 'release.json' in the
# repository root
# 3. --script will inject a given Javascript file into the resulting pages inside
# the <script> tag.
# 4. --toc-depth will determine the depth of the initial Table of Contents while
# --section-toc-depth will determine the depth of per-section Table of Contents
# sections.
nixos-render-docs manual html \
--manpage-urls ${path + "/doc/manpage-urls.json"} \
--revision ${lib.trivial.revisionWithDefault manual-release} \
--stylesheet style.css \
--script highlightjs/highlight.pack.js \
--script highlightjs/loader.js \
--script script/anchor-use.js \
--script script/anchor-min.js \
--script script/search.js \
--toc-depth 1 \
--section-toc-depth 1 \
manual.md \
"$dest/index.xhtml"

# Hydra support. Probably not necessary.
mkdir -p $out/nix-support/
echo "doc manual $dest index.html" >> $out/nix-support/hydra-build-products
'';
}
runCommandNoCCLocal "nvf-docs-html" {
nativeBuildInputs = [
(inputs.ndg.packages.${stdenvNoCC.system}.ndg.overrideAttrs
{
# FIXME: the tests take too long to build
doCheck = false;
})
];
} ''
mkdir -p $out/share/doc

# Copy the markdown sources to be processed by ndg. This is not
# strictly necessary, but allows us to modify the Markdown sources
# as we see fit.
cp -rvf ${./manual} ./manual

# Replace variables following the @VARIABLE@ style in the manual
# pages. This can be built into ndg at a later date.
substituteInPlace ./manual/index.md \
--subst-var-by NVF_VERSION ${manual-release}

# Generate the final manual from a set of parameters. This uses
# feel-co/ndg to render the web manual.
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
''
3 changes: 2 additions & 1 deletion docs/manual/configuring.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Configuring nvf {#ch-configuring}

[helpful tips section]: #ch-helpful-tips
[options reference]: /nvf/options.html

nvf allows for _very_ extensive configuration in Neovim through the Nix module
interface. The below chapters describe several of the options exposed in nvf for
your convenience. You might also be interested in the [helpful tips section] for
more advanced or unusual configuration options supported by nvf.

Note that this section does not cover module _options_. For an overview of all
module options provided by nvf, please visit the [appendix](/nvf/options.html)
module options provided by nvf, please visit the [options reference]

```{=include=} chapters
configuring/custom-package.md
Expand Down
22 changes: 0 additions & 22 deletions docs/manual/configuring/custom-package.md

This file was deleted.

Loading