410b979fe2
GitOrigin-RevId: a64e169e396460d6b5763a1de1dd197df8421688
17 lines
442 B
Nix
17 lines
442 B
Nix
{ lib, fetchzip, fetchurl }:
|
|
|
|
{ crateName ? args.pname
|
|
, pname ? null
|
|
, version
|
|
, unpack ? true
|
|
, ...
|
|
} @ args:
|
|
|
|
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";
|
|
} // lib.optionalAttrs unpack {
|
|
extension = "tar.gz";
|
|
} // removeAttrs args [ "crateName" "pname" "version" "unpack" ])
|