docs: refactor serve-docs; add nix run .#docs

Refactor `serve-docs` using `makeWrapper`, make it available as a
`serve-docs` package and as the `docs` "app".

This means `nix build .#docs` will build the docs while `nix run .#docs`
will run the server.
This commit is contained in:
Matt Sturgeon 2025-05-21 17:27:28 +01:00
parent 5c49988a7c
commit f3342bdbd4
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
5 changed files with 28 additions and 8 deletions

View file

@ -101,14 +101,7 @@
help = "Build and serve documentation locally";
command = ''
echo -e "=> Building nixvim documentation...\n"
doc_derivation=$(${nix} build .#docs --no-link --print-out-paths)
echo -e "\n=> Documentation successfully built ('$doc_derivation')"
echo -e "\n=> You can then open your browser to view the doc\n"
(cd "$doc_derivation"/share/doc && ${pkgs.lib.getExe pkgs.python3} ${./server.py})
nix run .#docs
'';
}
{