diff options
author | Robert Hensing <roberth@users.noreply.github.com> | 2022-03-11 17:36:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-11 17:36:16 +0100 |
commit | 679ec68d574427606697be14bfc6a69db7bc28b9 (patch) | |
tree | a2a214611b1592544bdebb8a730698416ac5772c /lib | |
parent | f5331b444b8e26f89077fdfb577643a5688a7ba4 (diff) | |
parent | 02de37ca072841559df7063d66a25b91d82f9538 (diff) | |
download | nixlib-679ec68d574427606697be14bfc6a69db7bc28b9.tar nixlib-679ec68d574427606697be14bfc6a69db7bc28b9.tar.gz nixlib-679ec68d574427606697be14bfc6a69db7bc28b9.tar.bz2 nixlib-679ec68d574427606697be14bfc6a69db7bc28b9.tar.lz nixlib-679ec68d574427606697be14bfc6a69db7bc28b9.tar.xz nixlib-679ec68d574427606697be14bfc6a69db7bc28b9.tar.zst nixlib-679ec68d574427606697be14bfc6a69db7bc28b9.zip |
Merge pull request #163127 from hercules-ci/optimize-optionSet-compat
lib/modules.nix: Optimize optionSet legacy compat code
Diffstat (limited to 'lib')
-rw-r--r-- | lib/modules.nix | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/modules.nix b/lib/modules.nix index 79d54e4a5387..4c4d9f994dae 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -761,13 +761,13 @@ rec { options = opt.options or (throw "Option `${showOption loc}' has type optionSet but has no option attribute, in ${showFiles opt.declarations}."); f = tp: - let optionSetIn = type: (tp.name == type) && (tp.functor.wrapped.name == "optionSet"); - in if tp.name == "option set" || tp.name == "submodule" then throw "The option ${showOption loc} uses submodules without a wrapping type, in ${showFiles opt.declarations}." - else if optionSetIn "attrsOf" then types.attrsOf (types.submodule options) - else if optionSetIn "listOf" then types.listOf (types.submodule options) - else if optionSetIn "nullOr" then types.nullOr (types.submodule options) + else if (tp.functor.wrapped.name or null) == "optionSet" then + if tp.name == "attrsOf" then types.attrsOf (types.submodule options) + else if tp.name == "listOf" then types.listOf (types.submodule options) + else if tp.name == "nullOr" then types.nullOr (types.submodule options) + else tp else tp; in if opt.type.getSubModules or null == null |