Skip to content

docs/server: simplify using http-server #3406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 19 additions & 18 deletions docs/server/default.nix
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
{
lib,
runCommand,
makeBinaryWrapper,
python3,
xdg-utils,
docs,
http-server,
writeShellApplication,
}:
runCommand "serve-docs"
{
nativeBuildInputs = [ makeBinaryWrapper ];
meta.mainProgram = "server";
}
''
mkdir -p $out/bin
makeWrapper ${lib.getExe python3} \
$out/bin/server \
--add-flags ${./server.py} \
--chdir ${docs} \
--prefix PATH : ${lib.makeBinPath [ xdg-utils ]}
''
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[@]}"
'';
}
25 changes: 0 additions & 25 deletions docs/server/server.py

This file was deleted.