nix-community.nixvim/docs.nix

36 lines
820 B
Nix
Raw Normal View History

2022-12-29 17:34:47 +00:00
{ 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 = ''
2022-12-29 17:36:54 +00:00
mkdir -p $out/share/doc
2022-12-29 17:34:47 +00:00
cat <<EOF > header.adoc
= NixVim options
This lists all the options available for NixVim.
:toc:
EOF
cat header.adoc $src > tmp.adoc
2022-12-29 17:36:54 +00:00
asciidoctor tmp.adoc -o $out/share/doc/index.html
2022-12-29 17:34:47 +00:00
'';
}