diff --git a/docs/default.nix b/docs/default.nix index 49f90b80d..662dd4030 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -92,7 +92,7 @@ # Generate the HTML manual pages html = pkgs.callPackage ./manual.nix { - inherit release; + inherit inputs release; inherit (nvimModuleDocs) optionsJSON; }; in { diff --git a/docs/manual.nix b/docs/manual.nix index 50a5dab4c..8b80f2e49 100644 --- a/docs/manual.nix +++ b/docs/manual.nix @@ -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