Inside a configuration given to a lib.types.lazyAttrsOf lib.types.lazyAttrsOf (lib.types.submodule ...)
-typed option, how do I use the attrName of the outermost lib.types.lazyAttrsOf
inside the arguments given to the lib.types.submodule
?
Note that using the attrName of the innermost lib.types.lazyAttrsOf
is possible through nixpkgs/lib/types.nix at e59d0ed541ffb2cfe06d8d07664ff6eca7a5b895 · NixOS/nixpkgs · GitHub,
e.g., the nix repl
evaluation of the following, after bringing lib
into scope, is "qux"
:
(lib.evalModules {
modules = [{
options.foo = lib.mkOption {
type = lib.types.lazyAttrsOf lib.types.lazyAttrsOf (lib.types.submodule ({name, ...}: {
options.bar = lib.mkOption {};
config.bar = name;
}));
};
config.foo.baz.qux = {};
}];
})
.config
.foo
.baz
.qux
.bar