Skip to content

Installation

Add slate to your Gleam project:

Terminal window
gleam add slate

This adds slate to your gleam.toml dependencies. slate supports Gleam's Erlang target, which runs on the BEAM. It does not support the JavaScript target.

  • Gleam >= 1.7.0
  • Erlang/OTP >= 26 (recommended: 27+)
  • Target: Erlang only

Gleam also installs these packages:

PackagePurpose
gleam_stdlibStandard library
gleam_erlangErlang interoperability

Hex releases include the native files for these targets:

OSArchitectureBaselineAllowed filesystems
Linuxx64, ARM64glibc 2.35+, kernel 5.8+Local ext2/3/4, tmpfs
macOSx64, ARM64macOS 15+Local APFS
Windowsx64Windows Server 2022 / Windows 10+ with the MSVC runtimeFixed-drive NTFS

The native component uses Rust standard-library locks through Rustler. It requires NIF ABI 2.17 (OTP 26+). Unlocked APIs do not load it. Unsupported platforms or filesystems return typed acquisition errors; Slate does not open the table without a lock. Musl Linux, network mounts, FUSE, overlay filesystems, and other unqualified types are unsupported.

Use a local filesystem on one host. Sharing a network volume or a sidecar between hosts does not extend the support contract. Keep the data directory trusted and stable, and keep the sidecar beside the data file. tmpfs loses its contents on host restart; use persistent storage for data you must retain. On Linux, mount the containing directory rather than individual data or sidecar files. Slate requires kernel mount-identity metadata and rejects file mount points, including bind-mounted files.

Install Rust/Cargo 1.91 with your native linker, then run:

Terminal window
just native-build

The crate pins its Rust toolchain and dependencies under priv/slate_lock/source/. The build copies the native library to priv/slate_lock/<target>/. If you use an extracted Hex source package instead of a checkout, run escript priv/slate_lock/source/build.escript. Source builds need no Elixir runtime. Normal Hex consumers need no Rust compiler and do not download native code at runtime.

gleam export erlang-shipment copies the application's priv directory. Keep it in the shipment when you move or deploy the application.

gleam export escript does not include native files. Copy the target's library from Slate's priv/slate_lock/<target>/ and the native licenses/ directory to a companion directory:

my-cli
slate_native/
x86_64-linux-gnu/
slate_lock.so
licenses/
THIRD_PARTY_NOTICES.txt
manifest.json
rust/
...

Copy the complete licenses/ directory. The crate notice file contains full license texts and attribution; the rust/ directory contains separate Rust runtime notices.

Use slate_lock.so for Linux/macOS or slate_lock.dll for Windows. For a CLI that runs on more than one target, include each target directory. Slate finds slate_native beside the script, independent of the current working directory. Keep the script and companion directory together when you relocate them. A missing or incompatible library returns NativeUnavailable; unlocked APIs remain usable.

Release CI must pass independent-VM and package-loading proofs on all five targets before publishing. See exclusive sessions for the ownership and path requirements.

See the changelog for release history and breaking changes. See Stability and versioning for the versioning policy.