Unverified Commit 44f82925 authored by figsoda's avatar figsoda Committed by GitHub
Browse files

Merge pull request #234066 from figsoda/crate

parents 4e37b4e5 545206f9
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -2,6 +2,9 @@

{ crateName ? args.pname
, pname ? null
  # The `dl` field of the registry's index configuration
  # https://doc.rust-lang.org/cargo/reference/registry-index.html#index-configuration
, registryDl ? "https://crates.io/api/v1/crates"
, version
, unpack ? true
, ...
@@ -11,7 +14,7 @@ assert pname == null || pname == crateName;

(if unpack then fetchzip else fetchurl) ({
  name = "${crateName}-${version}.tar.gz";
  url = "https://crates.io/api/v1/crates/${crateName}/${version}/download";
  url = "${registryDl}/${crateName}/${version}/download";
} // lib.optionalAttrs unpack {
  extension = "tar.gz";
} // removeAttrs args [ "crateName" "pname" "version" "unpack" ])