1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-09 12:49:44 +01:00
home-manager/docs/home-manager-manual.nix
Mario Rodas 8bdb74eaff
docs: add redirect from the previous options.html
After migrating to nixos-render-docs, the extension move to .xtml.
Unfortunately, this broke links to the previous Options Page.

This patch provides a basic redirect support to the new Options Page.
2024-06-09 13:09:00 +02:00

63 lines
1.8 KiB
Nix

{ stdenv, lib, documentation-highlighter, revision, home-manager-options
, nixos-render-docs }:
let outputPath = "share/doc/home-manager";
in stdenv.mkDerivation {
name = "home-manager-manual";
nativeBuildInputs = [ nixos-render-docs ];
src = ./manual;
buildPhase = ''
mkdir -p out/{highlightjs,media}
cp -t out/highlightjs \
${documentation-highlighter}/highlight.pack.js \
${documentation-highlighter}/LICENSE \
${documentation-highlighter}/mono-blue.css \
${documentation-highlighter}/loader.js
substituteInPlace ./options.md \
--subst-var-by \
OPTIONS_JSON \
${home-manager-options.home-manager}/share/doc/nixos/options.json
substituteInPlace ./nixos-options.md \
--subst-var-by \
OPTIONS_JSON \
${home-manager-options.nixos}/share/doc/nixos/options.json
substituteInPlace ./nix-darwin-options.md \
--subst-var-by \
OPTIONS_JSON \
${home-manager-options.nix-darwin}/share/doc/nixos/options.json
cp ${./options.html} out/options.html
cp ${./static/style.css} out/style.css
cp -r ${./release-notes} release-notes
nixos-render-docs manual html \
--manpage-urls ./manpage-urls.json \
--revision ${lib.trivial.revisionWithDefault revision} \
--stylesheet style.css \
--script highlightjs/highlight.pack.js \
--script highlightjs/loader.js \
--toc-depth 1 \
--section-toc-depth 1 \
manual.md \
out/index.xhtml
'';
installPhase = ''
dest="$out/${outputPath}"
mkdir -p "$(dirname "$dest")"
mv out "$dest"
mkdir -p $out/nix-support/
echo "doc manual $dest index.html" >> $out/nix-support/hydra-build-products
'';
meta = { maintainers = [ lib.maintainers.considerate ]; };
}