Add writeOnly options to the module system#49766
Add writeOnly options to the module system#49766roberth wants to merge 1 commit intoNixOS:masterfrom
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.internalValueand aoptions.foo.bar.valueorconfig.foo.barwill 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
sandboxinnix.confon non-NixOS)nix-shell -p nox --run "nox-review wip"./result/bin/)nix path-info -Sbefore and after)