Add web-app with machine-specific builds

Implements per-machine customization for web-app deployment:
- Shared web-app source code deployed to all machines
- Machine-specific .env files and images
- Build helper script to assemble and build on target machines

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
padreug 2025-09-30 11:15:31 +02:00
parent c6d226778d
commit a84ebea315
5 changed files with 134 additions and 0 deletions

29
build-helper.nix Normal file
View file

@ -0,0 +1,29 @@
# Helper script for building the web-app on target machines
# This can be imported into the machine's configuration.nix
{ pkgs }:
pkgs.writeShellScriptBin "build-web-app" ''
set -e
# Web-app sources are deployed to /var/src by krops
WEB_APP_DIR="/var/src/web-app"
ENV_FILE="/var/src/web-app-env"
IMAGES_DIR="/var/src/web-app-images"
cd "$WEB_APP_DIR"
# Copy machine-specific .env file
echo "Copying machine-specific .env file..."
cp "$ENV_FILE" .env
# Copy machine-specific images to public folder
echo "Copying machine-specific images..."
cp -r "$IMAGES_DIR"/* public/
# Build the web-app
echo "Building web-app..."
${pkgs.nodejs}/bin/npm run build
echo "Build complete! Output in $WEB_APP_DIR/dist"
''