The [nimscript docs](https://nim-lang.org/docs/nimscript.html) describe the nimscript API, but I needed some help on how to use it. (Note: [these docs](https://nim-lang.org/docs/nims.html) are better.)
(Most of the following applies to nimble too, but let's concentrate on nimscript for now.)
All the [standard `.cfg` files](https://nim-lang.org/docs/nimc.html#compiler-usage-configuration-files) are read *before* your nimscript. You can use `include` to avoid repeating code for each tool-specific `.nims` file. You can also use a directory-global `config.nims` nimscript, similar to `nim.cfg`.