Skip to content

CI: hatterSrc = ../. invalidates nix cache on any file change #208

@jappeace-sloth

Description

@jappeace-sloth

Problem

The watchOS CI job timed out (6h) on PR #207, and android had a SIGSEGV crash. Both are likely caused by nix cache invalidation.

Root cause

In nix/watchos.nix (and ios.nix, android.nix):

hatterSrc = ../.;

This passes the entire repo as the source. When ANY tracked file changes (e.g. watchos/Hatter/HaskellBridge.swift), the nix source hash changes, which invalidates ALL derivations that depend on hatterSrc — including the GHC cross-compilation step.

On master, the derivation hashes match the community cache, so everything downloads pre-built. On a PR branch with even a one-line Swift change, the entire GHC cross-compile must run from scratch on the CI runner.

Impact

  • watchOS: 6-hour timeout — the macOS runner couldn't finish the full cross-compile in time
  • android: The SIGSEGV may be related to a cache-miss rebuild producing a subtly different binary (different optimization, linking order, etc), or it may be genuinely flaky
  • iOS: Passed because its runner was fast enough (30 min)

Possible fix

Split hatterSrc so the GHC build derivation only depends on src/, cbits/, include/, and the cabal file — not Swift files, project.yml, or other platform files. The Swift files could be passed as a separate input to the installPhase. This way, changing a Swift file wouldn't invalidate the expensive GHC cross-compilation cache.

Context

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions