From 8aee7825c78c8581621050d0fc95f6897b3dbdb6 Mon Sep 17 00:00:00 2001 From: tegwick Date: Sat, 2 May 2026 17:09:00 +0200 Subject: [PATCH] =?UTF-8?q?fix(build):=20simplify=20GHC=209.10.3=20overlay?= =?UTF-8?q?=20=E2=80=94=20drop=20Generated.Types=20stub?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- flake.nix | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/flake.nix b/flake.nix index 0961922..e1e41a8 100644 --- a/flake.nix +++ b/flake.nix @@ -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;