-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
showOption giving incorrect location for modules brought in via Flakes #11210
Comments
The example doesn't seem to be quite complete, so I haven't evaluated it, but this might be expected Module System behavior.
effectively throws away the file name because of If you're not passing arguments to a function that returns the module, you can just remove I believe that should cover all use cases, except perhaps deduplication of the imported module, which is tricky, as discussed in that thread. |
Wow -- so this is kind of a bad anti-pattern that you can either reference a path or import it; is there a way to somehow test for a NixOS module use and check if it's brought in via import? I opened ryantm/agenix#277 as an example of somewhere that had this bug. We can close this issue but it might need another to document the "better" approach at a minimum. Thank you @roberth for the explanation; it was very confusing. |
I think linting this is tricky, because you may have to do some eval to find the modules, but also you have to not actually evaluate the modules themselves and then inspect the thunk to make sure it's not a call to Maybe Anyway, I agree we can close this as far as Nix is concerned. |
Linting might work quite well in many cases. Thanks for the suggestion. |
Describe the bug
I'm using
lib.showOptionWithDefLocs
which{option}.files
--The result of files seems to be incorrect when the option is brought in via a Flake.
Steps To Reproduce
Minimal flake:
Create a NixOS module in
./modules
like:Import it through the
outputs
in yourconfiguration.nix
When I use the REPL it only shows my
configuration.nix
Expected behavior
I expect it to show the file location
nix-env --version
output:nix-env (Nix) 2.23.2
Additional context
This seems to work correctly for modules that are references by file paths.
import ./testModule
It also doesn't work for any module brought in via Flakes; not just the one defined within my current Flake.
For instance, I am using agenix and incorporating like so:
This also gives the wrong value.
Priorities
Add 👍 to issues you find important.
The text was updated successfully, but these errors were encountered: