3 releases (breaking)
0.4.0 | Feb 3, 2023 |
---|---|
0.3.0 | Dec 30, 2022 |
0.2.0 | Aug 7, 2022 |
#1554 in Network programming
13KB
90 lines
zerus
Lightweight binary to download only project required crates for offline crates.io mirror
Requirements
The example use case is with nightly feature sparse-registry. However, a crates.io-index mirror git repo can be hosted on its on and point towards this repo with stable rust.
Build zerus
Either build from published source in crates.io.
$ cargo install zerus --locked
Or download from github releases.
Usage
Usage: zerus <MIRROR_PATH> [WORKSPACE]...
Arguments:
<MIRROR_PATH> new directory to contain offline mirror crate files
[WORKSPACE]... list of Cargo.toml files to vendor depends
Options:
-h, --help Print help information
Example:
$ zerus new-mirror ../deku/Cargo.toml ../adsb_deku/Cargo.toml
$ cd new-mirror
$ git clone https://github.com/rust-lang/crates.io-index
# configure crates.io-index to point to our host
$ cat crates.io-index/config.json
{
"dl": "http://[IP]/crates/{prefix}/{crate}/{version}/{crate}-{version}.crate",
"api": "http://[IP]/crates"
}
Serve mirror
Use miniserve.
Build with mirror
Add the following to the .cargo/config
file(replacing IP with your ip).
[registries.crates-io]
protocol = "sparse"
[source.zerus]
registry = "sparse+http://[IP]/crates.io-index/"
[source.crates-io]
replace-with = "zerus"
Dependencies
~8–22MB
~340K SLoC