fix(build): simplify GHC 9.10.3 overlay — drop Generated.Types stub
Some checks failed
Build and Deploy / build-push-deploy (push) Has been cancelled

The inter-hub-lib postUnpack that expanded `import Generated.Types` to
119 individual imports was incorrect: it deleted `module Generated.Types`
from Prelude export lists without replacing it, so consumers of the
Prelude lost all entity types (Build 32: GHC-76037 not-in-scope errors).

Fix: keep Generated.Types as a real module in inter-hub-models (remove the
empty stub). With the ActualTypes.hi fix already in place (explicit T(..)
exports), the cascade is shallow: each entity .hi is compact, so
Generated.Types.hi stays well under GHC's 274 MB limit. This makes
`import Generated.Types` work normally throughout inter-hub-lib without
any source patching.

The entire inter-hub-lib overrideAttrs block is removed; the
inter-hub-models overlay now only rewrites ActualTypes.hs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-02 17:09:00 +02:00
parent 80512727cb
commit 8aee7825c7

View File

@@ -126,7 +126,6 @@
"--ghc-option=-fomit-interface-pragmas"
"--disable-split-sections"
"--ghc-option=-j1"
"--disable-shared"
# GHC 9.10.3 bug: libHSghc-9.10.3-5702.a is truncated (last AR
# entry Expr.o claims 517544 bytes but only 82258 remain).
# GHC's internal static linker (readAr via Data.Binary.Get) panics
@@ -168,35 +167,6 @@
printf 'module Generated.ActualTypes\n ( %s ) where\n' "$_exports"
printf '%s\n' "$_imports"
} > "$_actual.new" && mv "$_actual.new" "$_actual"
# Stub Generated.Types (inter-hub-lib reads original from its sourceRoot)
printf '%s\n' 'module Generated.Types () where' \
> "$sourceRoot/build/Generated/Types.hs"
'';
})
else if (args.pname or "") == "inter-hub-lib"
then drv.overrideAttrs (old: {
# Generated.Types is an empty stub in models — hub removed to avoid
# module M re-export crash. Replace every bare `import Generated.Types`
# with direct imports of the 119 individual entity modules.
# Generated.ActualTypes hub is still functional (explicit T(..) exports),
# so no patching needed for ActualTypes imports in this package.
postUnpack = (old.postUnpack or "") + ''
_types="$sourceRoot/build/Generated/Types.hs"
_imp=$(mktemp)
awk '/^import Generated\./{print "import " $2}' "$_types" > "$_imp"
find "$sourceRoot" -name "*.hs" | while IFS= read -r _f; do
if grep -qE "^import Generated\.Types$" "$_f"; then
awk -v imp="$_imp" '
/^import Generated\.Types$/{
while ((getline ln < imp) > 0) print ln
close(imp)
next
}
{ print }' "$_f" > "$_f.new" && mv "$_f.new" "$_f"
fi
done
rm -f "$_imp"
'';
})
else drv;