mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-26 15:06:45 +00:00
docs: filter source by markdown
This commit is contained in:
parent
67927b5f65
commit
2d08f3ad39
3 changed files with 26 additions and 16 deletions
|
@ -2,11 +2,17 @@
|
||||||
inputs,
|
inputs,
|
||||||
pkgs,
|
pkgs,
|
||||||
lib ? import ../lib/stdlib-extended.nix pkgs.lib inputs,
|
lib ? import ../lib/stdlib-extended.nix pkgs.lib inputs,
|
||||||
|
manpageUrls ? pkgs.path + "/doc/manpage-urls.json",
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkForce evalModules;
|
inherit (lib.modules) mkForce evalModules;
|
||||||
inherit (lib.strings) hasPrefix removePrefix;
|
inherit (lib.strings) hasPrefix removePrefix;
|
||||||
inherit (lib.attrsets) isAttrs mapAttrs optionalAttrs recursiveUpdate isDerivation;
|
inherit (lib.attrsets) isAttrs mapAttrs optionalAttrs recursiveUpdate isDerivation;
|
||||||
|
inherit (builtins) fromJSON readFile;
|
||||||
|
|
||||||
|
# release data
|
||||||
|
release-config = fromJSON (readFile ../release.json);
|
||||||
|
revision = release-config.release;
|
||||||
|
|
||||||
# From home-manager:
|
# From home-manager:
|
||||||
#
|
#
|
||||||
|
@ -54,11 +60,14 @@
|
||||||
buildOptionsDocs = args @ {
|
buildOptionsDocs = args @ {
|
||||||
modules,
|
modules,
|
||||||
includeModuleSystemOptions ? true,
|
includeModuleSystemOptions ? true,
|
||||||
|
warningsAreErrors ? true,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit ((evalModules {inherit modules;})) options;
|
inherit ((evalModules {inherit modules;})) options;
|
||||||
|
|
||||||
# Declaration of the Github site URL.
|
# Declaration of the Github site URL.
|
||||||
|
# Takes a user, repo, and subpath, and returns a declaration site
|
||||||
|
# as a string.
|
||||||
githubDeclaration = user: repo: subpath: let
|
githubDeclaration = user: repo: subpath: let
|
||||||
urlRef = "github.com";
|
urlRef = "github.com";
|
||||||
branch = "main";
|
branch = "main";
|
||||||
|
@ -68,10 +77,13 @@
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
pkgs.buildPackages.nixosOptionsDoc ({
|
pkgs.buildPackages.nixosOptionsDoc ({
|
||||||
|
inherit warningsAreErrors;
|
||||||
|
|
||||||
options =
|
options =
|
||||||
if includeModuleSystemOptions
|
if includeModuleSystemOptions
|
||||||
then options
|
then options
|
||||||
else builtins.removeAttrs options ["_module"];
|
else builtins.removeAttrs options ["_module"];
|
||||||
|
|
||||||
transformOptions = opt:
|
transformOptions = opt:
|
||||||
recursiveUpdate opt {
|
recursiveUpdate opt {
|
||||||
# Clean up declaration sites to not refer to the neovim-flakee
|
# Clean up declaration sites to not refer to the neovim-flakee
|
||||||
|
@ -93,18 +105,16 @@
|
||||||
// builtins.removeAttrs args ["modules" "includeModuleSystemOptions"]);
|
// builtins.removeAttrs args ["modules" "includeModuleSystemOptions"]);
|
||||||
|
|
||||||
nvimModuleDocs = buildOptionsDocs {
|
nvimModuleDocs = buildOptionsDocs {
|
||||||
|
variablelistId = "neovim-flake-options";
|
||||||
|
|
||||||
modules =
|
modules =
|
||||||
import ../modules/modules.nix {
|
import ../modules/modules.nix {
|
||||||
inherit lib pkgs;
|
inherit lib pkgs;
|
||||||
check = false;
|
check = false;
|
||||||
}
|
}
|
||||||
++ [scrubbedPkgsModule];
|
++ [scrubbedPkgsModule];
|
||||||
variablelistId = "neovim-flake-options";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
release-config = builtins.fromJSON (builtins.readFile ../release.json);
|
|
||||||
revision = release-config.release;
|
|
||||||
|
|
||||||
# Generate the `man home-configuration.nix` package
|
# Generate the `man home-configuration.nix` package
|
||||||
nvf-configuration-manual =
|
nvf-configuration-manual =
|
||||||
pkgs.runCommand "neovim-flake-reference-manpage" {
|
pkgs.runCommand "neovim-flake-reference-manpage" {
|
||||||
|
@ -125,7 +135,7 @@
|
||||||
|
|
||||||
# Generate the HTML manual pages
|
# Generate the HTML manual pages
|
||||||
neovim-flake-manual = pkgs.callPackage ./manual.nix {
|
neovim-flake-manual = pkgs.callPackage ./manual.nix {
|
||||||
inherit revision;
|
inherit revision manpageUrls;
|
||||||
outputPath = "share/doc/neovim-flake";
|
outputPath = "share/doc/neovim-flake";
|
||||||
options = {
|
options = {
|
||||||
neovim-flake = nvimModuleDocs.optionsJSON;
|
neovim-flake = nvimModuleDocs.optionsJSON;
|
||||||
|
|
|
@ -1,16 +1,19 @@
|
||||||
{
|
{
|
||||||
stdenv,
|
|
||||||
lib,
|
lib,
|
||||||
documentation-highlighter,
|
stdenvNoCC,
|
||||||
revision,
|
# build inputs
|
||||||
outputPath ? "share/doc/neovim-flake",
|
|
||||||
options,
|
|
||||||
nixos-render-docs,
|
nixos-render-docs,
|
||||||
|
documentation-highlighter,
|
||||||
|
# nrd configuration
|
||||||
|
manpageUrls,
|
||||||
|
revision,
|
||||||
|
options,
|
||||||
|
outputPath ? "share/doc/neovim-flake",
|
||||||
}:
|
}:
|
||||||
stdenv.mkDerivation {
|
stdenvNoCC.mkDerivation {
|
||||||
name = "neovim-flake-manual";
|
name = "neovim-flake-manual";
|
||||||
src = builtins.path {
|
src = builtins.path {
|
||||||
path = ./manual;
|
path = lib.sourceFilesBySuffices ./manual [".md"];
|
||||||
name = "neovim-flake-manual";
|
name = "neovim-flake-manual";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -43,7 +46,7 @@ stdenv.mkDerivation {
|
||||||
|
|
||||||
# generate manual from
|
# generate manual from
|
||||||
nixos-render-docs manual html \
|
nixos-render-docs manual html \
|
||||||
--manpage-urls ./manpage-urls.json \
|
--manpage-urls ${manpageUrls} \
|
||||||
--revision ${lib.trivial.revisionWithDefault revision} \
|
--revision ${lib.trivial.revisionWithDefault revision} \
|
||||||
--stylesheet style.css \
|
--stylesheet style.css \
|
||||||
--script highlightjs/highlight.pack.js \
|
--script highlightjs/highlight.pack.js \
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"nix.conf(5)": "https://nixos.org/manual/nix/stable/command-ref/conf-file.html"
|
|
||||||
}
|
|
Loading…
Reference in a new issue