2022-05-13 06:59:27 +00:00
|
|
|
{ lib, config, options, ... }:
|
|
|
|
let
|
|
|
|
inherit (lib) types;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
imports = [
|
|
|
|
|
|
|
|
# fun.<function-body>.a
|
|
|
|
({ ... }: {
|
|
|
|
options = {
|
|
|
|
fun = lib.mkOption {
|
|
|
|
type = types.functionTo (types.submodule {
|
2022-05-13 07:09:16 +00:00
|
|
|
options.a = lib.mkOption { default = "a"; };
|
2022-05-13 06:59:27 +00:00
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
})
|
|
|
|
|
|
|
|
# fun.<function-body>.b
|
|
|
|
({ ... }: {
|
|
|
|
options = {
|
|
|
|
fun = lib.mkOption {
|
|
|
|
type = types.functionTo (types.submodule {
|
2022-05-13 07:09:16 +00:00
|
|
|
options.b = lib.mkOption { default = "b"; };
|
2022-05-13 06:59:27 +00:00
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
options = {
|
|
|
|
result = lib.mkOption
|
2022-05-13 07:09:16 +00:00
|
|
|
{
|
|
|
|
type = types.str;
|
|
|
|
default = lib.concatStringsSep " " (lib.attrValues (config.fun (throw "shouldn't use input param")));
|
|
|
|
};
|
|
|
|
|
|
|
|
optionsResult = lib.mkOption
|
2022-05-13 06:59:27 +00:00
|
|
|
{
|
|
|
|
type = types.str;
|
|
|
|
default = lib.concatStringsSep " "
|
|
|
|
(lib.concatLists
|
|
|
|
(lib.mapAttrsToList
|
|
|
|
(k: v:
|
|
|
|
if k == "_module"
|
|
|
|
then [ ]
|
|
|
|
else [ (lib.showOption v.loc) ]
|
|
|
|
)
|
|
|
|
(
|
|
|
|
(options.fun.type.getSubOptions [ "fun" ])
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config.fun = lib.mkMerge
|
|
|
|
[
|
2022-05-13 07:09:16 +00:00
|
|
|
(input: { b = "bee"; })
|
2022-05-13 06:59:27 +00:00
|
|
|
];
|
|
|
|
}
|