23 lines
388 B
Nix
23 lines
388 B
Nix
# 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[@]}"
|
|
'';
|
|
}
|