I have been trying out atlas; really like the premise, and its features are great so far. I have found that nimble build doesn't seem to behave correctly alongside, however. But I'm not sure if I'm missing something.
If I set up a workspace + project with atlas, I can build it fine via nim c, but if I use nimble build, nimble still tries to download the dependencies to NIMBLE_DIR. Is this expected? (My nimble was installed by building the v2.0.0 tag of nim-lang/nim.)
Here's an example transcript:
% cd /tmp % export NIMBLE_DIR=/tmp/nimble_pkgs % mkdir foo && cd foo % atlas init [Info] (/private/tmp/foo) created workspace file [Info] () created deps dir % atlas new foo [Info] (/private/tmp/foo) is the current workspace [Info] (foo) created project dir % cd foo % atlas use fusion [Info] (/private/tmp/foo) is the current workspace [Info] (packages) Cloning url: https://github.com/nim-lang/packages Cloning into 'packages'... remote: Enumerating objects: 15, done. remote: Counting objects: 100% (15/15), done. remote: Compressing objects: 100% (12/12), done. remote: Total 15 (delta 1), reused 9 (delta 0), pack-reused 0 Receiving objects: 100% (15/15), 154.04 KiB | 1.22 MiB/s, done. Resolving deltas: 100% (1/1), done. [Info] (foo/foo) created: foo.nimble [Info] (foo/foo) installing dependencies for foo.nimble [Info] (foo/fusion) traversing dependency [Info] (fusion) cloning: https://github.com/nim-lang/fusion [Info] (fusion) Cloning url: https://github.com/nim-lang/fusion Cloning into '/private/tmp/foo/fusion'... remote: Enumerating objects: 42, done. remote: Counting objects: 100% (42/42), done. remote: Compressing objects: 100% (37/37), done. remote: Total 42 (delta 1), reused 20 (delta 1), pack-reused 0 Receiving objects: 100% (42/42), 105.31 KiB | 1.08 MiB/s, done. Resolving deltas: 100% (1/1), done. [Info] (foo/fusion) resolvePackageName: nimble: found: Package(name:fusion, repo:fusion, url:https://github.com/nim-lang/fusion, p:/private/tmp/foo/fusion, x:true, nbl:/private/tmp/foo/fusion/fusion.nimble) [Info] (fusion/fusion) updated package to 0b0a0273b8df860cd54e3fcca7bb4c617244ac77 [Info] (fusion/fusion) updated submodules [Info] (foo) created: nim.cfg % echo 'import fusion/matching\n\necho "Hello, world!"' >> foo.nim % cat nim.cfg ############# begin Atlas config section ########## --noNimblePath --path:"../fusion/src" ############# end Atlas config section ########## % nimble build Info: Using the environment variable: NIMBLE_DIR='/tmp/nimble_pkgs' Verifying dependencies for foo@-1 Prompt: No local packages.json found, download it from internet? [y/N] Answer: N Installing fusion@any version Tip: 5 messages have been suppressed, use --verbose to show them. nimble.nim(683) getDownloadInfo Error: Package fusion@any version not found. % nim r --hints:off --warnings:off foo.nim Hello, world!
If I set up a workspace + project with atlas, I can build it fine via nim c, but if I use nimble build, nimble still tries to download the dependencies to NIMBLE_DIR. Is this expected?
Yes, it is expected. And I think nothing can be done about it as the NIMBLE_DIR is incompatible with the structure that Atlas uses. But also: Why does it matter? What's the benefit of nimble build when you use Atlas to manage your deps?
nimble build provides some form of buildsystem management that's easy to setup and use. Which atlas doesn't provide, because it relies on nim c ... instead. But that is not mentioned anywhere, and there is also no guide on how to transition from one to the other.
So, even though there might be no practical use for nimble build after using atlas, the lack of knowing that makes it so that this creates confusion.
Atlas is great, I wholly agree with OP. But it 1000% needs more docs, and specially a nimble-to-atlas transition guide.
https://github.com/nim-lang/atlas#tutorial
Now import malebolgia in your Nim code and run the compiler as usual:
echo "import malebolgia" >myproject.nim
nim c myproject.nim
https://github.com/nim-lang/atlas/blob/master/doc/atlas.md#no-magic
https://github.com/nim-lang/atlas/blob/master/doc/atlas.md#how-it-works
Feel free to tell me where and how to improve the documentation.
What's the benefit of nimble build when you use Atlas to manage your deps?
Well, I started out trying atlas build but of course that is currently an alias for nimble build. If the intended process for now is to just use nim c then I think that resolves my question, thanks!
If the intended process (at least for now) is to just use nim c then I think that resolves my question, thanks!
That is indeed the intended process and not an interim solution either, it's Atlas's key feature and design aspect. It means Atlas does not have to replicate nim c, nim cpp, nim js, nim check and nimsuggest. It is the key behind Atlas's simplicity.
That is indeed the intended process and not an interim solution either, it's Atlas's key feature and design aspect.
Got it, thanks! I assumed that the atlas build command would be the new way. I am curious to see what that command is renamed/turned into.
Sure here's an example with Nimble integration: https://github.com/codex-storage/nim-codex-dht/blob/ee5d8acb05780aa9f591303fc9a10ea0f6a7bbe9/codexdht.nimble#L26
You can do it directly in config.nims too: https://github.com/elcritch/figuro/blob/4e34a170eb043e6991b0813d67474f0286612c17/config.nims#L51