rcl/docs/installation.md
2025-12-17 21:01:13 +01:00

74 lines
2.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Installation
RCL is written in Rust and builds with [Cargo][cargo]. RCL has few dependencies,
so its quick and easy to build from source, but you can also use the prebuilt
binaries, or use the Nix flake.
[cargo]: https://doc.rust-lang.org/cargo/guide/
## Prebuilt binaries
Binaries for several platforms are available from the [GitHub releases page][gh-rel].
Download the one appropriate one to a location on your `PATH`, and make it
executable:
curl -Lo ~/.local/bin/rcl https://github.com/ruuda/rcl/releases/download/v0.12.0/rcl-0.12.0-x86_64-unknown-linux-gnu
chmod +x ~/.local/bin/rcl
rcl --help
[gh-rel]: https://github.com/ruuda/rcl/releases
## From source
To build from source, clone the repository from one of the two mirrors:
git clone https://github.com/ruuda/rcl.git
git clone https://codeberg.org/ruuda/rcl.git
Then build with [Cargo][cargo]. The repository includes a `rust-toolchain.toml`
file that specifies a compatible Rust version. When Cargo is managed by
[Rustup][rustup], Rustup will automatically fetch the right toolchain.
cargo build --release
Put the binary on your `PATH` to be able to use it system-wide, e.g.:
cp target/release/rcl ~/.local/bin
[cargo]: https://doc.rust-lang.org/cargo/guide/
[rustup]: https://rust-lang.github.io/rustup/index.html
See the [building chapter](building.md) for more details about building from
source, including cross-compilation and building static binaries.
## As a Nix flake
The repository includes a Nix flake. You can run <abbr>RCL</abbr> with a
[flake-enabled][flakes] version of [Nix][nix], such as Nix 2.18:
nix run 'github:ruuda/rcl?ref=v0.12.0' -- --help
[flakes]: https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake
[nix]: https://nixos.org/download
The Nix flake also includes the Python module:
PYTHONPATH=$(nix build github:ruuda/rcl?ref=v0.12.0#pyrcl --print-out-paths)/lib python3
The Nix flake also includes a shell with all the tools needed for development,
as well as the environment that is tested on <abbr>CI</abbr>.
## Python module
The Python module is available [from Pypi as `rcl-lang`][pypi]. You can install
it with your favorite Python package manager, e.g.:
uv run --with rcl-lang python3
>>> import rcl
>>> rcl.loads("10 + 32")
42
To build the Python module from source, see `README.md` in the `pyrcl` directory
in the repository.
[pypi]: https://pypi.org/project/rcl-lang/