Support merging/overriding for unspecified attr-set options within freeformTypes (for e.g. nixpkgs.config
)
#194056
Labels
6.topic: module system
About "NixOS" module system internals
In #80582 I tried to implement merging/overriding for
nixpkgs.config
, i.e. to makepossible. We decided to close this back then because it was rather messy and later on
freeformType
was born. With this, you can create submodules with unspecified options (rather than usingtypes.attrs
for options such asnixpkgs.config
).Now it'd be theoretically possible to re-implement
options.nixpkgs.config
like this (the examples below assume this definition):This works perfectly fine with specified options or unspecified options that are not attribute-sets (e.g.
nixpkgs.config.cudaSupport
).However, it's not possible to do merging&overriding for unspecified options that are attribute-sets. With the option definition from above, you'd get the following (wrong) result for unspecified options:
results in
I guess that this is because it cannot be distinguished between
vim.gui
being an attr-set andvim.gui
containing info about an override.One might argue that
_type
is internal and thus it can be assumed to be the result of an override (or any other module-system operation). I think it might be possible to recursively applypushDownProperties
onto unspecified freeform options, but I'm not really sure if that's a good idea, so I figured I'd leave it open for discussion if we actually want to implement support for overriding/merging for unspecified attr-sets within freeformTypes (and switch nixpkgs.config to such a definition).cc @infinisil
The text was updated successfully, but these errors were encountered: