at master 1.0 kB view raw
1{ lib, ... }: 2let 3 inherit (lib) types mkOption; 4in 5{ 6 imports = [ 7 # Module A 8 ( 9 { ... }: 10 { 11 options.mergedName = mkOption { 12 default = { }; 13 type = types.attrsWith { 14 placeholder = "id"; # <- This is beeing tested 15 elemType = types.submodule { 16 options.nested = mkOption { 17 type = types.int; 18 default = 1; 19 }; 20 }; 21 }; 22 }; 23 } 24 ) 25 # Module B 26 ( 27 { ... }: 28 { 29 # defines the default placeholder "name" 30 # type merging should resolve to "id" 31 options.mergedName = mkOption { 32 type = types.attrsOf (types.submodule { }); 33 }; 34 } 35 ) 36 37 # Output 38 ( 39 { 40 options, 41 ... 42 }: 43 { 44 options.result = mkOption { 45 default = lib.concatStringsSep "." (options.mergedName.type.getSubOptions options.mergedName.loc) 46 .nested.loc; 47 }; 48 } 49 ) 50 ]; 51}