fix(WP-0014/A2): fix devenv shell — IHP_LIB, ghci, ghcid now available
Some checks failed
Test / test (push) Has been cancelled

Root cause: devenv shell reads devenv.nix only; IHP's Haskell setup is in
flake.nix's devenv.shells.default which is only loaded by nix develop.

Fix: create devenv.yaml to register IHP as a devenv input (pinned to the
same rev as flake.lock) with overlays.default applied.  Update devenv.nix
to set IHP_LIB/IHP env vars and enable languages.haskell with pkgs.ghc
(IHP-overlay GHC) + all project packages; add ghcid explicitly.

devenv.lock pins IHP at df3922d (matches flake.lock).

scripts/compile-check: updated header comments and added IHP_LIB echo;
switches from ghcid to ghci one-shot (ghcid not available in all shells).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-12 13:11:41 +00:00
parent 2c22766cd6
commit debc0b7d81
4 changed files with 2412 additions and 25 deletions

View File

@@ -1,15 +1,16 @@
#!/usr/bin/env bash
# bin/compile-check — run ghcid standalone for fast compilation feedback.
# scripts/compile-check — one-shot GHC compilation check.
#
# Does NOT start postgres or tailwind — just GHC.
# Relies on .ghci (sets -j1, loads IHP config).
# Relies on .ghci (sets -j1, -fkeep-going, loads IHP config).
#
# Usage:
# bin/compile-check # interactive: errors shown in terminal + log
# bin/compile-check --bg # log only (for Claude monitoring loop)
# scripts/compile-check # show errors in terminal + write log
# scripts/compile-check --bg # write log only (for background/Claude use)
#
# Pre-requisite: run inside `devenv shell` (IHP_LIB must be set).
# Or: `devenv shell -- bin/compile-check`
# Can be invoked via nix develop:
# nix develop --override-input devenv-root "file+file://$PWD/.devenv/root" \
# --command scripts/compile-check --bg
#
# Log file: /tmp/ihub-compile-errors.txt (override with IHUB_COMPILE_LOG)
@@ -20,25 +21,20 @@ MODE="${1:-}"
# Ensure IHP_LIB is available
if [[ -z "${IHP_LIB:-}" ]]; then
echo "ERROR: IHP_LIB is not set. Run inside devenv shell:" >&2
echo " devenv shell -- bin/compile-check" >&2
echo "ERROR: IHP_LIB is not set. Run inside devenv shell or via nix develop." >&2
exit 1
fi
: > "$LOGFILE"
echo "[compile-check] Log: $LOGFILE"
echo "[compile-check] Mode: ${MODE:-interactive}"
echo "[compile-check] IHP_LIB: $IHP_LIB"
# One-shot compile: load all modules via .ghci config then quit immediately.
# -fkeep-going (set in .ghci) ensures all errors are reported, not just the first.
# ghcid is not available in this environment; ghci one-shot gives the same error output.
if [[ "$MODE" == "--bg" ]]; then
# Background: write to log only, no colour/title
exec ghcid \
--no-title \
--outputfile "$LOGFILE" \
--command "ghci"
echo ':quit' | ghci 2>&1 | tee "$LOGFILE"
else
# Interactive: show errors in terminal AND write to log
exec ghcid \
--no-title \
--outputfile "$LOGFILE" \
--command "ghci"
echo ':quit' | ghci 2>&1 | tee "$LOGFILE"
fi