1{ lib, ... }:
2let
3 inherit (lib) types mkOption;
4
5 inherit (types)
6 # attrsOf uses attrsWith internally
7 attrsOf
8 listOf
9 unique
10 nullOr
11 functionTo
12 coercedTo
13 either
14 ;
15in
16{
17 imports = [
18 # Module A
19 (
20 { ... }:
21 {
22 options.attrsWith = mkOption {
23 type = attrsOf (listOf types.str);
24 };
25 options.mergedAttrsWith = mkOption {
26 type = attrsOf (listOf types.str);
27 };
28 options.listOf = mkOption {
29 type = listOf (listOf types.str);
30 };
31 options.mergedListOf = mkOption {
32 type = listOf (listOf types.str);
33 };
34 # unique
35 options.unique = mkOption {
36 type = unique { message = ""; } (listOf types.str);
37 };
38 options.mergedUnique = mkOption {
39 type = unique { message = ""; } (listOf types.str);
40 };
41 # nullOr
42 options.nullOr = mkOption {
43 type = nullOr (listOf types.str);
44 };
45 options.mergedNullOr = mkOption {
46 type = nullOr (listOf types.str);
47 };
48 # functionTo
49 options.functionTo = mkOption {
50 type = functionTo (listOf types.str);
51 };
52 options.mergedFunctionTo = mkOption {
53 type = functionTo (listOf types.str);
54 };
55 # coercedTo
56 # Note: coercedTo is a non-mergeable option-type
57 options.coercedTo = mkOption {
58 type = coercedTo (listOf types.str) lib.id (listOf types.str);
59 };
60 options.either = mkOption {
61 type = either (listOf types.str) (listOf types.str);
62 };
63 options.mergedEither = mkOption {
64 type = either (listOf types.str) (listOf types.str);
65 };
66 }
67 )
68 # Module B
69 (
70 { ... }:
71 {
72 options.mergedAttrsWith = mkOption {
73 type = attrsOf (listOf types.str);
74 };
75 options.mergedListOf = mkOption {
76 type = listOf (listOf types.str);
77 };
78 options.mergedUnique = mkOption {
79 type = unique { message = ""; } (listOf types.str);
80 };
81 options.mergedNullOr = mkOption {
82 type = nullOr (listOf types.str);
83 };
84 options.mergedFunctionTo = mkOption {
85 type = functionTo (listOf types.str);
86 };
87 options.mergedEither = mkOption {
88 type = either (listOf types.str) (listOf types.str);
89 };
90 }
91 )
92 ];
93}