Packages

In-process Linux sandbox for untrusted commands - Erlang SDK (NIF over the libcvisor C ABI)

Current section

Files

Jump to
cvisor rebar.config
Raw

rebar.config

%% cvisor — Erlang SDK for the cVisor in-process Linux sandbox.
%%
%% The Hex tarball ships the prebuilt libcvisor-<arch>.so (built by
%% `cargo xtask ffi` from the repo root; consumers cannot rebuild the Rust
%% cdylib). The thin NIF shim (c_src/cvisor_nif.c) is small and portable, so it
%% is compiled on the consumer's machine at build time via the Makefile hook —
%% a C compiler is required on install. Linux-only; the hooks are gated so
%% `rebar3 compile` still works on macOS for development.
{erl_opts, [debug_info]}.
{deps, []}.
{project_plugins, [rebar3_hex, rebar3_ex_doc]}.
{pre_hooks, [{"(linux)", compile, "make priv/cvisor_nif.so"}]}.
{post_hooks, [{"(linux)", clean, "make clean"}]}.
%% Documentation provider for `rebar3 hex publish` (requires OTP >= 24).
%% Per-function source links must resolve to the monorepo-scoped git tag
%% (erlang-sdk-v<vsn>, tagged at publish time) AND to this package's
%% subdirectory (sdks/erlang/), since ex_doc emits paths relative to the
%% rebar3 cwd. source_url_pattern bakes both in — otherwise every link 404s.
%% Bump the two refs below together with vsn in src/cvisor.app.src.
{ex_doc, [
{source_url, <<"https://github.com/tsirysndr/cVisor">>},
{source_ref, <<"erlang-sdk-v0.2.0">>},
{source_url_pattern,
<<"https://github.com/tsirysndr/cVisor/blob/erlang-sdk-v0.2.0/sdks/erlang/%{path}#L%{line}">>},
{extras, [<<"README.md">>]},
{main, <<"readme">>}
]}.
%% The Hex file list lives in src/cvisor.app.src ({files, ...}), where
%% rebar3_hex reads it. Run `cargo xtask ffi` (and `--arch x86_64`) from the
%% repo root before publishing so priv/ holds both prebuilt libcvisor builds.
{hex, [{doc, ex_doc}]}.