Adds: - `serve-docs` to the default devShell - `packages.serve-docs` - `apps.docs` Having `apps.docs` defined causes `nix run .#docs` to run the "app" instead of `packages.docs`. `nix build .#docs` will still build the "package", not the "app". The `serve-docs` script added to the devShell runs `nix run .#docs` instead of having `packages.serve-docs` in its closure. This avoids the devShell actually building the docs. Added a note to `doc/src/modules.md`. Link: https://github.com/nix-community/stylix/pull/1328 Reviewed-by: awwpotato <awwpotato@voidq.com> Co-authored-by: NAHO <90870942+trueNAHO@users.noreply.github.com> Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
22 lines
360 B
Nix
22 lines
360 B
Nix
{
|
|
docs,
|
|
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 ${docs} "''${server_flags[@]}"
|
|
'';
|
|
}
|