I’ve been learning about Elixir Nif’s for a while, and it looks like I will have my first library to release shortly and could use some help with learning how that process works. It is a fixed-row caching library, and IMHO it is a gamechanger for elixir apps that are planning to use or that are already using embedded node-local storage (i.e. sqlite, dets, cubdb, leveldb, etc). Details to follow.
I could use some help with understanding the process associated with releasing a library as a hex package and on github or a similar site (I don’t know what the best alternative is nowadays). Any pointers, info, insights would be greatly appreciated, especially if they are Nif related.
FWIW, I am currently doing my compilation like this, which is fine for testing but won’t fly for a release I know:
def project do
[
app: :daphne,
version: "0.1.0",
elixir: "~> 1.14",
start_permanent: Mix.env() == :prod,
compilers: Mix.compilers ++ [:NifBuilder], <<==== set custom compiler in mix.exs
deps: deps()
]
end
defmodule Mix.Tasks.Compile.NifBuilder do
def run(_args) do
{result, _errcode} = System.cmd("gmake", [], stderr_to_stdout: true)
IO.binwrite(result)
end
end
Since your library contains a nif you’ll probably also want to look at GitHub - elixir-lang/elixir_make: A Make compiler for Mix which helps compiling code without calling make/gmake directly (since which one you use might be platform dependent).
Is this related to umbrella apps? I’m familiar with the concept but have never used them. TBH I don’t even know how to get started when it comes to code organization - the hex publishing docs tell me how to publish not what to publish. But maybe I can find a similar small project and the understanding will come.