Hello.
When integrating Nim into please.build—a build system very similar in concept to Bazel—and using Atlas’s pin/rep feature to achieve reproducible builds, I had to work around a very basic issue: the location of the nim.cfg compiler configuration file.
In a nutshell, the build system provides an isolated environment with a temporary directory where commands are executed. So when running atlas rep to recreate dependencies, everything happens inside this temporary directory, where the source files are not present.
As a result, I had to manually copy the sources into this directory, because the Nim compiler lacks a simple command-line argument like --nimCfg to explicitly specify the location of this file.
Instead, there is a set of locations where the compiler automatically searches for it, as described in https://nim-lang.org/docs/nimc.html#compiler-usage-configuration-files
If I were to implement it, how complex do you think it would be ?
I don't get it, project specific configuration can be moved into the same temporary directory (a very annoying idea btw so then if the build ever fails you are navigated to this temp directory, that's terrbile UX!) without any issues.
And the compiler wide configuration is tied to the compiler's location. So nothing needs to be done here, unless your build system also copies the compiler around, but even then copy its config with it and things will work out.
Nim does provides the --path: option which you can use to add the main project's sources as well, just as Atlas does.
You can probably use some combo of these Atlas options to setup the nim.cfg file elsewhere:
--project=path, -p use the project at the given path
--deps=path override the deps directory
--confdir=path use the atlas.config at the given path
PS: A Build system that fills /tmp with source code is a terrible idea. If the build fails you are navigated to this temp directory, that's a bad UX!
Not only that, but Debian 13 changed /tmp a tmpfs (ram) filesystem.
So hopefully Please system isn't using /tmp otherwise it'll be fun when your RAM disappears.