-
-
Notifications
You must be signed in to change notification settings - Fork 83
add impureOverrides argument and overrideInputs to result #84
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
base: master
Are you sure you want to change the base?
add impureOverrides argument and overrideInputs to result #84
Conversation
1. allows to override specific **top level** input by providing a "path" (relative or absolute)
2. any type of input can be overriden
3. follows which point at overridden input's inputs are not modified
for example, given inputs `a` and `b`, and `a.inputs.nixpkgs.follows = "b/nixpkgs"`, when b gets overridden, `a's` `nixpkgs` will remain unchanged
Do I understand correctly that this comment is about current implementation of flake-compat (not this PR specifically)? Can you elaborate on this? How does the native nix implementation differ in this regard from flake-compat? |
|
Yes, it is about the overall state of the projects, but I do believe it affects our ability to reason about inputs due to most of it being centered around nodes instead, which are not a suitable abstraction for anything except following the lockfile verbatim. |
I did a quick test and it is indeed the case. So to replicate this flake-compat we'd have to re-implement the flake locking logic (currently implemented in c++) in nix. Not sure how much effort that would be. Ideally we'd need a shared test suite to make sure that the behaviour is and stays the same. Is this worth the effort? Personally I have flake enabled and the reason I was interested int this in the first place, is that I consume flakes in non-flake projects, and |
roberth
left a comment
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.
This is mostly summarizing the previous discussion.
Unexpected semantics
The semantics of this overrideInputs feature differ fundamentally from nix --override-input:
- Does not respect follows: As noted in discussion, native
--override-inputpropagates overrides through follows declarations. This implementation only replaces the specific input relation. Givena.inputs.nixpkgs.follows = "b/nixpkgs", overridingbleavesa'snixpkgsunchanged. - Only affects top-level inputs: The
rootOverridesmapping only considerslockFile.nodes.${lockFile.root}.inputs, so nested input overrides aren't possible.
Unclear Path Towards General Override Support
This PR concerns me in light of NixOS/nix#7730, which will significantly change how call-flake.nix (nix's implementation which is mirrored here) resolves transitive inputs.
Having a separate reinvention of that solution would be a liability, but we can use flake-compat to prototype nix#7730 so that it can adopt the same solution in call-flake.nix.
Any override mechanism we add now should be designed with this trajectory in mind. The current implementation is tightly coupled to the flat nodes.<id> structure, which nix#7730 will not be.
| inputSpec = builtins.trace inputSpec' inputSpec'; | ||
| resolved = if builtins.isList inputSpec then getInputByPath lockFile.root inputSpec else inputSpec; | ||
| in | ||
| builtins.trace "=> ${resolved}" resolved; |
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.
Unintentional debug trace?
NOTE: this is a rebase and a slight refactor of #49, since that PR as bit-rotten
for example, given inputs
aandb, anda.inputs.nixpkgs.follows = "b/nixpkgs", when b gets overridden,a'snixpkgswill remain unchangedThis is not necessarily the final solution but I created the PR so we have a starting point that "works" as we iterate towards something acceptable
I'm going to quote @roberth's comment from the other PR as a starting point for further discussion
cc @Mic92 @ckiee @Eveeifyeve