1 { lib, fetchzip, fetchurl }:
3 { crateName ? args.pname
5 # The `dl` field of the registry's index configuration
6 # https://doc.rust-lang.org/cargo/reference/registry-index.html#index-configuration
7 , registryDl ? "https://crates.io/api/v1/crates"
13 assert pname == null || pname == crateName;
15 (if unpack then fetchzip else fetchurl) ({
16 name = "${crateName}-${version}.tar.gz";
17 url = "${registryDl}/${crateName}/${version}/download";
18 } // lib.optionalAttrs unpack {
20 } // removeAttrs args [ "crateName" "pname" "registryDl" "version" "unpack" ])