Submodule with list argument

Hi all,

I tried understanding the systemd utility functions in nixpkgs and found this code: nixpkgs/systemd-types.nix at 91a3819bad39f4a9d8cba7ee2458fd3adab12195 · NixOS/nixpkgs · GitHub

I am confused that the argument to submodule is a list. The documentation states it should be a function or a set: NixOS 22.05 manual

Could someone elaborate what the code does? Is it just merging the elements of the list and using it as the set?


1 Like

Oh no, the docs are outdated. It does support lists indeed. The semantics are that

types.submodule [ a b c ]

is the same as

types.submodule {
  imports = [ a b c ];
1 Like

Oh, I see! Great, thanks!

I submitted a PR. Not sure the wording is great, accepting suggestions.


That’s awesome thanks!