1{ lib, config, options, ... }:
2let
3 inherit (lib) types;
4in
5{
6 imports = [
7
8 # fun.<function-body>.a
9 ({ ... }: {
10 options = {
11 fun = lib.mkOption {
12 type = types.functionTo (types.submodule {
13 options.a = lib.mkOption { default = "a"; };
14 });
15 };
16 };
17 })
18
19 # fun.<function-body>.b
20 ({ ... }: {
21 options = {
22 fun = lib.mkOption {
23 type = types.functionTo (types.submodule {
24 options.b = lib.mkOption { default = "b"; };
25 });
26 };
27 };
28 })
29 ];
30
31 options = {
32 result = lib.mkOption
33 {
34 type = types.str;
35 default = lib.concatStringsSep " " (lib.attrValues (config.fun (throw "shouldn't use input param")));
36 };
37
38 optionsResult = lib.mkOption
39 {
40 type = types.str;
41 default = lib.concatStringsSep " "
42 (lib.concatLists
43 (lib.mapAttrsToList
44 (k: v:
45 if k == "_module"
46 then [ ]
47 else [ (lib.showOption v.loc) ]
48 )
49 (
50 (options.fun.type.getSubOptions [ "fun" ])
51 )
52 )
53 );
54 };
55 };
56
57 config.fun = lib.mkMerge
58 [
59 (input: { b = "bee"; })
60 ];
61}