feat(docs): server
This commit is contained in:
parent
110efa2bd6
commit
f0a1b103e0
3 changed files with 27 additions and 1 deletions
|
|
@ -18,12 +18,14 @@
|
||||||
generator uses orderKey of type "{num}|{mdPath}" and derives indentation from path's depth,
|
generator uses orderKey of type "{num}|{mdPath}" and derives indentation from path's depth,
|
||||||
so chapters have proper order.
|
so chapters have proper order.
|
||||||
|
|
||||||
run `nix build .#docBuild` to build documentation
|
run `nix build .#docBuild` to build documentation.
|
||||||
|
run `nix run .#docServe` to serve documentation site
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
perSystem =
|
perSystem =
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
rec {
|
rec {
|
||||||
packages.docBuild = pkgs.callPackage ../docs/docgen.nix { };
|
packages.docBuild = pkgs.callPackage ../docs/docgen.nix { };
|
||||||
|
packages.docServe = pkgs.callPackage ../docs/server.nix { doc = packages.docBuild; };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ stdenvNoCC.mkDerivation {
|
||||||
".*flake\\.nix$"
|
".*flake\\.nix$"
|
||||||
|
|
||||||
"docs/docgen.nix"
|
"docs/docgen.nix"
|
||||||
|
"docs/server.nix"
|
||||||
];
|
];
|
||||||
|
|
||||||
shouldExclude = relPath: lib.any (pattern: builtins.match pattern relPath != null) excluded;
|
shouldExclude = relPath: lib.any (pattern: builtins.match pattern relPath != null) excluded;
|
||||||
|
|
|
||||||
23
docs/server.nix
Normal file
23
docs/server.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
# from `nix-community/stylix`
|
||||||
|
{
|
||||||
|
doc,
|
||||||
|
http-server,
|
||||||
|
writeShellApplication,
|
||||||
|
}:
|
||||||
|
writeShellApplication {
|
||||||
|
name = "serve-docs";
|
||||||
|
runtimeInputs = [ http-server ];
|
||||||
|
runtimeEnv.server_flags = [
|
||||||
|
# Search for available port
|
||||||
|
"--port=0"
|
||||||
|
|
||||||
|
# Disable browser cache
|
||||||
|
"-c-1"
|
||||||
|
|
||||||
|
# Open using xdg-open
|
||||||
|
"-o"
|
||||||
|
];
|
||||||
|
text = ''
|
||||||
|
http-server ${doc} "''${server_flags[@]}"
|
||||||
|
'';
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue