Repository navigation
fix: keep flake inputs' sourceInfo to flake attributes (#16) - #24
Merged
Merged
Conversation
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
approved these changes
Oct 12, 2026
Member
|
Thanks, @sini. You are awesome <3 |
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
Fixes #16.
A flake input was built as
sourceInfo // outputs // { … }, wheresourceInfois whatever the adapter handed over. nixtamal hands over fetchgit derivations, so every derivation attribute landed on the input:builder,drvAttrs,stdenv,type,fetchSubmodulesand so on. That is the pollution in the report.This change keeps only the attributes a real flake's
sourceInfocan carry:outPath,narHash,rev,shortRev,dirtyRev,dirtyShortRev,revCount,lastModified,lastModifiedDateandsubmodules. It applies to flake inputs, default.nix-with-inputs inputs, and top-levelself. If the adapter suppliesrev,shortRevis 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 shadowoutPath/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,revandlastModifiedare present still depends on the adapter. tack's and npins' sources don't hand them over under those names (npins hasrevision/hash). So with tack you still won't seenarHash/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 newsource-infotests: fetcher attributes don't leak andsourceInfois exactly the flake keys;rev/shortRev/lastModifiedreach the input; source info wins over an output namedrev(newfixtures/shadow-flake). On main, 45/48: the new tests fail there.den): on main it carriesbuilder drvAttrs stdenv type; with this change it carries none of them.nixtamal,tackandnpinsevaluatenixosConfigurations.igloo…home.usernametotuxwith this change.