I'm new to Nim, so please excuse any confusion or assumptions. Recently I've been working on improving the Homebrew formula to make it easy to install the Nim Tools, especially nimble.
I first wrote a standalone 'nimble' formula, but I quickly ran into similar issues as detailed here. Realizing that nimble is now included in the main 'nim' distribution as of 0.15, I enhanced the 'nim' HomeBrew formula to this
And it works! Nimble installs and runs correctly. However, I soon discovered that it breaks for the '--HEAD' option. I don't use HEAD often, but I don't want to leave the formula in a half-broken state. In the main nim repository, there is no 'dist' folder. Nimble and nimsuggest are both in separate git repositories.
IMHO, both Head and point releases should have the same structure. It seems like the "easiest" solution would be to create a dist folder and use git submodules to link in the HEAD branches 'nimble' and 'nimsuggest' repos. As far as I can tell, this would have no harmful side effect.
That's my humble proposal. My backup solution is to manually check out those branches in the HEAD configuration of the Homebrew formula, but I find that to be very hacky and I'm concerned it won't be accepted in PR by the Homebrew people.
Hello! Welcome to the Nim forum :)
I think that for Nim HEAD the idea is to use the included install_nimble.nims script to install Nimble. Would that be acceptable?
Thank you for taking the time to update the Homebrew recipe!
Hi dom, awesome job on Nim btw.
I could use install_nimble.nims if it was extended so that you could pass in the path for the nim exe (the same way you can for install.sh). The problem is the path to nim is not exported until the Homebrew is finished. If that's the right path, then I'm happy to work on that.
nimgrep I can compile from the tools folder. What about nimsuggest?
OK, I have it working with install_nimble.nims and for nimgrep as well.
Does it make sense to create an install_nimsuggest.nims? How do you prep it for release builds?
@ysalmi: perhaps it would make sense if the Homebrew recipe compiled all of these tools manually? It shouldn't be difficult. The most tricky part is ensuring that the compiler sources are available for nimble and nimsuggest.
I can help you do this if you wish.
We already provide install_tools.nims for that (which should have been called build_tools instead).
@Araq: and this is what I use to build them in the point release. The problem in HEAD is that there is no "dist" folder so install_tools.nims fails. So my question: do you manually grab the source of 'nimsuggest' before running install_tools.nims?
@dom96: Such a solution would work. 'nimble' and 'nimgrep' are already handled. It's just 'nimsuggest' left to build. The building part is easy, it's where/how to get the source code. Ideally we wrap it in a small script that the homebrew solution can simply call (like we do already with install_nimble and install_tools).
I'm happy to implement one or another solution, just need to know which you prefer:
We use koch xz to build the tarballs which does populate "dist":
proc xz(args: string) =
bundleNimbleSrc()
bundleNimsuggest(false)
...
OK, I have submitted a new patch fixing the formula by grabbing nimble and nimsuggest source. I'll post a link once it's approved by the Homebrew maintainers.
@Araq: is there any possibility of tagging a nimsuggest release? Right now I have to link to a specific commit, it's kind of ugly.
My changes to the nim formula has been merged into Homebrew. So you can now install nim + tools on Mac with this:
brew install nim
Perhaps you will consider mentioning this in your install guide in the future?