-
Notifications
You must be signed in to change notification settings - Fork 45
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
Add findInputsByOutPath (fix #104) #146
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
End goal in #104
|
How would we use this? |
Suppose you are creating a library of flake parts that depends on
Because a flake part is a module nix file, which does not have the lexical scope of its own inputs. |
This approach is not ideal because it does not support |
Added |
Hmmm, so I guess if I understand: #149 uses lexical closure to capture stuff from the upstream flake's environment while it's evaluating (including closing over inputs). In contrast, this PR tries to give the module from the upstream flake the tools to find "its own" inputs within the structure of the inputs to the downstream flake. At first consideration, this PR seems way more complex and fragile than #149 to me. E.g. what happens when the exact same upstream flake source exists in the dependency tree more than once but the transitive dependencies are different due to different What are the benefits of doing things this way versus the technique in #149? |
No matter if you think #150 is a good idea,
When using the approach in Dogfood a Reusable Module, modules in the same flake cannot import each other, which is not good in a modularized repository. |
Basically Dogfood a Reusable Module only works if you have a single module in a flake. It does not work when you have multiple modules that depend on each other in a flake. |
Hmm. Not sure but I'd think that I think that this could be simplified (and (edited to be less confident until I actually do the experiment) |
In the same flake, the modules would not deduplicate, because you are using the unwrapped version of modules without https://github.com/hercules-ci/flake-parts/blob/main/extras/flakeModules.nix |
This already works, as long as If it's not a module, I suppose it's a function to a module and you could use If you have a legacy, non-flake entrypoint, you can use Only the addition of a module key seems to be missing from this. That key should be present between local imports of
Did I draw the right conclusion? 3 and 5 both seem to be about the module key. Not sure if I would frame them as contradictory if it's just about having better keys. I suppose one way to get those keys in there is to have some logic for this in The interface may look something like
mkFlake { flakeModules = { foo = ./foo.nix; bar = ./bar.nix; }; inherit inputs; } {
perSystem = something;
# nothing about flakeModules here; all taken care of
}
{ localFlakeModules,
localFlake,
withSystem # can probably add all the top level module arguments here lazily with some reflection + fixpoint magic; otherwise just expose config as localConfig
}:
{ self, # user flake
... }:
{
imports = [ localFlakeModules.bar ];
} All the modules you reference in |
I think both |
I don't think that would work for the dogfooding use case. Like |
|
I can't accept this into the core because it is has a serious flaw as described in Do not traverse inputs. I'm really sorry to close many of your PRs. I really appreciate your efforts, but please know that |
For