Margo is an alternate Cargo registry that is built using completely static files, allowing it to be easily served.
To use Margo in GitHub Actions, such as hosting your registry on GitHub Pages, check out our action.
cargo install margo --index sparse+https://integer32llc.github.io/margo/
This will create a new registry in the directory
my-registry-directory
that you plan to serve from
https://my-registry.example.com
.
margo init my-registry-directory --base-url https://my-registry.example.com
To add a new crate or version to the registry, run margo add
and specify
the path to the directory you gave to margo init
and the .crate
file
to publish.
# Acquire a crate package, such as by running `cargo package`
margo add --registry my-registry-directory some-crate/target/package/some-crate-1.2.3.crate
For example, using Python and serving the registry in the directory
at 127.0.0.1
:
python3 -m http.server --bind '127.0.0.1' --dir 'my-registry-directory'
You should be able to visit 127.0.0.1/config.json
in your browser.
Your next step is to serve those files from
https://my-registry.example.com
instead, in whatever way you
serve static files from whatever URL you've specified.
# In your Rust project that wants to use `some-crate`
mkdir .cargo
cat >>.cargo/config.toml <<EOF
[registries]
my-registry = { index = "sparse+https://my-registry.example.com" }
EOF
cargo add --registry my-registry some-crate
- 💅 Does not impose file size limits
- 💅 Can depend on crates from registries other than crates.io
- 💅 Dependencies are not required to exist
- 💅 Development dependency info is not stored in the index
- 💅 Does not require JavaScript
- 💅 Simpler so it's easier to customize for your use case
- 💅 Access managed via however you currently manage read or write access to static files
See CONTRIBUTING.md.
See DEVELOPMENT.md.