diff options
author | Robert Hensing <robert@roberthensing.nl> | 2022-02-24 14:50:40 +0100 |
---|---|---|
committer | Robert Hensing <robert@roberthensing.nl> | 2022-03-03 00:28:35 +0100 |
commit | 81f342d1f3a6bab4a57e195ce99a153b82b1ef86 (patch) | |
tree | f66a580998ff47a1fb52e73eb148905cc0df0e43 /lib | |
parent | 0c09eb343dfa186c0fbf2bb6cbc36e7a8f369ea5 (diff) | |
download | nixlib-81f342d1f3a6bab4a57e195ce99a153b82b1ef86.tar nixlib-81f342d1f3a6bab4a57e195ce99a153b82b1ef86.tar.gz nixlib-81f342d1f3a6bab4a57e195ce99a153b82b1ef86.tar.bz2 nixlib-81f342d1f3a6bab4a57e195ce99a153b82b1ef86.tar.lz nixlib-81f342d1f3a6bab4a57e195ce99a153b82b1ef86.tar.xz nixlib-81f342d1f3a6bab4a57e195ce99a153b82b1ef86.tar.zst nixlib-81f342d1f3a6bab4a57e195ce99a153b82b1ef86.zip |
lib.modules: Explain why options can only be merged into submodules
Diffstat (limited to 'lib')
-rw-r--r-- | lib/modules.nix | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/modules.nix b/lib/modules.nix index e6812625f989..62e9615d25b3 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -501,6 +501,15 @@ rec { } else if optionDecls != [] then if (lib.head optionDecls).options.type.name == "submodule" + # Raw options can only be merged into submodules. Merging into + # attrsets might be nice, but ambiguous. Suppose we have + # attrset as a `attrsOf submodule`. User declares option + # attrset.foo.bar, this could mean: + # a. option `bar` is only available in `attrset.foo` + # b. option `foo.bar` is available in all `attrset.*` + # c. reject and require "<name>" as a reminder that it behaves like (b). + # d. magically combine (a) and (c). + # All options are merely syntax sugar though. then let opt = fixupOptionType loc (mergeOptionDecls loc (map optionTreeToOption decls)); in { |