1(
2 { lib, ... }:
3 let
4 inherit (lib) types mkOption;
5 inherit (types) addCheck int attrsOf;
6
7 # type with a v1 merge
8 v1Type = addCheck int (v: v == 0);
9
10 # type with a v2 merge
11 v2Type = addCheck (attrsOf int) (v: v ? foo);
12 in
13 {
14 options.v1CheckedPass = mkOption {
15 type = v1Type;
16 default = 0;
17 };
18 options.v1CheckedFail = mkOption {
19 type = v1Type;
20 default = 1;
21 };
22 options.v2checkedPass = mkOption {
23 type = v2Type;
24 default = {
25 foo = 1;
26 };
27 # plug the value to make test script regex simple
28 apply = v: v.foo == 1;
29 };
30 options.v2checkedFail = mkOption {
31 type = v2Type;
32 default = { };
33 apply = v: lib.deepSeq v v;
34 };
35 }
36)