Skip to content

ProvableHQ/leo.nix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

leo.nix

A Nix flake for the Leo language.

Supports Linux. MacOS supported, but untested currently.

Usage

  1. Install Nix, easiest with the Determinate Systems installer.

  2. Use Nix to enter a shell with the leo CLI:

    nix shell github:provablehq/leo.nix
  3. Check that it works with:

    leo -h

Prebuilt binaries

The leo-bin and snarkos-bin packages skip the from-source build and fetch the upstream release archives directly. Useful when you just want to run a specific released version without waiting for cargo.

# Latest stable combined: leo-lang + compat-resolved leo-fmt + leo-lsp.
nix shell github:provablehq/leo.nix#leo-bin

# A pinned bundle, keyed by leo-lang version:
nix shell 'github:provablehq/leo.nix#leo-bin."4.1.0"'

# Individual components, each with its own version set:
nix shell github:provablehq/leo.nix#leo-cli-bin               # latest leo-lang
nix shell github:provablehq/leo.nix#leo-fmt-bin               # latest leo-fmt
nix shell github:provablehq/leo.nix#leo-lsp-bin               # latest leo-lsp
nix shell 'github:provablehq/leo.nix#leo-fmt-bin."4.1.0"'
nix shell 'github:provablehq/leo.nix#leo-lsp-bin."4.0.2"'     # older leo-lsp patch

# snarkOS:
nix shell github:provablehq/leo.nix#snarkos-bin
nix shell 'github:provablehq/leo.nix#snarkos-bin."4.7.2"'

The combined leo-bin.<leo-lang-version> resolves which plugin versions to bundle by reading each plugin release's own leo-release.toml. For a given leo-lang version it picks the highest plugin version whose compat.leo-lang matches, falling back to the leo-lang release's own toml pin when no plugin release has explicitly claimed compatibility. Older plugin releases (e.g. leo-lsp-v4.0.2, which predates the leo-release.toml convention) are still individually addressable as leo-lsp-bin."4.0.2" but won't accidentally land in any combined bundle.

Supported targets: x86_64-linux (leo, snarkos), x86_64-darwin (leo), aarch64-darwin (leo, snarkos). On systems with no upstream binary (aarch64-linux), use the from-source leo and snarkos packages instead.

Refreshing the manifest

Manifests live at manifests/{leo,snarkos}-bin.toml and are regenerated by helper scripts that prefetch every (component, target) archive and record its SRI hash.

To pull in every available upstream stable release in one go:

nix run .#update-bin-manifests           # cached: skips entries already recorded
nix run .#update-bin-manifests -- --force  # re-hashes every (component, target)

This enumerates GitHub releases, keeps the tags we know how to handle (leo-lang-vX.Y.Z, leo-fmt-vX.Y.Z, leo-lsp-vX.Y.Z for leo; vX.Y.Z with major ≥ 4 for snarkOS), and imports each version. Entries already present in the manifest are reused without re-downloading; use --force if upstream re-issued an archive under the same tag. Versions that no longer match the filter (or that upstream deleted) are pruned at the end of each component's import loop. Set GITHUB_TOKEN to authenticate API calls if you hit the anonymous rate limit.

To target a single component release:

nix run .#update-bin-manifest --         leo-lang 4.1.0
nix run .#update-bin-manifest --         leo-fmt  4.1.0
nix run .#update-bin-manifest --         leo-lsp  4.0.2
nix run .#update-bin-manifest -- --force snarkos  4.7.2

Re-running either command on an already-recorded version is a no-op — the manifest pair stays byte-identical. The latest pointer is set to the highest recorded semver. Targets that upstream didn't publish for a given release (e.g. x86_64-apple-darwin on snarkOS v4.7.x) are skipped with a warning and simply omitted from that version's entry.

Developing leo

If you're working on the leo repo itself, the following command can be useful. It allows you to enter a development shell with all of the necessary dependencies and environment variables to build leo and run the tests. This includes snarkos (with testnet enabled), openssl and pkg-config.

nix develop github:provablehq/leo.nix

About

A Nix flake for the Leo language.

Resources

Stars

Watchers

Forks

Contributors