Skip to content

feat(nix): export lib.nativeOverlays, so consumers stop naming overlays - #11

Merged
dlipicar merged 1 commit into
masterfrom
feat/export-native-overlays
Sep 8, 2026
Merged

feat(nix): export lib.nativeOverlays, so consumers stop naming overlays#11
dlipicar merged 1 commit into
masterfrom
feat/export-native-overlays

Conversation

@dlipicar

@dlipicar dlipicar commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Enabler for the logos-module-builder wiring, which is the consumer line that actually
unblocks Rust module builds.

Why

A consumer doing its own import nixpkgs { overlays = ...; } has to name each overlay.
That is precisely how #9 reached master applying to nothing: logos-module-builder's
mkPkgsWith is a bare import nixpkgs, and the one open PR wiring it
(logos-co/logos-module-builder#220) names fetchCargoVendorUserAgent alone — the wrong
fetcher for module builds, which vendor through cargoLock, hence importCargoLock.

Naming overlays one by one means every future overlay repeats that. So export the list
this flake already keeps internally:

overlays = logos-nix.lib.nativeOverlays ++ ownOverlays;

lib.overlays stays as the menu for anyone who genuinely wants a single one. The
Windows overlays are deliberately not in the list — they belong to a cross set only.

The bookkeeping gate

lib.overlays and lib.nativeOverlays are both maintained by hand and nothing tied
them together, so adding to one and forgetting the other reproduces the original bug.
checks.<sys>.overlay-exports guards it. Nix cannot compare functions, so it compares
counts — which fires in both directions and names the entries. Verified by simulating a
third overlay added to lib.overlays alone:

overlay export drift: lib.nativeOverlays has 2 entries but lib.overlays lists 3
non-Windows overlays (fetchCargoVendorUserAgent importCargoLockStaticCratesIo somethingNew)

Mutation suite

The new gate changed what M4 catches: dropping the overlay from nativeOverlays is now
reported as export drift, before any crate URL is examined. Split so both paths stay
covered — M4 drops it from nativeOverlays only, M6 from both, each asserting its own
message. Suite is 7/7, and nix flake check --no-build --all-systems exits 0.

🤖 Generated with Claude Code

A consumer doing its own `import nixpkgs { overlays = ...; }` currently has to
name each overlay it wants. That is how the importCargoLock fix reached master
applying to nothing: logos-module-builder's mkPkgsWith takes a bare
`import nixpkgs`, and the one open PR wiring it (logos-module-builder#220)
names `fetchCargoVendorUserAgent` alone — the wrong fetcher for module builds,
which vendor through `cargoLock` and so through importCargoLock.

Export the list this flake already keeps internally. A consumer writes

  overlays = logos-nix.lib.nativeOverlays ++ ownOverlays;

and a future overlay reaches it with no consumer change. `lib.overlays` stays
as the menu, for anyone who genuinely wants one. Windows overlays are not in
the list and must never be: they belong to a cross set only.

checks.<sys>.overlay-exports guards the bookkeeping. `lib.overlays` and
`lib.nativeOverlays` are maintained by hand and nothing tied them together, so
adding to one and forgetting the other reproduces the original bug exactly.
Nix cannot compare functions, so the gate compares counts: it fires in both
directions and names the offending entries. Verified by simulating a third
overlay added to `lib.overlays` alone:

  overlay export drift: lib.nativeOverlays has 2 entries but lib.overlays
  lists 3 non-Windows overlays (fetchCargoVendorUserAgent
  importCargoLockStaticCratesIo somethingNew)

That new gate also changed what M4 in the mutation suite catches: dropping the
overlay from `nativeOverlays` is now reported as export drift, before any crate
URL is examined. Split it so both paths stay covered — M4 drops it from
`nativeOverlays` only, M6 from both, and each asserts its own message. Suite is
7/7.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant