Wrote my first NIF and I have some questions

I wrote a simple C++ NIF that gets the unix time. It’s nothing groundbreaking, but it was great to see all of the pieces fit together pretty easily. My questions:

  1. Where is the best place to ask questions about NIFs? (Just making sure I’m not in the wrong place.)

  2. At one point, it looks like there was a package called elixir_make, but I couldn’t get it to work - it kept telling me to install gmake, which was already installed on my system. However looking at elixir_make, it looks like it was created to solve the portability problem of Linux using make and FreeBSD using gmake. Is that a problem that I can solve another way? Since in the end I just hardcoded gmake into the mix.deps file. Some code here:

defmodule Mix.Tasks.Compile.HorizonNifs do
  def run(_) do
      {result, _error_code} = System.cmd("gmake", ["priv/horizon.so"], stderr_to_stdout: true)
      IO.binwrite result
  1. Assuming that I build something worth building, what is the best way to package it so that others can use it? I don’t really understand how normal libraries are packaged (the ones that appear in the deps section of mix.exs), and I read that libraries with nifs have some extra steps due to the makefile and c src. Any tips would be great.

  2. What would you like to see in a NIF-based library? My interest is mostly in data structures, which IMHO seems like an area elixir is lacking in. I also have some ideas related to security and authentication, since those can be computationally expensive.

  3. Not really a question, but I noticed that dirty_nifs have a much higher overhead - in a tight loop I was able to execute far fewer of them. Suggests that the best way to get performance could be by combining normal nif functions with dirty nif functions as needed, so you don’t take the performance hit unnecessarily.

Bonus: Is it okay to enjoy programming both C++ and Elixir? They seem like a great match since they are both good at completely different things. Just gotta make sure my .ex files aren’t full of accidental semicolons LOL …

Appreciate the community and the help!