Skip to content

moduleLocation, but also automatic#192

Merged
roberth merged 5 commits intomainfrom
moduleLocation
Oct 29, 2023
Merged

moduleLocation, but also automatic#192
roberth merged 5 commits intomainfrom
moduleLocation

Conversation

@roberth
Copy link
Copy Markdown
Member

@roberth roberth commented Oct 13, 2023

This improves on #158 by making the default module location automatic.

When moduleLocation is specified, it behaves as in #158.
If not, the default module location is determined from the inputs attribute position, with fallback.

I believe moduleLocation is sufficient for the use cases in the flake-parts modules that were changed.
I am currently not aware of a case where errorLocation would have to be exposed to the modules, so I'd like to keep the interface minimal until we find that.

Atry and others added 5 commits May 9, 2023 09:53
This would not be advisable for anything other than error messages,
because Nix does not commit to any semantics for that function.
The difference is that moduleLocation is "guaranteed" reliable data,
whereas errorLocation is the best choice for error messages in the core.

moduleLocation is suitable for the module key attribute.
errorLocation is best for the *ROOT* module _file attribute.

Initially I applied errorLocation in too many places. It is only needed
when the flake output attribute names are strict in it.
To avoid confusion, I'm not exposing errorLocation to the modules, until
we have a concrete use case for it.
As mentioned in the previous commit, we don't have a use case for
this in flake-parts yet, as far as I'm aware. It can be exposed
when we do have a concrete use case where it is needed.
Copy link
Copy Markdown
Contributor

@Atry Atry left a comment

Choose a reason for hiding this comment

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

Looks good to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants