diff --git a/docs/default.nix b/docs/default.nix index 8b60f23..7c2f3fe 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -2,11 +2,17 @@ inputs, pkgs, lib ? import ../lib/stdlib-extended.nix pkgs.lib inputs, + manpageUrls ? pkgs.path + "/doc/manpage-urls.json", ... }: let inherit (lib.modules) mkForce evalModules; inherit (lib.strings) hasPrefix removePrefix; 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: # @@ -54,11 +60,14 @@ buildOptionsDocs = args @ { modules, includeModuleSystemOptions ? true, + warningsAreErrors ? true, ... }: let inherit ((evalModules {inherit modules;})) options; # 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 urlRef = "github.com"; branch = "main"; @@ -68,10 +77,13 @@ }; in pkgs.buildPackages.nixosOptionsDoc ({ + inherit warningsAreErrors; + options = if includeModuleSystemOptions then options else builtins.removeAttrs options ["_module"]; + transformOptions = opt: recursiveUpdate opt { # Clean up declaration sites to not refer to the neovim-flakee @@ -93,18 +105,16 @@ // builtins.removeAttrs args ["modules" "includeModuleSystemOptions"]); nvimModuleDocs = buildOptionsDocs { + variablelistId = "neovim-flake-options"; + modules = import ../modules/modules.nix { inherit lib pkgs; check = false; } ++ [scrubbedPkgsModule]; - variablelistId = "neovim-flake-options"; }; - release-config = builtins.fromJSON (builtins.readFile ../release.json); - revision = release-config.release; - # Generate the `man home-configuration.nix` package nvf-configuration-manual = pkgs.runCommand "neovim-flake-reference-manpage" { @@ -125,7 +135,7 @@ # Generate the HTML manual pages neovim-flake-manual = pkgs.callPackage ./manual.nix { - inherit revision; + inherit revision manpageUrls; outputPath = "share/doc/neovim-flake"; options = { neovim-flake = nvimModuleDocs.optionsJSON; diff --git a/docs/manual.nix b/docs/manual.nix index 44472b5..c944b3f 100644 --- a/docs/manual.nix +++ b/docs/manual.nix @@ -1,16 +1,19 @@ { - stdenv, lib, - documentation-highlighter, - revision, - outputPath ? "share/doc/neovim-flake", - options, + stdenvNoCC, + # build inputs nixos-render-docs, + documentation-highlighter, + # nrd configuration + manpageUrls, + revision, + options, + outputPath ? "share/doc/neovim-flake", }: -stdenv.mkDerivation { +stdenvNoCC.mkDerivation { name = "neovim-flake-manual"; src = builtins.path { - path = ./manual; + path = lib.sourceFilesBySuffices ./manual [".md"]; name = "neovim-flake-manual"; }; @@ -43,7 +46,7 @@ stdenv.mkDerivation { # generate manual from nixos-render-docs manual html \ - --manpage-urls ./manpage-urls.json \ + --manpage-urls ${manpageUrls} \ --revision ${lib.trivial.revisionWithDefault revision} \ --stylesheet style.css \ --script highlightjs/highlight.pack.js \ diff --git a/docs/manual/manpage-urls.json b/docs/manual/manpage-urls.json deleted file mode 100644 index fba2bdd..0000000 --- a/docs/manual/manpage-urls.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "nix.conf(5)": "https://nixos.org/manual/nix/stable/command-ref/conf-file.html" -}