i’m currently writing a module for my home-manager where i use a function to realize configurations where the name of an attribute is used in a function (think users.users..x).
my module currently looks like this:
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.custom;
funsCfg = { name, config, ... }: {
options = {
package = mkOption {
type = types.package;
default = pkgs.${name};
};
};
config = {
home.packages = [ config.package ];
};
};
in
{
options.custom = {
enable = mkEnableOption "enable it";
funs = mkOption {
default = { };
type = with types; attrsOf (submodule funsCfg);
};
};
config = mkIf cfg.enable (mkMerge
(attrValues cfg.apps)
);
}
the problem is that the config line triggers an infinite recursion. Even when options.custom.enable
is not set to true.