5 ms·
For a while now I've been looking at using Nim, and this weekend I did my first project with it: a tool for creating binary wrappers. In Nixpkgs we often create
by FRidh 6y ago
For a while now I've been looking at using Nim, and this weekend I did my first project with it: a tool for creating binary wrappers. In Nixpkgs we often create wrappers, but those have thus far been shell scripts causing trouble at times on e.g. OSX. https://github.com/NixOS/nixpkgs/pull/95569 https://github.com/NixOS/nixpkgs/pull/95569
I found it easy to get up to speed and do something useful with it. The language is also in my opinion very readable. The documentation could use some more (larger) examples though.
For this wrappers tool I needed a front-end for which I wanted to create an interface with argparse. Unfortunately the standard library lacks an implementation, and third-party packages did not deliver what I needed. In the end I wrote that part in Python still.
The biggest issue I currently find is the lack of a lock file format for its package manager. It's being developed, and as soon as its there I intend to implement support for it in Nixpkgs. https://github.com/nim-lang/nimble/issues/127 https://github.com/nim-lang/nimble/issues/127.
The compiler gives very useful output and is fast as well, and the generated binaries are small. I like this language!
- cb321 6y agoIf you use the TinyCC/tcc back end then compiling is nearly instant (I use the "tcc mob branch" all the time). You can even put a shebang at the top of your file (#!/usr/bin/nim r) and have an edit-run cycle similar to scripting languages, just a tiny edit toward "nim c -d:danger foo.nim" the file to get a production/deployment performance self-contained binary.
- disruptek 6y agoNimph has had lockfiles for months. https://github.com/disruptek/nimph https://github.com/disruptek/nimph
- FRidh 6y agoThanks! I was only aware of Nimble. I'll have a look at it. One thing I noticed right away that it seems to be lacking (judging from the `nimph.json` assuming that is the lock file) are checksums over the data or hashes of revisions the references correspond to. References such as tags are mutable, and thus hashes are needed to validate them. See e.g. the discussion over at https://github.com/NixOS/nix/pull/3216 https://github.com/NixOS/nix/pull/3216.