Build hatter as cached cabal package for iOS/watchOS#214
Closed
jappeace-sloth wants to merge 1 commit intojappeace:masterfrom
Closed
Build hatter as cached cabal package for iOS/watchOS#214jappeace-sloth wants to merge 1 commit intojappeace:masterfrom
jappeace-sloth wants to merge 1 commit intojappeace:masterfrom
Conversation
Mirror the Android approach from cross-deps.nix: build hatter via callCabal2nix in ios-deps.nix so the .a and package DB entry are cached. Demo apps and consumers only recompile Main.hs + run_main.c (the per-app entry point) instead of all 22 Hatter modules + 19 C sources from scratch every time. Changes: - ios-deps.nix: add hatterSrc param, hatterOverride (strips exe/test stanzas), compose into overrides, collect hatter .a in deps - ios.nix, watchos.nix: pass hatterSrc = ../. to ios-deps.nix - lib.nix: when crossDeps is provided, mkIOSLib and mkWatchOSLib skip copying Hatter/*.hs and cbits/*.c, only compile run_main.c + Main.hs with -package-db pointing at the cached pkgdb. Standalone fallback (crossDeps == null) keeps current from-source behavior. Prompt: Implement the plan to build hatter as a cached package for iOS/watchOS (like Android) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Apr 21, 2026
Author
jappeace
pushed a commit
that referenced
this pull request
Apr 26, 2026
Combines two improvements to the Nix build infrastructure:
1. Deduplicate nix/lib.nix (995 → ~700 lines, 30% reduction):
- Extract shared data lists (modules, C sources, headers, symbols)
and helper functions into top-level let bindings
- Merge mkIOSLib + mkWatchOSLib into internal mkAppleStaticLib
parameterised by platform; public API preserved via thin wrappers
- Merge mkSimulatorApp + mkWatchOSSimulatorApp into internal
mkAppleSimulatorApp; public API preserved
- Replace 14 repetitive NDK compile blocks with map over list
- Hoist applePkgs, appleGhc, gmpStatic, libffiStatic to top-level
2. Build hatter as a cached cabal package for iOS/watchOS:
- ios-deps.nix: add hatterSrc param, build hatter via callCabal2nix
so the .a and package DB entry are cached
- ios.nix, watchos.nix: pass hatterSrc to ios-deps.nix
- mkAppleStaticLib: when crossDeps is provided, only compile
Main.hs + run_main.c instead of all 22 modules + 19 C sources
- Standalone fallback (crossDeps == null) preserved
Adding a new bridge module now means editing 1 list, not 6+ places.
Demo apps and consumers only recompile their entry point.
Prompt: combine PR #213 and #214 into a single PR
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cross-deps.nixapproach for iOS/watchOS: build hatter viacallCabal2nixinios-deps.nixso the.aand package DB entry are cachedMain.hs+run_main.cinstead of all 22 Hatter modules + 19 C sources from scratch every timecrossDeps == null) preserves current from-source behavior for callers that don't useios-deps.nixTest plan
nix-instantiate --parsepasses on all modified files (done locally)🤖 Generated with Claude Code