forked from mirrors/nixpkgs
023fa7b923
This ensures that the module file locations are propagated to the freeform type, which makes it so that submodules in freeform types now have their declaration location shown in the manual, fixing https://github.com/NixOS/nixpkgs/issues/132085. In addition, this also newly allows freeformTypes to be declared multiple times and all declarations being merged together according to normal option merging. This also removes some awkwardness regarding the type of `freeformType`
23 lines
528 B
Nix
23 lines
528 B
Nix
{ lib, options, ... }: with lib.types; {
|
|
|
|
options.fooDeclarations = lib.mkOption {
|
|
default = (options.free.type.getSubOptions [])._freeformOptions.foo.declarations;
|
|
};
|
|
|
|
options.free = lib.mkOption {
|
|
type = submodule {
|
|
config._module.freeformType = lib.mkMerge [
|
|
(attrsOf (submodule {
|
|
options.foo = lib.mkOption {};
|
|
}))
|
|
(attrsOf (submodule {
|
|
options.bar = lib.mkOption {};
|
|
}))
|
|
];
|
|
};
|
|
};
|
|
|
|
config.free.xxx.foo = 10;
|
|
config.free.yyy.bar = 10;
|
|
}
|