Skip to content
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

docs: recommend setting moduleLocation by default #221

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Atry
Copy link
Contributor

@Atry Atry commented Apr 14, 2024

As moduleLocation can be used to avoid portential infinite loops issue, it would be nice to mention it from README.

As `moduleLocation` can be used to avoid portential infinite loops issue, it would be nice to mention it from README.
@roberth
Copy link
Member

roberth commented Apr 14, 2024

Is that still needed? Did you run into this again?
If users set inputs (which almost certainly they do), Nix will use the attribute position to determine the file.
That's since #192; half a year ago.

@Atry
Copy link
Contributor Author

Atry commented Apr 14, 2024

moduleLocation can be used to locate ./. to avoid stack overflow. See https://github.com/Atry/nix-ml-ops/blob/f37e70da4b6a26dbf8ca06741b87b2676f6996d5/flake-modules/poetry2nix.nix#L55-L59

@Atry
Copy link
Contributor Author

Atry commented Apr 14, 2024

Currently flake modules are not able to visit ./.. self.outPath is similar but it can result in infinite loops and stack overflow.

@roberth
Copy link
Member

roberth commented May 16, 2024

Currently flake modules are not able to visit ./.. self.outPath is similar but it can result in infinite loops and stack overflow.

It seems to work fine nowadays. Example: https://github.com/srid/haskell-flake/blob/e47512f9a1eda70c762a0265cf029ecdaa9ffdf3/nix/modules/project/default.nix#L19-L29

Do you have an example where moduleLocation must be set?

I'd like to avoid a situation where we make unnecessary recommendations, and I'm making an effort to make Nix provide the info robustly without unsafeGetAttrPos or self. (NixOS/nix#8908, currently blocked on a decision for NixOS/nix#10350)

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