My understanding of it is that nim.cfg is just a list of flag passed to the compiler. The list of existing flags exists in the compiler documentation <https://nim-lang.org/docs/nimc.html>
On the other hand config.nims is a nimscript that is automatically executed upon compilation It can be used to add / define flags to the compilation, but since it is a scrip it can do much more things (define task, have conditoinnal etc.). You can find more about on the NimScript pages : <https://nim-lang.org/docs/nims.html> My recommandation would be to prefer config.nims over nim.cfg because projects builds tends to increase in complexity over time and config.nims is more equipped to handle that complexity than nim.cfg.
