Skip to content

fix(npins): don't pin inputs that follow another input (#140) - #141

Merged
vic merged 1 commit into
mainfrom
fix/npins-honour-follows
Oct 11, 2026
Merged

vic merged 1 commit into
mainfrom
fix/npins-honour-follows

Conversation

@sini

@sini sini commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #140.

write-npins only treated an input as "don't pin" when it set follows = "". A follows to another input was ignored. For example, flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs" had no effect, so transitive discovery still found nixpkgs-lib in flake-parts' flake.nix and pinned github:nix-community/nixpkgs.lib.

The skip set now collects every name that sets follows, at any nesting level, because such an input is never fetched under its own name. It subtracts names that are declared as pinnable top-level inputs. Pins share one flat namespace, and without that exception test-npins-follows would lose its declared top-level nixpkgs-lib. That test has a top-level nixpkgs-lib and also flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs-lib".

Behaviour change: a nested x.follows = "" used to suppress the pin even when a top-level x was declared. Now the declared top-level x keeps its pin.

Validation

  • New test-npins-follows-other (the writer downloads nixpkgs-lib ignoring follows #140 shape). It fails on main, where sources.json gets a nixpkgs-lib pin, and passes with this change.
  • test-npins-follows, test-npins-skip, test-npins-transitive and test-npins pass.
  • The rest of test-all was not run locally.

write-npins only skipped inputs with follows = "", so a nested
follows such as flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs" still
pinned nixpkgs-lib via transitive discovery. Skip every name that sets
follows, except names declared as pinnable top-level inputs (pins share
one flat namespace).

Adds test-npins-follows-other.
@sini
sini requested a review from vic October 11, 2026 05:23

@vic vic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@vic
vic merged commit 4ccd0b9 into main Oct 11, 2026
12 checks passed
@vic
vic deleted the fix/npins-honour-follows branch October 11, 2026 05:27
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.

writer downloads nixpkgs-lib ignoring follows

2 participants