feat: Add Nix app to serve frontend with Python HTTP server

This commit is contained in:
Greg Shuflin (aider) 2025-04-07 19:27:41 -07:00
parent fc1b37333b
commit b8265ae360

View File

@ -27,6 +27,14 @@
installPhase = ''
mkdir -p $out
cp -r dist/* $out/
# Create a bin directory with a wrapper script
mkdir -p $out/bin
cat > $out/bin/frontend <<EOF
#!/bin/sh
${pkgs.python3}/bin/python -m http.server --directory $out 8000
EOF
chmod +x $out/bin/frontend
'';
};
in
@ -36,6 +44,11 @@
default = frontend;
};
apps.default = {
type = "app";
program = "${frontend}/bin/frontend";
};
devShells.default = pkgs.mkShell {
buildInputs = [
pkgs.nodejs