blob: 160245df27add7093c2706c89ffadf2c31aa60cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
{ lib, config, ... }:
let
inherit (lib) types;
in
{
options = {
list = lib.mkOption {
type = types.listOf types.int;
};
attrs = lib.mkOption {
type = types.attrs;
};
attrsOf = lib.mkOption {
type = types.attrsOf types.int;
};
null = lib.mkOption {
type = types.nullOr types.int;
};
submodule = lib.mkOption {
type = types.submodule { };
};
submoduleWithDefaults = lib.mkOption {
type = types.submodule {
options.enabled = lib.mkOption {
type = types.bool;
default = true;
};
options.count = lib.mkOption {
type = types.int;
default = 13;
};
};
};
unique = lib.mkOption {
type = types.unique { message = "hi"; } (types.listOf types.int);
};
coercedTo = lib.mkOption {
type = types.coercedTo (types.attrsOf types.int) builtins.attrNames (types.listOf types.str);
};
# no empty value
int = lib.mkOption {
type = types.int;
};
result = lib.mkOption {
type = types.str;
default =
assert
config.submoduleWithDefaults == {
enabled = true;
count = 13;
};
"ok";
};
};
}
|