I'm back exploring Nim. :-) I started using nimble and one thing is not clear to me:
How does nimble manage the various versions of a package for my different projects? From what I can see no environment is created per project, but everything is installed into one store. Is this correct?
It is correct, but Nimble installs various versions of the same package to different directories, which allows you to have packages depending on different versions of the same package simultaneously and without introducing environments.
I'm not sure which version is imported if two are installed though. Probably the latest one?
One thing does come to mind though: How can I "pin" versions with nimble?
Say, I compile a project A against external module "fancy 1.3". All works. A few months later I change some stuff in my code, so I need to recompile. However fancy has been upgraded to backwards-incompatible "fancy 2.0" and for another project B which I just started I have upgraded nimble to fancy 2.0.
The compilation of project A will fail if I cannot "pin" its version of fancy to "1.3".
Put this in your *.nimble file:
requires "fancy == 1.3"
Note that eventually we hope Nimble will gain lockfiles support, so these pinned versions will not belong in the .nimble file.
For now you can certainly pin it in .nimble though and I do that a lot myself.
If you are writing packages for other packages, it is better to use range
requires "foo >= 0.1.2 & < 0.2.0"
requires "bar >= 1.3.1 & < 2.0"
Also, be more considerate on Nim verison, don't be too aggressive using the latest one
requires "nim >= 1.2.0"