Pradeep's Stream

Things I learnt about Nim while writing Tohray

  • Karax's vdom is super sweet for building HTML interfaces. I like it lot more than using any kind of templates now. the mismatch between code and markup(HTML) is jarring after this.

  • I learnt how to write a .nimble for a working project. Nimble had always left me frustrated.

  • I leant about the distros package and specifically the foreignDep method. With this essentially, I was able to replace apt-get install blah with (see below), which captures the package dependency with the code and not in a script or a Dockerfile

import distros
if detectOs(Ubuntu):
  foreignDep "libpcre3-dev"
  foreignDep "libsqlite3-dev"
  foreignDep "build-essential"
  foreignDep "wget"
  • Once or twice, I thought using a class to share variables would have been nicer. I have to study that more.

  • Learnt about using SQLite's Full Text Search, mostly through the help from Anthropic Claude. The FTS felt finicky with it's inability to handle special characters. But, it's a start towards understanding a powerful DB feature - FTS.

  • Got a lot more comfortable with using multi-stage Docker builds

  • Tried my hand at statically building tohray binary. It was coming out to be 20MB ALL INCLUSIVE, which is a great small size for a full fledged web app. However, I could not figure out how to statically link libpcre.

  • The hunt for static building took me to hello_musl, a mere .nims config, but it showed the power of nim scripting. I think the way forward for static linking pcre is to improve the above script.

Calendar , Export