lol
1# sets of small configurations:
2# Each configuration
3rec {
4 # has 2 arguments pkgs and this.
5 configA = pkgs: this: {
6 # Can depends on other configuration
7 require = configB;
8
9 # Defines new options
10 optionA = pkgs.lib.mkOption {
11 # With default values
12 default = false;
13 # And merging functions.
14 merge = pkgs.lib.mergeEnableOption;
15 };
16
17 # Add a new definition to other options.
18 optionB = this.optionA;
19 };
20
21 # Can be used for option header.
22 configB = pkgs: this: {
23 # Can depends on more than one configuration.
24 require = [ configC configD ];
25
26 optionB = pkgs.lib.mkOption {
27 default = false;
28 };
29
30 # Is not obliged to define other options.
31 };
32
33 configC = pkgs: this: {
34 require = [ configA ];
35
36 optionC = pkgs.lib.mkOption {
37 default = false;
38 };
39
40 # Use the default value if it is not overwritten.
41 optionA = this.optionC;
42 };
43
44 # Can also be used as option configuration only.
45 # without any arguments (backward compatibility)
46 configD = {
47 # Is not forced to specify the require attribute.
48
49 # Is not force to make new options.
50 optionA = true;
51 optionD = false;
52 };
53}