{pkgs', ...}: let releaseInfo = import ../config/release.nix; in pkgs'.writeShellScriptBin "start-server" '' source ${pkgs'.common}/bin/common echo_section "Starting server" echo_hint "This script will start the server in the current working directory." echo_hint "The command is executed in the current working directory and not in a nix derivation." cd_working_dir echo_step "Starting server" export WORKING_DIR=$(pwd) export RUN_DIR=$(${pkgs'.mktemp}/bin/mktemp -d -t run-XXXXXX) if [ -z "$RUN_DIR" ] || [ ! -d "$RUN_DIR" ]; then echo_fail "Failed to create temporary run directory" exit 1 fi echo_ok "Temporary run directory created: $RUN_DIR" export VERSION=${releaseInfo.version} export COMMIT=${releaseInfo.commit} export PNPX_BIN=${pkgs'.nodePackages.npm}/bin/npx export NODE_BIN=${pkgs'.projectNodeJS}/bin/node export LOCALHOST_CERTS_DIR=${pkgs'.alvineDevCerts} cd development if [ ! -d ./config/ ]; then ${pkgs'.coreutils}/bin/mkdir -p ./config fi declare -a configFiles=($(find ./templates/ -depth -mindepth 1 -maxdepth 1)) for configFile in "''${configFiles[@]}"; do if [ -f ''${configFile} ]; then echo_ok "Using ''${configFile#./templates/} configuration" t="./config/''${configFile#./templates/}" t=$(echo $t | sed 's/_/\//g') ${pkgs'.coreutils}/bin/mkdir -p $(dirname $t) ${pkgs'.envsubst}/bin/envsubst < ''${configFile} > ''${t} fi done if [ ! -f ./config/vite.config.mjs ]; then echo_fail "Vite config not found" exit 1 fi ## --inspect-brk (debug flag) if ! ${pkgs'.projectNodeJS}/bin/node "$WORKING_DIR/node_modules/vite/bin/vite.js" --config "./config/vite.config.mjs"; then echo_fail "Vite build failed, check your JS!" exit 1 fi echo_step "Cleaning up" ''