The [nimscript docs](* https://nim-lang.org/docs/nimscript.html) describe the nimscript API, but I needed some help on how to use it. (Most of the following applies to nimble too, but let's concentrate on nimscript for now.)
You *could* run your nimscript like this: `nim e foo.nims`, but that will not make your tasks available.
Instead, run **nim** on `foo.nim` like this:
nim newtask foo
nim mybuild -d:debug foo
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. That's not quite as convenient as a global `nim.cfg` file, but it's more flexible.