-
Notifications
You must be signed in to change notification settings - Fork 43
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
flake.flakeModules
requirements
#157
Comments
Could you clarify if you mean |
By local flake module scope, I mean the scope of the flake that publishes the module, as opposed to the module scope of the flake where it's imported. We can't express that distinction in one or two identifiers, because each of those identifiers is valid in both of the flakes. I'd gladly adopt a less ambiguous term. Does "publishing flake" sound better to you? Without any help, the published module can only access the inner |
In fact it solves the dogfooding requirement by importing file path from the same flake. Importing file path is not possible in other solutions because they inject lexical scope as additional arguments, changing the module format. |
I saw your new definition of "access to the local flake module scope". I believe "double mkFlake" approach is indeed able to "access to the local flake module scope" "such as locally packaged build tools with their locked, known-to-work dependencies.". For example |
While we have a
flakeModules
option that works decently well in most cases, some requirements aren't satisfied yet, or at least not to a degree where it's easy, let alone obvious how to satisfy them all.Requirements
Easy to dogfood
Due to how the module system
config
fixpoint works, fundamentally, we can't import from the option. This has been documented but it seems that we'll want to recast this into an easier, considering the intricacies introduced by the other requirements.The publishing flake is larger than the dogfooded module
The publishing flake must have the opportunity to define things that are not part of the dogfooded module.
For example, the consumer of the published module generally has no interest in copying the
checks
that come from its dependency. To avoid copying thosechecks
, they have to be defined in the publishing flake, but not in the published module.Access to the local flake module scope
Modules should be able to access values from the local flake, such as locally packaged build tools with their locked, known-to-work dependencies.
Deduplication and disabledModules
When references to the local flake must be made, we need to use module syntax that isn't conducive to deduplication and disabledModules.
Module key for multiple flake modules
flakeModules
option.Flawed (non-)solutions
Status quo as documented
Does not implement the last requirement, "Module key for multiple flake modules"
Double
mkFlake
applicationLets you apply the module key before the main
config
is available, but "access to the local flake module scope" does not work properly.Finding the local flake by recursing into the
inputs
graphLeads to scalability issues and spooky action at a distance from deep dependencies; see Do not traverse inputs
Does not seem to solve the dogfooding requirement.
Ideas
Special support in
mkFlake
A special
importApply
that just sets the module key to the file pathThis might work fine in practice, but the key assumption must be made clear: do not use multiple times, as the key is always the same file path.
The text was updated successfully, but these errors were encountered: