generated from coulomb/repo-seed
fix(WP-0014/A2): fix devenv shell — IHP_LIB, ghci, ghcid now available
Some checks failed
Test / test (push) Has been cancelled
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:
2340
devenv.lock
Normal file
2340
devenv.lock
Normal file
File diff suppressed because it is too large
Load Diff
58
devenv.nix
58
devenv.nix
@@ -8,17 +8,61 @@
|
||||
# Duplicates the settings from flake.nix devenv.shells.default so they
|
||||
# are applied under both devenv v1 (flake path) and devenv v2 (this file).
|
||||
{ pkgs, lib, config, inputs, ... }:
|
||||
# devenv.nix — devenv v2 shell configuration.
|
||||
#
|
||||
# `devenv shell` reads only this file (not flake.nix's devenv.shells.default).
|
||||
# IHP's flake module configures devenv.shells.default — that is only visible
|
||||
# to `nix develop`. This file therefore duplicates the IHP-critical parts so
|
||||
# that `devenv shell` also has a working Haskell + IHP_LIB environment.
|
||||
#
|
||||
# devenv.yaml registers IHP as a devenv input (pinned rev matching flake.lock)
|
||||
# and applies IHP's nixpkgs overlay, making pkgs.ghc the IHP Haskell package
|
||||
# set (ihp, ihp-hspec, ghcid, etc.).
|
||||
{
|
||||
# Resource limits for constrained host (2 CPU / 3.8 GiB RAM).
|
||||
# -A32m: smaller minor heap, -M2g: hard heap ceiling.
|
||||
# Note: -N1 omitted intentionally (requires -threaded, breaks IHP tools).
|
||||
# GHC parallel module compilation is capped via -j1 in .ghci instead.
|
||||
# ── Resource limits (constrained host: 2 CPU / ~3.8 GiB RAM) ─────────────
|
||||
# -A32m: smaller minor heap; -M2g: hard heap ceiling.
|
||||
# -N1 omitted: requires -threaded, which breaks IHP tools.
|
||||
# GHC parallel module compilation is capped via -j1 in .ghci.
|
||||
env.GHCRTS = "-A32m -M2g";
|
||||
|
||||
# Make tailwindcss available in process scripts (devenv v2 builds process
|
||||
# scripts with only packages declared here, not from flake ihp.packages).
|
||||
packages = [ pkgs.nodePackages.tailwindcss ];
|
||||
# ── IHP environment variables ─────────────────────────────────────────────
|
||||
# IHP_LIB is read by .ghci (applicationGhciConfig) and by scripts/compile-check.
|
||||
# IHP is the legacy name used by older Makefiles.
|
||||
env.IHP_LIB = "${inputs.ihp.packages.${pkgs.stdenv.system}.ihp-env-var-backwards-compat}";
|
||||
env.IHP = "${inputs.ihp.packages.${pkgs.stdenv.system}.ihp-env-var-backwards-compat}";
|
||||
|
||||
# ── Haskell toolchain ─────────────────────────────────────────────────────
|
||||
# IHP's nixpkgs overlay (applied via devenv.yaml overlays) makes pkgs.ghc
|
||||
# the IHP-augmented Haskell package set. pkgs.ghc.ghc is the GHC compiler.
|
||||
languages.haskell.enable = true;
|
||||
languages.haskell.package = pkgs.ghc.ghc.withPackages (p: with p; [
|
||||
p.ihp
|
||||
# Project runtime dependencies (mirrors flake.nix haskellPackages)
|
||||
http-conduit
|
||||
aeson
|
||||
string-conversions
|
||||
cryptohash-sha256
|
||||
base16-bytestring
|
||||
random-bytestring
|
||||
yaml
|
||||
network-uri
|
||||
# Dev / test tools
|
||||
cabal-install
|
||||
hlint
|
||||
hspec
|
||||
p.ihp-hspec
|
||||
]);
|
||||
# ghcid is used by scripts/compile-check-core; not auto-added by devenv.
|
||||
# LSP disabled — heavy binary not needed for CI-style compile checks.
|
||||
languages.haskell.lsp.enable = false;
|
||||
|
||||
# ── Extra packages ────────────────────────────────────────────────────────
|
||||
packages = [
|
||||
pkgs.ghc.ghcid
|
||||
pkgs.nodePackages.tailwindcss
|
||||
];
|
||||
|
||||
# ── Processes ─────────────────────────────────────────────────────────────
|
||||
# Tailwind CSS watcher — not part of IHP's core devenv module.
|
||||
processes.tailwind.exec = "tailwindcss -c tailwind/tailwind.config.js -i ./tailwind/app.css -o static/app.css --watch=always";
|
||||
}
|
||||
|
||||
7
devenv.yaml
Normal file
7
devenv.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
inputs:
|
||||
ihp:
|
||||
# Pinned to the same rev as flake.lock so devenv shell and nix develop
|
||||
# use identical IHP packages. Update by running: devenv update
|
||||
url: github:digitallyinduced/ihp/df3922d1a7166b131674efa3d3555ed7195ddf70
|
||||
overlays:
|
||||
- default
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user