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
Add writeOnly options to the module system #49766
Conversation
Private seems kind of vague. How about writeOnly? |
ffc1469
to
bd4f2cd
Compare
Done. It mirrors readOnly quite faithfully, except for not being watertight. |
The usefulness of this is a bit questionable if any module can still access values via |
I've updated the PR description to match the rename. It's
I agree partially. Indeed any module can access the value, but no module author will use
If someone really ends up there, they probably really needed the value. If it were easy, I would have written |
Why not just use |
Users will need to set it. I have written this for use in Edit: It also applies to |
If I understand correctly, you want to make uses of an option obsolete, and still be able to read its content for the time being? Any reason not to use Adding extra attributes to |
This feature works for options that are obsolete, as in
I agree that we should be careful with adding rarely used attributes everywhere in the tree. That should be a good reason to look into a different implementation that avoids The approach of just breaking In conclusion, the only valid use case now seems to be |
@nbp Thanks for your good reviews 👍 |
Motivation for this change
I have found a situation, #49765 where it would really help to disallow using certain options outside the defining module.
The value will still be available only as
options.foo.bar.internalValue
and aoptions.foo.bar.value
orconfig.foo.bar
will yield an error.The error message is configurable, so the module author can provide a hint of what else the module user should do.
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)