#offline #mirror #download #vendor #crates

app zerus

Lightweight binary to download only project required crates for offline crates.io mirror

12 releases (breaking)

new 0.11.0 Feb 10, 2025
0.10.1 Oct 25, 2024
0.9.0 Oct 12, 2024
0.8.1 May 30, 2024
0.2.0 Aug 7, 2022

#120 in Development tools

Download history 39/week @ 2024-10-14 345/week @ 2024-10-21 16/week @ 2024-10-28 21/week @ 2024-12-09

542 downloads per month

MIT/Apache

30KB
431 lines

zerus

github crates.io docs.rs build status

Lightweight binary to download only project required crates for offline crates.io mirror

Build zerus

Either build from published source in crates.io.

$ cargo install zerus --locked

Or download from github releases.

Usage

Usage: zerus [OPTIONS] <MIRROR_PATH> [WORKSPACES]...

Arguments:
  <MIRROR_PATH>    new directory to contain offline mirror crate files
  [WORKSPACES]...  list of Cargo.toml files to vendor depends

Options:
      --build-std <VERSION>            Cache build-std depends for nightly version
      --git-index-url <GIT_INDEX_URL>  Hostname for git index crates.io
      --skip-git-index                 Skip download of git index crates.io
  -h, --help                           Print help
  -V, --version                        Print version

Example of adding dependencies of two projects, meant to be hosted on 127.0.0.1.

$ zerus new-mirror ../deku/Cargo.toml ../adsb_deku/Cargo.toml --git-index-url http://127.0.0.1

Adding the top 100 rust crates used by rust-playground is easy:

$ git clone https://github.com/rust-lang/rust-playground
$ zerus new-mirror rust-playground/top-crates/Cargo.toml

Serve mirror

Use any http(s) server.

Build with mirror

Add the following to the .cargo/config file(replacing IP with your ip).

[source.zerus]
registry = "sparse+http://[IP]/crates.io-index/"

[source.crates-io]
replace-with = "zerus"

Margo

Through the use of margo, you can make a alternate Cargo registry without downloading the entire crates.io git index.

$ zerus mirror ../deku/Cargo.toml --build-std nightly --skip-git-index
$ margo add --registry my-registry-directory mirror/*/*/*/*/*/*.crate

Dependencies

~18–35MB
~634K SLoC