Skip to content

fix: keep flake inputs' sourceInfo to flake attributes (#16) - #24

Merged
vic merged 1 commit into
mainfrom
fix/clean-source-info
Oct 12, 2026
Merged

vic merged 1 commit into
mainfrom
fix/clean-source-info

Conversation

@sini

@sini sini commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #16.

A flake input was built as sourceInfo // outputs // { … }, where sourceInfo is whatever the adapter handed over. nixtamal hands over fetchgit derivations, so every derivation attribute landed on the input: builder, drvAttrs, stdenv, type, fetchSubmodules and so on. That is the pollution in the report.

This change keeps only the attributes a real flake's sourceInfo can carry: outPath, narHash, rev, shortRev, dirtyRev, dirtyShortRev, revCount, lastModified, lastModifiedDate and submodules. It applies to flake inputs, default.nix-with-inputs inputs, and top-level self. If the adapter supplies rev, shortRev is derived from it, as Nix does. Source info is now merged over outputs, matching Nix's call-flake.nix and #23, so an output can't shadow outPath/rev.

Non-flake inputs (flake = false, or a source without flake.nix/default.nix) are unchanged and still expose the source as given.

Not in scope: whether narHash, rev and lastModified are present still depends on the adapter. tack's and npins' sources don't hand them over under those names (npins has revision/hash). So with tack you still won't see narHash/rev, but you no longer see anything a flake wouldn't have. Mapping each adapter's metadata onto flake names would be a follow-up per adapter.

Validation

  • nix-unit ./tests.nix: 48/48. Three new source-info tests: fetcher attributes don't leak and sourceInfo is exactly the flake keys; rev/shortRev/lastModified reach the input; source info wins over an output named rev (new fixtures/shadow-flake). On main, 45/48: the new tests fail there.
  • Real nixtamal template input (den): on main it carries builder drvAttrs stdenv type; with this change it carries none of them.
  • Template loaders nixtamal, tack and npins evaluate nixosConfigurations.igloo…home.username to tux with this change.

Fetcher results passed as sources (nixtamal's fetchgit derivations)
leaked every derivation attribute onto the flake input. Keep only the
attributes a real flake's sourceInfo carries, derive shortRev from rev,
and merge sourceInfo over outputs as Nix's call-flake.nix does. Non-flake
inputs are unchanged.
@vic

vic commented Oct 12, 2026

Copy link
Copy Markdown
Member

Thanks, @sini. You are awesome <3

@vic
vic merged commit d6d85ae into main Oct 12, 2026
1 of 2 checks passed
@vic
vic deleted the fix/clean-source-info branch October 12, 2026 17:30
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.

Inconsistent inputs produced by different adapters

2 participants