-
Notifications
You must be signed in to change notification settings - Fork 1
Fix deep overrides #108
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
Fix deep overrides #108
Conversation
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 NixOS#8325, #95, NixOS#12083, NixOS#5790.
Taken from NixOS#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.
OverrideTarget { | ||
.input = inputOverride, | ||
.sourcePath = sourcePath, | ||
.parentInputAttrPath = inputAttrPathPrefix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also be changed to prefix
like line 472 above was?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is correct because it's the input attr path used to resolve relative path inputs. In an override, these should refer to the attr path of the overriding flake, which is inputAttrPathPrefix
.
Motivation
An override like
implicitly set
inputs.foo.inputs.bar
toflake:bar
, which led to an unexpected error likeWe 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 NixOS#8325, #95, NixOS#12083, NixOS#5790. Based in part on NixOS#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