NixOS Module System | 157 Members | |
| 30 Servers |
| Sender | Message | Time |
|---|---|---|
| 16 May 2025 | ||
| I never acquainted with
| 19:49:57 | |
| I believe the issue is the
| 19:52:25 | |
Some of the "container types" don't really check what's inside before being evaluated at a later stage. I believe this is the case for submodules, listOf and attrsOf. As a hack, you can add those checks with lib.types.addCheck. Same scenario with either and oneOf. | 19:53:46 | |
It's intentional that the submodule-type's check function is not very restrictive, since you can assign any module to a submodule and it is down to the submodule's configuration to evaluate and merge its own definitions internally. | 19:53:58 | |
E.g. foo = {} is a vaild definition, as is foo = { config, ... }: { }, as is foo = ./someModule.nix | 19:54:55 | |
| 19:57:21 | |
| The other issue with marker options (
You don't know which marker is defined until all merging is done. In a simple case like this, you could refactor this as one submodule with both markers, and then add some extra logic/conditions within the submodule and/or in the optinon's final | 20:02:16 | |
| Also ref https://discourse.nixos.org/t/problems-with-types-oneof-and-submodules/15197 | 20:03:59 | |