1{ lib, ... }:
2let
3 inherit (lib) types mkOption;
4
5 inherit (types)
6 # attrsOf uses attrsWith internally
7 attrsOf
8 listOf
9 submoduleOf
10 str
11 ;
12in
13{
14 imports = [
15 (
16 { options, ... }:
17 {
18 # Should have an empty valueMeta
19 options.str = mkOption {
20 type = str;
21 };
22
23 # Should have some valueMeta which is an attribute set of the nested valueMeta
24 options.attrsOf = mkOption {
25 type = attrsOf str;
26 default = {
27 foo = "foo";
28 bar = "bar";
29 };
30 };
31 options.attrsOfResult = mkOption {
32 default = builtins.attrNames options.attrsOf.valueMeta.attrs;
33 };
34
35 # Should have some valueMeta which is the list of the nested valueMeta of types.str
36 # [ {} {} ]
37 options.listOf = mkOption {
38 type = listOf str;
39 default = [
40 "foo"
41 "bar"
42 ];
43 };
44 options.listOfResult = mkOption {
45 default = builtins.length options.listOf.valueMeta.list;
46 };
47
48 # Should have some valueMeta which is the submodule evaluation
49 # { _module, options, config, ...}
50 options.submoduleOf = mkOption {
51 type = submoduleOf {
52 options.str = mkOption {
53 type = str;
54 };
55 };
56 };
57 }
58 )
59 ];
60}