docs: fix documentation generation

This commit is contained in:
Pedro Alves 2022-12-29 17:34:47 +00:00
parent 5f67918bae
commit dd9ec124a2
41 changed files with 55 additions and 552 deletions

35
docs.nix Normal file
View file

@ -0,0 +1,35 @@
{ pkgs, lib, modules, ... }:
let
options = lib.evalModules {
modules = modules;
specialArgs = { inherit pkgs lib; };
};
docs = pkgs.nixosOptionsDoc {
# If we don't do this, we end up with _module.args on the generated options, which we do not want
options = lib.filterAttrs (k: _: k != "_module") options.options;
warningsAreErrors = false;
};
asciidoc = docs.optionsAsciiDoc;
in
pkgs.stdenv.mkDerivation {
name = "nixvim-docs";
src = asciidoc;
buildInputs = [
pkgs.asciidoctor
];
phases = [ "buildPhase" ];
buildPhase = ''
mkdir -p $out/share
cat <<EOF > header.adoc
= NixVim options
This lists all the options available for NixVim.
:toc:
EOF
cat header.adoc $src > tmp.adoc
asciidoctor tmp.adoc -o $out/share/index.html
'';
}