talira

Rustler Precompiled

Ships precompiled Rustler NIFs so Elixir users don't need the Rust toolchain

open sourceApache-2.0free

Rustler Precompiled lets an Elixir package that uses Rustler NIFs ship them precompiled, so the people who install it don't need a Rust toolchain. The NIFs are built in CI (the guide uses GitHub Actions releases) for each target and NIF version, and when a user installs the package it downloads the matching artifact and checks it against the SHA-256 checksum file published in the Hex package, which guards against a swapped binary. Rustler itself stays an optional dependency, used only in development.

Problems it solves

  • publish an Elixir library with a Rust NIF without making users install Rust
  • speed up installs of my Rustler-based Hex package
  • distribute prebuilt native binaries safely with my Elixir package

Features

  • Downloads a precompiled NIF for the user's target instead of compiling Rust
  • Checks each download against a SHA-256 checksum file shipped in the Hex package
  • Builds artifacts in CI for each OS, architecture and NIF version
  • Works with GitHub Actions releases and artifact attestations

Alternatives

The same job

These do what Rustler Precompiled does.

  1. Rustler Write Erlang and Elixir NIFs in safe Rust
  2. Unifex Generates the interface between native C code and Elixir

Compare Rustler Precompiled with the top 3