SagaSaga
Guide

Installation

Saga compiles to Core Erlang and runs on the BEAM, so you'll need Erlang/OTP installed alongside the Saga compiler.

Install Erlang

Saga requires Erlang/OTP 26 or later. Install it however you prefer:

# mise
mise install erlang

# Homebrew (macOS)
brew install erlang

# apt (Debian/Ubuntu)
sudo apt install erlang

Verify the install:

erl -version

If you run into build issues on Linux, the Erlang Solutions package repository offers pre-built binaries as an alternative.

Installing rebar3 (only needed for some dependencies)

rebar3 is the Erlang build tool. You only need it if you use Hex dependencies that include NIFs (native C/Rust extensions). Most projects don't need this.

mise install rebar3
# or
brew install rebar3

Install Saga

The install script downloads the latest pre-built binary for your platform:

curl -fsSL https://raw.githubusercontent.com/dylantf/saga/main/install.sh | sh

Building from source

You'll need Rust installed.

git clone https://github.com/dylantf/saga.git
cd saga
cargo build --release

The compiled binary will be at target/release/saga. Add it to your PATH or copy it somewhere convenient:

cp target/release/saga ~/.local/bin/

Nix

Saga's flake exposes a package you can drop into a devShell or any other Nix environment. Add it as an input and reference saga.packages.${system}.default:

{
  description = "my saga project";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
    saga.url = "github:dylantf/saga";
  };

  outputs =
    {
      self,
      nixpkgs,
      flake-utils,
      saga,
    }:
    flake-utils.lib.eachDefaultSystem (
      system:
      let
        pkgs = import nixpkgs { inherit system; };
      in
      {
        devShells.default = pkgs.mkShell {
          packages = [
            pkgs.erlang_27
            pkgs.rebar3
            saga.packages.${system}.default
          ];
        };
      }
    );
}

Run nix develop to drop into a shell with saga and erl on your PATH.

Editor Setup

The VS Code extension gives you the full language server experience:

  • Syntax highlighting
  • Inline type errors as you type
  • Hover to see inferred types
  • Go-to-definition across modules
  • Auto-complete for functions and types

Install Saga LSP from the VS Code marketplace, or search for saga-lsp in the Extensions panel.