# 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" ''