lib.types.attrTag: expose suboptions at correct level

sodiboo b3c99164 9f7c0e8a

Changed files
+2 -7
lib
+1 -1
lib/tests/modules/types-attrTag.nix
···
let
inherit (lib) mkOption types;
forceDeep = x: builtins.deepSeq x x;
-
mergedSubOption = (options.merged.type.getSubOptions options.merged.loc).extensible."merged.<name>";
in
{
options = {
···
let
inherit (lib) mkOption types;
forceDeep = x: builtins.deepSeq x x;
+
mergedSubOption = (options.merged.type.getSubOptions options.merged.loc).extensible;
in
{
options = {
+1 -6
lib/types.nix
···
description = "attribute-tagged union";
descriptionClass = "noun";
getSubOptions =
-
prefix:
-
mapAttrs (tagName: tagOption: {
-
"${lib.showOption prefix}" = tagOption // {
-
loc = prefix ++ [ tagName ];
-
};
-
}) tags;
check = v: isAttrs v && length (attrNames v) == 1 && tags ? ${head (attrNames v)};
merge =
loc: defs:
···
description = "attribute-tagged union";
descriptionClass = "noun";
getSubOptions =
+
prefix: mapAttrs (tagName: tagOption: tagOption // { loc = prefix ++ [ tagName ]; }) tags;
check = v: isAttrs v && length (attrNames v) == 1 && tags ? ${head (attrNames v)};
merge =
loc: defs: