Skip to content

Fix deep flake input overrides #13400

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 1, 2025
Merged

Fix deep flake input overrides #13400

merged 3 commits into from
Jul 1, 2025

Conversation

edolstra
Copy link
Member

Motivation

An override like

inputs.foo.inputs.bar.inputs.nixpkgs.follows = "nixpkgs";

implicitly set inputs.foo.inputs.bar to flake:bar, which led to an unexpected error like

error: cannot find flake 'flake:bar' in the flake registries

We now no longer create a parent override (like for foo.bar in the example above) if it doesn't set an explicit ref or follows attribute. We only recursively apply its child overrides.

Fixes #8325, DeterminateSystems#95, #12083, #5790. Based in part on #6621 by @Kha.

Also, we now disallow having both a flakeref and a follows attribute on an input, since it doesn't make sense to have both.

Context


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

edolstra and others added 3 commits June 26, 2025 12:56
An override like

  inputs.foo.inputs.bar.inputs.nixpkgs.follows = "nixpkgs";

implicitly set `inputs.foo.inputs.bar` to `flake:bar`, which led to an
unexpected error like

  error: cannot find flake 'flake:bar' in the flake registries

We now no longer create a parent override (like for `foo.bar` in the
example above) if it doesn't set an explicit ref or follows
attribute. We only recursively apply its child overrides.

Fixes #8325, DeterminateSystems#95, #12083, #5790.
Taken from #6621.

Co-authored-by: Sebastian Ullrich <[email protected]>
Having both doesn't make sense so it's best to disallow it. If this
causes issues we could turn into a warning.
@github-actions github-actions bot added the with-tests Issues related to testing. PRs with tests have some priority label Jun 26, 2025
@roberth roberth changed the title Fix deep overrides Fix deep flake input overrides Jun 27, 2025
@roberth roberth added the flakes label Jun 27, 2025
Copy link
Member

@roberth roberth left a comment

Choose a reason for hiding this comment

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

The test cases look sensible, but the C++ changes are admittedly still a mystery to me.

@edolstra edolstra merged commit 5879ab1 into master Jul 1, 2025
26 checks passed
@edolstra edolstra deleted the fix-deep-overrides branch July 1, 2025 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flakes with-tests Issues related to testing. PRs with tests have some priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow overriding the follows of a transitive input without overriding its flakeref
2 participants