lib.nixosSystem modules list type(s)?

I’m not sure exactly what can be passed in the list of modules as it can seemingly be a lot of different things, but I can’t seem to find a enumeration of those things.

What I have identified so far is:

  1. An attrset which sets config values for other modules
  2. A function/lambda which is what I would refer to as a normal modules
  3. A path referring to a file which contins a module

Is there anything else? My current issue is I have a way to get a string to a store path which contains a module, from an input which is not a flake, within a flake. However, I seeminly have no way to convert it into a path as builtins.toPath is deprecated and only returns a string anyway. The recommended way to convert to a path by concattenating a string to a path throws an error when it’s a store path:

error: a string that refers to a store path cannot be appended to a path

Maybe there is a chance that it accepts such a string?

I’ve tried looking at the code for lib.modules.evalModules, but that only made me more confused as there is seemingly infinite recursion where type is declared using lib.types.submoduleWith which itself calls lib.modules.evalModules. Maybe I’m missing something (likely) or it’s saved by lazyness? In any case, I can’t find a clear definition of what the accepted types within the list of modules.

I’d appreciate any help, or a pointer to documentation I was unable to find if it exists. Otherwise it might be worth documenting.

Seems a string that happens to contain a path does in fact work, I don’t know if this is the best place for that to be documented, but hopefully this helps out next confused person.

If there are some suggestions where to better document this, I’d be happy to help with that.