3 ms·
I'm thinking about rewriting a very popular open source project of mine in a language that can spit out a simple binary people can double click or have it run i
by sergiotapia 8y ago
I'm thinking about rewriting a very popular open source project of mine in a language that can spit out a simple binary people can double click or have it run in a terminal window to serve API requests.
Does Nim have true single-binary deploys like Go has? My original project is written in Elixir and even with Distillery it still seems a little convoluted for what I'm trying to deliver to end users.
I want a real, download this and run it boom, go to localhost:1234 for some cool stuff.
- kaushalmodi 8y agoIt's certainly possible! You just need to know which compiler to use. For example, I used musl-gcc to compile a static binary that can run on any 64-bit GNU/Linux type OS. See my recent post https://scripter.co/nim-deploying-static-binaries/ https://scripter.co/nim-deploying-static-binaries/. Download and run binary to try: https://github.com/kaushalmodi/hello_musl/releases https://github.com/kaushalmodi/hello_musl/releases (prints just "Hello, world!"). I plan to release similar binary for my ntodo[0] project, that will make API calls to fetch/set tasks in Todoist. [0]: https://github.com/kaushalmodi/ntodo https://github.com/kaushalmodi/ntodo
- dom96 8y agoYes, Nim has this. There is a caveat though, but AFAIK Go has the same problem. Certain Nim modules/packages might wrap a C library. If you use those then your binary will typically depend on a DLL for that C library. With some effort you can statically link against those libraries, but I wouldn't call that easy. This is in particular a problem when you're using regex or SSL, the former depends on PCRE and the latter on OpenSSL/LibreSSl. Go benefits from having native implementations of those written in Go. We also now have a regex engine[1] implemented in Nim but it hasn't made its way into the stdlib yet (that is planned though). But you can use it pretty easily as a package if you want to avoid the dependency on PCRE. 1 - https://github.com/nitely/nim-regex https://github.com/nitely/nim-regex
- FraaJad 8y agoNot exactly what you asked for, but for shipping the same app on multiple platforms, this may prove useful - https://hookrace.net/blog/writing-a-2d-platform-game-in-nim-with-sdl2/ https://hookrace.net/blog/writing-a-2d-platform-game-in-nim-...