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
modularity: Document the ability to use non-files in imports #50503
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is indeed a useful hint (I did not realize that this is an option).
Co-Authored-By: Baughn <svein@google.com>
Can you please squash the commits. |
In a few hours. ...can't you use the "squash and merge" option? |
This is a bad idea to document, because you lose source tracking at errors. Your errors with not include in what line the error happened and it's going to be very painful to debug. |
It seems like it was designed to also accept configuration sets and not just paths. That should be documented and not just be a hidden feature? I can see your point that it makes things harder to debug but should that not be the users choice in the end? |
It's a slippery slope, you'll soon regret saving those 5s once you're deep debugging some coercion gone wrong, without having the line number where it happened. I think we should at very least make this clear (in red) in the documentation. |
I agree it should be mentioned in the documentation. |
You only run into this if you use nixos modules imports without filenames. |
When you misspell an option in a nixos configuration file the error message does not contain the line number (it does tell the filename though). So, this statement would then only apply to syntactical errors (where nix usually shows the line numbers)? |
Maybe @edolstra can explain precisely, I don't have time to really research this, I'm just warning this is going to create more pain than gain as it currently stands if documented. |
Well, this feature is used in lots of places, so documenting it makes sense, even if it's not really a good idea to use. |
For instance, I'm using it to generate NixOS systems for a number of machines, most of which differ only in their hostname. Is this a bad idea? Should I do it some other way? I don't want to generate configuration.nix files for each of them; I'd rather have the machines all defined in a single file, one line per machine. |
Motivation for this change
There are no examples of using anything but files in the imports list. Users might be confused into thinking that's all that's possible.
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)